Skip to content

Commit

Permalink
apacheGH-38648: [Java] Regenerate Flatbuffers (apache#38650)
Browse files Browse the repository at this point in the history
### Rationale for this change

Regenerate the Flatbuffers to include new formats. Flatbuffers are always forwards/backwards compatible as long as the code is generated from the same `flatc` compiler version.

### What changes are included in this PR?

* Flatbuffers regenerated with `flatc` v1.12.0

### Are these changes tested?

Yes, via unit tests.

### Are there any user-facing changes?

Yes, RecordBatch.java was modified.
* Closes: apache#38648

Authored-by: Dane Pitkin <[email protected]>
Signed-off-by: David Li <[email protected]>
  • Loading branch information
danepitkin authored Nov 9, 2023
1 parent 80503a6 commit 1f71014
Show file tree
Hide file tree
Showing 11 changed files with 435 additions and 51 deletions.
57 changes: 57 additions & 0 deletions java/format/src/main/java/org/apache/arrow/flatbuf/BinaryView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// automatically generated by the FlatBuffers compiler, do not modify

package org.apache.arrow.flatbuf;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;

@SuppressWarnings("unused")
/**
* Logically the same as Binary, but the internal representation uses a view
* struct that contains the string length and either the string's entire data
* inline (for small strings) or an inlined prefix, an index of another buffer,
* and an offset pointing to a slice in that buffer (for non-small strings).
*
* Since it uses a variable number of data buffers, each Field with this type
* must have a corresponding entry in `variadicBufferCounts`.
*/
public final class BinaryView extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
public static BinaryView getRootAsBinaryView(ByteBuffer _bb) { return getRootAsBinaryView(_bb, new BinaryView()); }
public static BinaryView getRootAsBinaryView(ByteBuffer _bb, BinaryView obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
public BinaryView __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }


public static void startBinaryView(FlatBufferBuilder builder) { builder.startTable(0); }
public static int endBinaryView(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
}

public static final class Vector extends BaseVector {
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }

public BinaryView get(int j) { return get(new BinaryView(), j); }
public BinaryView get(BinaryView obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public final class BodyCompression extends Table {
public BodyCompression __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

/**
* Compressor library
* Compressor library.
* For LZ4_FRAME, each compressed buffer must consist of a single frame.
*/
public byte codec() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 0; }
/**
Expand Down
4 changes: 2 additions & 2 deletions java/format/src/main/java/org/apache/arrow/flatbuf/Date.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

@SuppressWarnings("unused")
/**
* Date is either a 32-bit or 64-bit type representing elapsed time since UNIX
* epoch (1970-01-01), stored in either of two units:
* Date is either a 32-bit or 64-bit signed integer type representing an
* elapsed time since UNIX epoch (1970-01-01), stored in either of two units:
*
* * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no
* leap seconds), where the values are evenly divisible by 86400000
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// automatically generated by the FlatBuffers compiler, do not modify

package org.apache.arrow.flatbuf;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;

@SuppressWarnings("unused")
/**
* Same as ListView, but with 64-bit offsets and sizes, allowing to represent
* extremely large data values.
*/
public final class LargeListView extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
public static LargeListView getRootAsLargeListView(ByteBuffer _bb) { return getRootAsLargeListView(_bb, new LargeListView()); }
public static LargeListView getRootAsLargeListView(ByteBuffer _bb, LargeListView obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
public LargeListView __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }


public static void startLargeListView(FlatBufferBuilder builder) { builder.startTable(0); }
public static int endLargeListView(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
}

public static final class Vector extends BaseVector {
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }

public LargeListView get(int j) { return get(new LargeListView(), j); }
public LargeListView get(LargeListView obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
}

53 changes: 53 additions & 0 deletions java/format/src/main/java/org/apache/arrow/flatbuf/ListView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// automatically generated by the FlatBuffers compiler, do not modify

package org.apache.arrow.flatbuf;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;

@SuppressWarnings("unused")
/**
* Represents the same logical types that List can, but contains offsets and
* sizes allowing for writes in any order and sharing of child values among
* list values.
*/
public final class ListView extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
public static ListView getRootAsListView(ByteBuffer _bb) { return getRootAsListView(_bb, new ListView()); }
public static ListView getRootAsListView(ByteBuffer _bb, ListView obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
public ListView __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }


public static void startListView(FlatBufferBuilder builder) { builder.startTable(0); }
public static int endListView(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
}

public static final class Vector extends BaseVector {
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }

public ListView get(int j) { return get(new ListView(), j); }
public ListView get(ListView obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,54 @@ public final class RecordBatch extends Table {
*/
public org.apache.arrow.flatbuf.BodyCompression compression() { return compression(new org.apache.arrow.flatbuf.BodyCompression()); }
public org.apache.arrow.flatbuf.BodyCompression compression(org.apache.arrow.flatbuf.BodyCompression obj) { int o = __offset(10); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
/**
* Some types such as Utf8View are represented using a variable number of buffers.
* For each such Field in the pre-ordered flattened logical schema, there will be
* an entry in variadicBufferCounts to indicate the number of number of variadic
* buffers which belong to that Field in the current RecordBatch.
*
* For example, the schema
* col1: Struct<alpha: Int32, beta: BinaryView, gamma: Float64>
* col2: Utf8View
* contains two Fields with variadic buffers so variadicBufferCounts will have
* two entries, the first counting the variadic buffers of `col1.beta` and the
* second counting `col2`'s.
*
* This field may be omitted if and only if the schema contains no Fields with
* a variable number of buffers, such as BinaryView and Utf8View.
*/
public long variadicBufferCounts(int j) { int o = __offset(12); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; }
public int variadicBufferCountsLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; }
public LongVector variadicBufferCountsVector() { return variadicBufferCountsVector(new LongVector()); }
public LongVector variadicBufferCountsVector(LongVector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
public ByteBuffer variadicBufferCountsAsByteBuffer() { return __vector_as_bytebuffer(12, 8); }
public ByteBuffer variadicBufferCountsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 12, 8); }

public static int createRecordBatch(FlatBufferBuilder builder,
long length,
int nodesOffset,
int buffersOffset,
int compressionOffset) {
builder.startTable(4);
int compressionOffset,
int variadicBufferCountsOffset) {
builder.startTable(5);
RecordBatch.addLength(builder, length);
RecordBatch.addVariadicBufferCounts(builder, variadicBufferCountsOffset);
RecordBatch.addCompression(builder, compressionOffset);
RecordBatch.addBuffers(builder, buffersOffset);
RecordBatch.addNodes(builder, nodesOffset);
return RecordBatch.endRecordBatch(builder);
}

public static void startRecordBatch(FlatBufferBuilder builder) { builder.startTable(4); }
public static void startRecordBatch(FlatBufferBuilder builder) { builder.startTable(5); }
public static void addLength(FlatBufferBuilder builder, long length) { builder.addLong(0, length, 0L); }
public static void addNodes(FlatBufferBuilder builder, int nodesOffset) { builder.addOffset(1, nodesOffset, 0); }
public static void startNodesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(16, numElems, 8); }
public static void addBuffers(FlatBufferBuilder builder, int buffersOffset) { builder.addOffset(2, buffersOffset, 0); }
public static void startBuffersVector(FlatBufferBuilder builder, int numElems) { builder.startVector(16, numElems, 8); }
public static void addCompression(FlatBufferBuilder builder, int compressionOffset) { builder.addOffset(3, compressionOffset, 0); }
public static void addVariadicBufferCounts(FlatBufferBuilder builder, int variadicBufferCountsOffset) { builder.addOffset(4, variadicBufferCountsOffset, 0); }
public static int createVariadicBufferCountsVector(FlatBufferBuilder builder, long[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addLong(data[i]); return builder.endVector(); }
public static void startVariadicBufferCountsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
public static int endRecordBatch(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// automatically generated by the FlatBuffers compiler, do not modify

package org.apache.arrow.flatbuf;

import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;

@SuppressWarnings("unused")
/**
* Contains two child arrays, run_ends and values.
* The run_ends child array must be a 16/32/64-bit integer array
* which encodes the indices at which the run with the value in
* each corresponding index in the values child array ends.
* Like list/struct types, the value array can be of any type.
*/
public final class RunEndEncoded extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
public static RunEndEncoded getRootAsRunEndEncoded(ByteBuffer _bb) { return getRootAsRunEndEncoded(_bb, new RunEndEncoded()); }
public static RunEndEncoded getRootAsRunEndEncoded(ByteBuffer _bb, RunEndEncoded obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
public RunEndEncoded __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }


public static void startRunEndEncoded(FlatBufferBuilder builder) { builder.startTable(0); }
public static int endRunEndEncoded(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
}

public static final class Vector extends BaseVector {
public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }

public RunEndEncoded get(int j) { return get(new RunEndEncoded(), j); }
public RunEndEncoded get(RunEndEncoded obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
}
}

17 changes: 14 additions & 3 deletions java/format/src/main/java/org/apache/arrow/flatbuf/Time.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,20 @@

@SuppressWarnings("unused")
/**
* Time type. The physical storage type depends on the unit
* - SECOND and MILLISECOND: 32 bits
* - MICROSECOND and NANOSECOND: 64 bits
* Time is either a 32-bit or 64-bit signed integer type representing an
* elapsed time since midnight, stored in either of four units: seconds,
* milliseconds, microseconds or nanoseconds.
*
* The integer `bitWidth` depends on the `unit` and must be one of the following:
* * SECOND and MILLISECOND: 32 bits
* * MICROSECOND and NANOSECOND: 64 bits
*
* The allowed values are between 0 (inclusive) and 86400 (=24*60*60) seconds
* (exclusive), adjusted for the time unit (for example, up to 86400000
* exclusive for the MILLISECOND unit).
* This definition doesn't allow for leap seconds. Time values from
* measurements with leap seconds will need to be corrected when ingesting
* into Arrow (for example by replacing the value 86400 with 86399).
*/
public final class Time extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
Expand Down
Loading

0 comments on commit 1f71014

Please sign in to comment.