diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/arrow/java/format | |
parent | Initial commit. (diff) | |
download | ceph-upstream/18.2.2.tar.xz ceph-upstream/18.2.2.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/arrow/java/format')
55 files changed, 3588 insertions, 0 deletions
diff --git a/src/arrow/java/format/pom.xml b/src/arrow/java/format/pom.xml new file mode 100644 index 000000000..067bed358 --- /dev/null +++ b/src/arrow/java/format/pom.xml @@ -0,0 +1,46 @@ +<?xml version="1.0"?> +<!-- 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. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<modelVersion>4.0.0</modelVersion> + +<parent> + <artifactId>arrow-java-root</artifactId> + <groupId>org.apache.arrow</groupId> + <version>6.0.1</version> +</parent> + +<artifactId>arrow-format</artifactId> +<packaging>jar</packaging> +<name>Arrow Format</name> +<description>Generated Java files from the IPC Flatbuffer definitions.</description> + + <dependencies> + <dependency> + <groupId>com.google.flatbuffers</groupId> + <artifactId>flatbuffers-java</artifactId> + </dependency> + </dependencies> + + <build> + + <plugins> + <plugin> <!-- no checkstyle on the generated code --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + +</build> +</project> diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Binary.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Binary.java new file mode 100644 index 000000000..f2ea52502 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Binary.java @@ -0,0 +1,51 @@ +// 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") +/** + * Opaque binary data + */ +public final class Binary extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Binary getRootAsBinary(ByteBuffer _bb) { return getRootAsBinary(_bb, new Binary()); } + public static Binary getRootAsBinary(ByteBuffer _bb, Binary 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 Binary __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void startBinary(FlatBufferBuilder builder) { builder.startTable(0); } + public static int endBinary(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 Binary get(int j) { return get(new Binary(), j); } + public Binary get(Binary obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Block.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Block.java new file mode 100644 index 000000000..e1435f832 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Block.java @@ -0,0 +1,61 @@ +// 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") +public final class Block extends Struct { + public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } + public Block __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * Index to the start of the RecordBlock (note this is past the Message header) + */ + public long offset() { return bb.getLong(bb_pos + 0); } + /** + * Length of the metadata + */ + public int metaDataLength() { return bb.getInt(bb_pos + 8); } + /** + * Length of the data (this is aligned so there can be a gap between this and + * the metadata). + */ + public long bodyLength() { return bb.getLong(bb_pos + 16); } + + public static int createBlock(FlatBufferBuilder builder, long offset, int metaDataLength, long bodyLength) { + builder.prep(8, 24); + builder.putLong(bodyLength); + builder.pad(4); + builder.putInt(metaDataLength); + builder.putLong(offset); + return builder.offset(); + } + + 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 Block get(int j) { return get(new Block(), j); } + public Block get(Block obj, int j) { return obj.__assign(__element(j), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/BodyCompression.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/BodyCompression.java new file mode 100644 index 000000000..650454eb1 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/BodyCompression.java @@ -0,0 +1,72 @@ +// 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") +/** + * Optional compression for the memory buffers constituting IPC message + * bodies. Intended for use with RecordBatch but could be used for other + * message types + */ +public final class BodyCompression extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static BodyCompression getRootAsBodyCompression(ByteBuffer _bb) { return getRootAsBodyCompression(_bb, new BodyCompression()); } + public static BodyCompression getRootAsBodyCompression(ByteBuffer _bb, BodyCompression 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 BodyCompression __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * Compressor library + */ + public byte codec() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 0; } + /** + * Indicates the way the record batch body was compressed + */ + public byte method() { int o = __offset(6); return o != 0 ? bb.get(o + bb_pos) : 0; } + + public static int createBodyCompression(FlatBufferBuilder builder, + byte codec, + byte method) { + builder.startTable(2); + BodyCompression.addMethod(builder, method); + BodyCompression.addCodec(builder, codec); + return BodyCompression.endBodyCompression(builder); + } + + public static void startBodyCompression(FlatBufferBuilder builder) { builder.startTable(2); } + public static void addCodec(FlatBufferBuilder builder, byte codec) { builder.addByte(0, codec, 0); } + public static void addMethod(FlatBufferBuilder builder, byte method) { builder.addByte(1, method, 0); } + public static int endBodyCompression(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 BodyCompression get(int j) { return get(new BodyCompression(), j); } + public BodyCompression get(BodyCompression obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/BodyCompressionMethod.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/BodyCompressionMethod.java new file mode 100644 index 000000000..48cff16e7 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/BodyCompressionMethod.java @@ -0,0 +1,43 @@ +// 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; + +/** + * Provided for forward compatibility in case we need to support different + * strategies for compressing the IPC message body (like whole-body + * compression rather than buffer-level) in the future + */ +public final class BodyCompressionMethod { + private BodyCompressionMethod() { } + /** + * Each constituent buffer is first compressed with the indicated + * compressor, and then written with the uncompressed length in the first 8 + * bytes as a 64-bit little-endian signed integer followed by the compressed + * buffer bytes (and then padding as required by the protocol). The + * uncompressed length may be set to -1 to indicate that the data that + * follows is not compressed, which can be useful for cases where + * compression does not yield appreciable savings. + */ + public static final byte BUFFER = 0; + + public static final String[] names = { "BUFFER", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Bool.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Bool.java new file mode 100644 index 000000000..e6b54e4b7 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Bool.java @@ -0,0 +1,48 @@ +// 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") +public final class Bool extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Bool getRootAsBool(ByteBuffer _bb) { return getRootAsBool(_bb, new Bool()); } + public static Bool getRootAsBool(ByteBuffer _bb, Bool 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 Bool __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void startBool(FlatBufferBuilder builder) { builder.startTable(0); } + public static int endBool(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 Bool get(int j) { return get(new Bool(), j); } + public Bool get(Bool obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Buffer.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Buffer.java new file mode 100644 index 000000000..589ed0b71 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Buffer.java @@ -0,0 +1,63 @@ +// 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") +/** + * ---------------------------------------------------------------------- + * A Buffer represents a single contiguous memory segment + */ +public final class Buffer extends Struct { + public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } + public Buffer __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * The relative offset into the shared memory page where the bytes for this + * buffer starts + */ + public long offset() { return bb.getLong(bb_pos + 0); } + /** + * The absolute length (in bytes) of the memory buffer. The memory is found + * from offset (inclusive) to offset + length (non-inclusive). When building + * messages using the encapsulated IPC message, padding bytes may be written + * after a buffer, but such padding bytes do not need to be accounted for in + * the size here. + */ + public long length() { return bb.getLong(bb_pos + 8); } + + public static int createBuffer(FlatBufferBuilder builder, long offset, long length) { + builder.prep(8, 16); + builder.putLong(length); + builder.putLong(offset); + return builder.offset(); + } + + 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 Buffer get(int j) { return get(new Buffer(), j); } + public Buffer get(Buffer obj, int j) { return obj.__assign(__element(j), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/CompressionType.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/CompressionType.java new file mode 100644 index 000000000..0597ffd30 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/CompressionType.java @@ -0,0 +1,30 @@ +// 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; + +public final class CompressionType { + private CompressionType() { } + public static final byte LZ4_FRAME = 0; + public static final byte ZSTD = 1; + + public static final String[] names = { "LZ4_FRAME", "ZSTD", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Date.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Date.java new file mode 100644 index 000000000..b2fcc9e39 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Date.java @@ -0,0 +1,65 @@ +// 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") +/** + * 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: + * + * * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no + * leap seconds), where the values are evenly divisible by 86400000 + * * Days (32 bits) since the UNIX epoch + */ +public final class Date extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Date getRootAsDate(ByteBuffer _bb) { return getRootAsDate(_bb, new Date()); } + public static Date getRootAsDate(ByteBuffer _bb, Date 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 Date __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public short unit() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 1; } + + public static int createDate(FlatBufferBuilder builder, + short unit) { + builder.startTable(1); + Date.addUnit(builder, unit); + return Date.endDate(builder); + } + + public static void startDate(FlatBufferBuilder builder) { builder.startTable(1); } + public static void addUnit(FlatBufferBuilder builder, short unit) { builder.addShort(0, unit, 1); } + public static int endDate(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 Date get(int j) { return get(new Date(), j); } + public Date get(Date obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DateUnit.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DateUnit.java new file mode 100644 index 000000000..f2c96f45b --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DateUnit.java @@ -0,0 +1,30 @@ +// 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; + +public final class DateUnit { + private DateUnit() { } + public static final short DAY = 0; + public static final short MILLISECOND = 1; + + public static final String[] names = { "DAY", "MILLISECOND", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Decimal.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Decimal.java new file mode 100644 index 000000000..8ffaa1ebb --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Decimal.java @@ -0,0 +1,81 @@ +// 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") +/** + * Exact decimal value represented as an integer value in two's + * complement. Currently only 128-bit (16-byte) and 256-bit (32-byte) integers + * are used. The representation uses the endianness indicated + * in the Schema. + */ +public final class Decimal extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Decimal getRootAsDecimal(ByteBuffer _bb) { return getRootAsDecimal(_bb, new Decimal()); } + public static Decimal getRootAsDecimal(ByteBuffer _bb, Decimal 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 Decimal __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * Total number of decimal digits + */ + public int precision() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; } + /** + * Number of digits after the decimal point "." + */ + public int scale() { int o = __offset(6); return o != 0 ? bb.getInt(o + bb_pos) : 0; } + /** + * Number of bits per value. The only accepted widths are 128 and 256. + * We use bitWidth for consistency with Int::bitWidth. + */ + public int bitWidth() { int o = __offset(8); return o != 0 ? bb.getInt(o + bb_pos) : 128; } + + public static int createDecimal(FlatBufferBuilder builder, + int precision, + int scale, + int bitWidth) { + builder.startTable(3); + Decimal.addBitWidth(builder, bitWidth); + Decimal.addScale(builder, scale); + Decimal.addPrecision(builder, precision); + return Decimal.endDecimal(builder); + } + + public static void startDecimal(FlatBufferBuilder builder) { builder.startTable(3); } + public static void addPrecision(FlatBufferBuilder builder, int precision) { builder.addInt(0, precision, 0); } + public static void addScale(FlatBufferBuilder builder, int scale) { builder.addInt(1, scale, 0); } + public static void addBitWidth(FlatBufferBuilder builder, int bitWidth) { builder.addInt(2, bitWidth, 128); } + public static int endDecimal(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 Decimal get(int j) { return get(new Decimal(), j); } + public Decimal get(Decimal obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DictionaryBatch.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DictionaryBatch.java new file mode 100644 index 000000000..fe6c59fb5 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DictionaryBatch.java @@ -0,0 +1,79 @@ +// 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") +/** + * For sending dictionary encoding information. Any Field can be + * dictionary-encoded, but in this case none of its children may be + * dictionary-encoded. + * There is one vector / column per dictionary, but that vector / column + * may be spread across multiple dictionary batches by using the isDelta + * flag + */ +public final class DictionaryBatch extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static DictionaryBatch getRootAsDictionaryBatch(ByteBuffer _bb) { return getRootAsDictionaryBatch(_bb, new DictionaryBatch()); } + public static DictionaryBatch getRootAsDictionaryBatch(ByteBuffer _bb, DictionaryBatch 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 DictionaryBatch __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } + public org.apache.arrow.flatbuf.RecordBatch data() { return data(new org.apache.arrow.flatbuf.RecordBatch()); } + public org.apache.arrow.flatbuf.RecordBatch data(org.apache.arrow.flatbuf.RecordBatch obj) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } + /** + * If isDelta is true the values in the dictionary are to be appended to a + * dictionary with the indicated id. If isDelta is false this dictionary + * should replace the existing dictionary. + */ + public boolean isDelta() { int o = __offset(8); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } + + public static int createDictionaryBatch(FlatBufferBuilder builder, + long id, + int dataOffset, + boolean isDelta) { + builder.startTable(3); + DictionaryBatch.addId(builder, id); + DictionaryBatch.addData(builder, dataOffset); + DictionaryBatch.addIsDelta(builder, isDelta); + return DictionaryBatch.endDictionaryBatch(builder); + } + + public static void startDictionaryBatch(FlatBufferBuilder builder) { builder.startTable(3); } + public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); } + public static void addData(FlatBufferBuilder builder, int dataOffset) { builder.addOffset(1, dataOffset, 0); } + public static void addIsDelta(FlatBufferBuilder builder, boolean isDelta) { builder.addBoolean(2, isDelta, false); } + public static int endDictionaryBatch(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 DictionaryBatch get(int j) { return get(new DictionaryBatch(), j); } + public DictionaryBatch get(DictionaryBatch obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DictionaryEncoding.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DictionaryEncoding.java new file mode 100644 index 000000000..8b2bb73e7 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DictionaryEncoding.java @@ -0,0 +1,88 @@ +// 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") +public final class DictionaryEncoding extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static DictionaryEncoding getRootAsDictionaryEncoding(ByteBuffer _bb) { return getRootAsDictionaryEncoding(_bb, new DictionaryEncoding()); } + public static DictionaryEncoding getRootAsDictionaryEncoding(ByteBuffer _bb, DictionaryEncoding 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 DictionaryEncoding __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * The known dictionary id in the application where this data is used. In + * the file or streaming formats, the dictionary ids are found in the + * DictionaryBatch messages + */ + public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } + /** + * The dictionary indices are constrained to be non-negative integers. If + * this field is null, the indices must be signed int32. To maximize + * cross-language compatibility and performance, implementations are + * recommended to prefer signed integer types over unsigned integer types + * and to avoid uint64 indices unless they are required by an application. + */ + public org.apache.arrow.flatbuf.Int indexType() { return indexType(new org.apache.arrow.flatbuf.Int()); } + public org.apache.arrow.flatbuf.Int indexType(org.apache.arrow.flatbuf.Int obj) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } + /** + * By default, dictionaries are not ordered, or the order does not have + * semantic meaning. In some statistical, applications, dictionary-encoding + * is used to represent ordered categorical data, and we provide a way to + * preserve that metadata here + */ + public boolean isOrdered() { int o = __offset(8); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } + public short dictionaryKind() { int o = __offset(10); return o != 0 ? bb.getShort(o + bb_pos) : 0; } + + public static int createDictionaryEncoding(FlatBufferBuilder builder, + long id, + int indexTypeOffset, + boolean isOrdered, + short dictionaryKind) { + builder.startTable(4); + DictionaryEncoding.addId(builder, id); + DictionaryEncoding.addIndexType(builder, indexTypeOffset); + DictionaryEncoding.addDictionaryKind(builder, dictionaryKind); + DictionaryEncoding.addIsOrdered(builder, isOrdered); + return DictionaryEncoding.endDictionaryEncoding(builder); + } + + public static void startDictionaryEncoding(FlatBufferBuilder builder) { builder.startTable(4); } + public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); } + public static void addIndexType(FlatBufferBuilder builder, int indexTypeOffset) { builder.addOffset(1, indexTypeOffset, 0); } + public static void addIsOrdered(FlatBufferBuilder builder, boolean isOrdered) { builder.addBoolean(2, isOrdered, false); } + public static void addDictionaryKind(FlatBufferBuilder builder, short dictionaryKind) { builder.addShort(3, dictionaryKind, 0); } + public static int endDictionaryEncoding(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 DictionaryEncoding get(int j) { return get(new DictionaryEncoding(), j); } + public DictionaryEncoding get(DictionaryEncoding obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DictionaryKind.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DictionaryKind.java new file mode 100644 index 000000000..ecefa4b76 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/DictionaryKind.java @@ -0,0 +1,36 @@ +// 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; + +/** + * ---------------------------------------------------------------------- + * Dictionary encoding metadata + * Maintained for forwards compatibility, in the future + * Dictionaries might be explicit maps between integers and values + * allowing for non-contiguous index values + */ +public final class DictionaryKind { + private DictionaryKind() { } + public static final short DenseArray = 0; + + public static final String[] names = { "DenseArray", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Duration.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Duration.java new file mode 100644 index 000000000..e1495f300 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Duration.java @@ -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") +public final class Duration extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Duration getRootAsDuration(ByteBuffer _bb) { return getRootAsDuration(_bb, new Duration()); } + public static Duration getRootAsDuration(ByteBuffer _bb, Duration 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 Duration __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public short unit() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 1; } + + public static int createDuration(FlatBufferBuilder builder, + short unit) { + builder.startTable(1); + Duration.addUnit(builder, unit); + return Duration.endDuration(builder); + } + + public static void startDuration(FlatBufferBuilder builder) { builder.startTable(1); } + public static void addUnit(FlatBufferBuilder builder, short unit) { builder.addShort(0, unit, 1); } + public static int endDuration(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 Duration get(int j) { return get(new Duration(), j); } + public Duration get(Duration obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Endianness.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Endianness.java new file mode 100644 index 000000000..494a3dcf5 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Endianness.java @@ -0,0 +1,34 @@ +// 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; + +/** + * ---------------------------------------------------------------------- + * Endianness of the platform producing the data + */ +public final class Endianness { + private Endianness() { } + public static final short Little = 0; + public static final short Big = 1; + + public static final String[] names = { "Little", "Big", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Feature.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Feature.java new file mode 100644 index 000000000..a4fa84c37 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Feature.java @@ -0,0 +1,62 @@ +// 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; + +/** + * Represents Arrow Features that might not have full support + * within implementations. This is intended to be used in + * two scenarios: + * 1. A mechanism for readers of Arrow Streams + * and files to understand that the stream or file makes + * use of a feature that isn't supported or unknown to + * the implementation (and therefore can meet the Arrow + * forward compatibility guarantees). + * 2. A means of negotiating between a client and server + * what features a stream is allowed to use. The enums + * values here are intented to represent higher level + * features, additional details maybe negotiated + * with key-value pairs specific to the protocol. + * + * Enums added to this list should be assigned power-of-two values + * to facilitate exchanging and comparing bitmaps for supported + * features. + */ +public final class Feature { + private Feature() { } + /** + * Needed to make flatbuffers happy. + */ + public static final long UNUSED = 0; + /** + * The stream makes use of multiple full dictionaries with the + * same ID and assumes clients implement dictionary replacement + * correctly. + */ + public static final long DICTIONARY_REPLACEMENT = 1; + /** + * The stream makes use of compressed bodies as described + * in Message.fbs. + */ + public static final long COMPRESSED_BODY = 2; + + public static final String[] names = { "UNUSED", "DICTIONARY_REPLACEMENT", "COMPRESSED_BODY", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Field.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Field.java new file mode 100644 index 000000000..d34501e0a --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Field.java @@ -0,0 +1,120 @@ +// 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") +/** + * ---------------------------------------------------------------------- + * A field represents a named column in a record / row batch or child of a + * nested type. + */ +public final class Field extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Field getRootAsField(ByteBuffer _bb) { return getRootAsField(_bb, new Field()); } + public static Field getRootAsField(ByteBuffer _bb, Field 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 Field __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * Name is not required, in i.e. a List + */ + public String name() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; } + public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(4, 1); } + public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); } + /** + * Whether or not this field can contain nulls. Should be true in general. + */ + public boolean nullable() { int o = __offset(6); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } + public byte typeType() { int o = __offset(8); return o != 0 ? bb.get(o + bb_pos) : 0; } + /** + * This is the type of the decoded value if the field is dictionary encoded. + */ + public Table type(Table obj) { int o = __offset(10); return o != 0 ? __union(obj, o + bb_pos) : null; } + /** + * Present only if the field is dictionary encoded. + */ + public org.apache.arrow.flatbuf.DictionaryEncoding dictionary() { return dictionary(new org.apache.arrow.flatbuf.DictionaryEncoding()); } + public org.apache.arrow.flatbuf.DictionaryEncoding dictionary(org.apache.arrow.flatbuf.DictionaryEncoding obj) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } + /** + * children apply only to nested data types like Struct, List and Union. For + * primitive types children will have length 0. + */ + public org.apache.arrow.flatbuf.Field children(int j) { return children(new org.apache.arrow.flatbuf.Field(), j); } + public org.apache.arrow.flatbuf.Field children(org.apache.arrow.flatbuf.Field obj, int j) { int o = __offset(14); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } + public int childrenLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.Field.Vector childrenVector() { return childrenVector(new org.apache.arrow.flatbuf.Field.Vector()); } + public org.apache.arrow.flatbuf.Field.Vector childrenVector(org.apache.arrow.flatbuf.Field.Vector obj) { int o = __offset(14); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } + /** + * User-defined metadata + */ + public org.apache.arrow.flatbuf.KeyValue customMetadata(int j) { return customMetadata(new org.apache.arrow.flatbuf.KeyValue(), j); } + public org.apache.arrow.flatbuf.KeyValue customMetadata(org.apache.arrow.flatbuf.KeyValue obj, int j) { int o = __offset(16); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } + public int customMetadataLength() { int o = __offset(16); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.KeyValue.Vector customMetadataVector() { return customMetadataVector(new org.apache.arrow.flatbuf.KeyValue.Vector()); } + public org.apache.arrow.flatbuf.KeyValue.Vector customMetadataVector(org.apache.arrow.flatbuf.KeyValue.Vector obj) { int o = __offset(16); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } + + public static int createField(FlatBufferBuilder builder, + int nameOffset, + boolean nullable, + byte type_type, + int typeOffset, + int dictionaryOffset, + int childrenOffset, + int custom_metadataOffset) { + builder.startTable(7); + Field.addCustomMetadata(builder, custom_metadataOffset); + Field.addChildren(builder, childrenOffset); + Field.addDictionary(builder, dictionaryOffset); + Field.addType(builder, typeOffset); + Field.addName(builder, nameOffset); + Field.addTypeType(builder, type_type); + Field.addNullable(builder, nullable); + return Field.endField(builder); + } + + public static void startField(FlatBufferBuilder builder) { builder.startTable(7); } + public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(0, nameOffset, 0); } + public static void addNullable(FlatBufferBuilder builder, boolean nullable) { builder.addBoolean(1, nullable, false); } + public static void addTypeType(FlatBufferBuilder builder, byte typeType) { builder.addByte(2, typeType, 0); } + public static void addType(FlatBufferBuilder builder, int typeOffset) { builder.addOffset(3, typeOffset, 0); } + public static void addDictionary(FlatBufferBuilder builder, int dictionaryOffset) { builder.addOffset(4, dictionaryOffset, 0); } + public static void addChildren(FlatBufferBuilder builder, int childrenOffset) { builder.addOffset(5, childrenOffset, 0); } + public static int createChildrenVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } + public static void startChildrenVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } + public static void addCustomMetadata(FlatBufferBuilder builder, int customMetadataOffset) { builder.addOffset(6, customMetadataOffset, 0); } + public static int createCustomMetadataVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } + public static void startCustomMetadataVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } + public static int endField(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 Field get(int j) { return get(new Field(), j); } + public Field get(Field obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FieldNode.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FieldNode.java new file mode 100644 index 000000000..3ea9805f6 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FieldNode.java @@ -0,0 +1,68 @@ +// 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") +/** + * ---------------------------------------------------------------------- + * Data structures for describing a table row batch (a collection of + * equal-length Arrow arrays) + * Metadata about a field at some level of a nested type tree (but not + * its children). + * + * For example, a List<Int16> with values `[[1, 2, 3], null, [4], [5, 6], null]` + * would have {length: 5, null_count: 2} for its List node, and {length: 6, + * null_count: 0} for its Int16 node, as separate FieldNode structs + */ +public final class FieldNode extends Struct { + public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } + public FieldNode __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * The number of value slots in the Arrow array at this level of a nested + * tree + */ + public long length() { return bb.getLong(bb_pos + 0); } + /** + * The number of observed nulls. Fields with null_count == 0 may choose not + * to write their physical validity bitmap out as a materialized buffer, + * instead setting the length of the bitmap buffer to 0. + */ + public long nullCount() { return bb.getLong(bb_pos + 8); } + + public static int createFieldNode(FlatBufferBuilder builder, long length, long nullCount) { + builder.prep(8, 16); + builder.putLong(nullCount); + builder.putLong(length); + return builder.offset(); + } + + 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 FieldNode get(int j) { return get(new FieldNode(), j); } + public FieldNode get(FieldNode obj, int j) { return obj.__assign(__element(j), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FixedSizeBinary.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FixedSizeBinary.java new file mode 100644 index 000000000..287b34e22 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FixedSizeBinary.java @@ -0,0 +1,60 @@ +// 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") +public final class FixedSizeBinary extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static FixedSizeBinary getRootAsFixedSizeBinary(ByteBuffer _bb) { return getRootAsFixedSizeBinary(_bb, new FixedSizeBinary()); } + public static FixedSizeBinary getRootAsFixedSizeBinary(ByteBuffer _bb, FixedSizeBinary 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 FixedSizeBinary __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * Number of bytes per value + */ + public int byteWidth() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; } + + public static int createFixedSizeBinary(FlatBufferBuilder builder, + int byteWidth) { + builder.startTable(1); + FixedSizeBinary.addByteWidth(builder, byteWidth); + return FixedSizeBinary.endFixedSizeBinary(builder); + } + + public static void startFixedSizeBinary(FlatBufferBuilder builder) { builder.startTable(1); } + public static void addByteWidth(FlatBufferBuilder builder, int byteWidth) { builder.addInt(0, byteWidth, 0); } + public static int endFixedSizeBinary(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 FixedSizeBinary get(int j) { return get(new FixedSizeBinary(), j); } + public FixedSizeBinary get(FixedSizeBinary obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FixedSizeList.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FixedSizeList.java new file mode 100644 index 000000000..d0d889238 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FixedSizeList.java @@ -0,0 +1,60 @@ +// 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") +public final class FixedSizeList extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static FixedSizeList getRootAsFixedSizeList(ByteBuffer _bb) { return getRootAsFixedSizeList(_bb, new FixedSizeList()); } + public static FixedSizeList getRootAsFixedSizeList(ByteBuffer _bb, FixedSizeList 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 FixedSizeList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * Number of list items per value + */ + public int listSize() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; } + + public static int createFixedSizeList(FlatBufferBuilder builder, + int listSize) { + builder.startTable(1); + FixedSizeList.addListSize(builder, listSize); + return FixedSizeList.endFixedSizeList(builder); + } + + public static void startFixedSizeList(FlatBufferBuilder builder) { builder.startTable(1); } + public static void addListSize(FlatBufferBuilder builder, int listSize) { builder.addInt(0, listSize, 0); } + public static int endFixedSizeList(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 FixedSizeList get(int j) { return get(new FixedSizeList(), j); } + public FixedSizeList get(FixedSizeList obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FloatingPoint.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FloatingPoint.java new file mode 100644 index 000000000..945fa627d --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/FloatingPoint.java @@ -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") +public final class FloatingPoint extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static FloatingPoint getRootAsFloatingPoint(ByteBuffer _bb) { return getRootAsFloatingPoint(_bb, new FloatingPoint()); } + public static FloatingPoint getRootAsFloatingPoint(ByteBuffer _bb, FloatingPoint 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 FloatingPoint __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public short precision() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 0; } + + public static int createFloatingPoint(FlatBufferBuilder builder, + short precision) { + builder.startTable(1); + FloatingPoint.addPrecision(builder, precision); + return FloatingPoint.endFloatingPoint(builder); + } + + public static void startFloatingPoint(FlatBufferBuilder builder) { builder.startTable(1); } + public static void addPrecision(FlatBufferBuilder builder, short precision) { builder.addShort(0, precision, 0); } + public static int endFloatingPoint(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 FloatingPoint get(int j) { return get(new FloatingPoint(), j); } + public FloatingPoint get(FloatingPoint obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Footer.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Footer.java new file mode 100644 index 000000000..86fd75e03 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Footer.java @@ -0,0 +1,100 @@ +// 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") +/** + * ---------------------------------------------------------------------- + * Arrow File metadata + * + */ +public final class Footer extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Footer getRootAsFooter(ByteBuffer _bb) { return getRootAsFooter(_bb, new Footer()); } + public static Footer getRootAsFooter(ByteBuffer _bb, Footer 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 Footer __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public short version() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 0; } + public org.apache.arrow.flatbuf.Schema schema() { return schema(new org.apache.arrow.flatbuf.Schema()); } + public org.apache.arrow.flatbuf.Schema schema(org.apache.arrow.flatbuf.Schema obj) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } + public org.apache.arrow.flatbuf.Block dictionaries(int j) { return dictionaries(new org.apache.arrow.flatbuf.Block(), j); } + public org.apache.arrow.flatbuf.Block dictionaries(org.apache.arrow.flatbuf.Block obj, int j) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o) + j * 24, bb) : null; } + public int dictionariesLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.Block.Vector dictionariesVector() { return dictionariesVector(new org.apache.arrow.flatbuf.Block.Vector()); } + public org.apache.arrow.flatbuf.Block.Vector dictionariesVector(org.apache.arrow.flatbuf.Block.Vector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 24, bb) : null; } + public org.apache.arrow.flatbuf.Block recordBatches(int j) { return recordBatches(new org.apache.arrow.flatbuf.Block(), j); } + public org.apache.arrow.flatbuf.Block recordBatches(org.apache.arrow.flatbuf.Block obj, int j) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o) + j * 24, bb) : null; } + public int recordBatchesLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.Block.Vector recordBatchesVector() { return recordBatchesVector(new org.apache.arrow.flatbuf.Block.Vector()); } + public org.apache.arrow.flatbuf.Block.Vector recordBatchesVector(org.apache.arrow.flatbuf.Block.Vector obj) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o), 24, bb) : null; } + /** + * User-defined metadata + */ + public org.apache.arrow.flatbuf.KeyValue customMetadata(int j) { return customMetadata(new org.apache.arrow.flatbuf.KeyValue(), j); } + public org.apache.arrow.flatbuf.KeyValue customMetadata(org.apache.arrow.flatbuf.KeyValue obj, int j) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } + public int customMetadataLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.KeyValue.Vector customMetadataVector() { return customMetadataVector(new org.apache.arrow.flatbuf.KeyValue.Vector()); } + public org.apache.arrow.flatbuf.KeyValue.Vector customMetadataVector(org.apache.arrow.flatbuf.KeyValue.Vector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } + + public static int createFooter(FlatBufferBuilder builder, + short version, + int schemaOffset, + int dictionariesOffset, + int recordBatchesOffset, + int custom_metadataOffset) { + builder.startTable(5); + Footer.addCustomMetadata(builder, custom_metadataOffset); + Footer.addRecordBatches(builder, recordBatchesOffset); + Footer.addDictionaries(builder, dictionariesOffset); + Footer.addSchema(builder, schemaOffset); + Footer.addVersion(builder, version); + return Footer.endFooter(builder); + } + + public static void startFooter(FlatBufferBuilder builder) { builder.startTable(5); } + public static void addVersion(FlatBufferBuilder builder, short version) { builder.addShort(0, version, 0); } + public static void addSchema(FlatBufferBuilder builder, int schemaOffset) { builder.addOffset(1, schemaOffset, 0); } + public static void addDictionaries(FlatBufferBuilder builder, int dictionariesOffset) { builder.addOffset(2, dictionariesOffset, 0); } + public static void startDictionariesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(24, numElems, 8); } + public static void addRecordBatches(FlatBufferBuilder builder, int recordBatchesOffset) { builder.addOffset(3, recordBatchesOffset, 0); } + public static void startRecordBatchesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(24, numElems, 8); } + public static void addCustomMetadata(FlatBufferBuilder builder, int customMetadataOffset) { builder.addOffset(4, customMetadataOffset, 0); } + public static int createCustomMetadataVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } + public static void startCustomMetadataVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } + public static int endFooter(FlatBufferBuilder builder) { + int o = builder.endTable(); + return o; + } + public static void finishFooterBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); } + public static void finishSizePrefixedFooterBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); } + + 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 Footer get(int j) { return get(new Footer(), j); } + public Footer get(Footer obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Int.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Int.java new file mode 100644 index 000000000..94cb96a05 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Int.java @@ -0,0 +1,61 @@ +// 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") +public final class Int extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Int getRootAsInt(ByteBuffer _bb) { return getRootAsInt(_bb, new Int()); } + public static Int getRootAsInt(ByteBuffer _bb, Int 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 Int __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public int bitWidth() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; } + public boolean isSigned() { int o = __offset(6); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } + + public static int createInt(FlatBufferBuilder builder, + int bitWidth, + boolean is_signed) { + builder.startTable(2); + Int.addBitWidth(builder, bitWidth); + Int.addIsSigned(builder, is_signed); + return Int.endInt(builder); + } + + public static void startInt(FlatBufferBuilder builder) { builder.startTable(2); } + public static void addBitWidth(FlatBufferBuilder builder, int bitWidth) { builder.addInt(0, bitWidth, 0); } + public static void addIsSigned(FlatBufferBuilder builder, boolean isSigned) { builder.addBoolean(1, isSigned, false); } + public static int endInt(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 Int get(int j) { return get(new Int(), j); } + public Int get(Int obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Interval.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Interval.java new file mode 100644 index 000000000..e690b0bad --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Interval.java @@ -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") +public final class Interval extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Interval getRootAsInterval(ByteBuffer _bb) { return getRootAsInterval(_bb, new Interval()); } + public static Interval getRootAsInterval(ByteBuffer _bb, Interval 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 Interval __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public short unit() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 0; } + + public static int createInterval(FlatBufferBuilder builder, + short unit) { + builder.startTable(1); + Interval.addUnit(builder, unit); + return Interval.endInterval(builder); + } + + public static void startInterval(FlatBufferBuilder builder) { builder.startTable(1); } + public static void addUnit(FlatBufferBuilder builder, short unit) { builder.addShort(0, unit, 0); } + public static int endInterval(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 Interval get(int j) { return get(new Interval(), j); } + public Interval get(Interval obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/IntervalUnit.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/IntervalUnit.java new file mode 100644 index 000000000..2b1e8248a --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/IntervalUnit.java @@ -0,0 +1,31 @@ +// 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; + +public final class IntervalUnit { + private IntervalUnit() { } + public static final short YEAR_MONTH = 0; + public static final short DAY_TIME = 1; + public static final short MONTH_DAY_NANO = 2; + + public static final String[] names = { "YEAR_MONTH", "DAY_TIME", "MONTH_DAY_NANO", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/KeyValue.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/KeyValue.java new file mode 100644 index 000000000..0c6e9f66e --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/KeyValue.java @@ -0,0 +1,70 @@ +// 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") +/** + * ---------------------------------------------------------------------- + * user defined key value pairs to add custom metadata to arrow + * key namespacing is the responsibility of the user + */ +public final class KeyValue extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static KeyValue getRootAsKeyValue(ByteBuffer _bb) { return getRootAsKeyValue(_bb, new KeyValue()); } + public static KeyValue getRootAsKeyValue(ByteBuffer _bb, KeyValue 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 KeyValue __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public String key() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; } + public ByteBuffer keyAsByteBuffer() { return __vector_as_bytebuffer(4, 1); } + public ByteBuffer keyInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 4, 1); } + public String value() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; } + public ByteBuffer valueAsByteBuffer() { return __vector_as_bytebuffer(6, 1); } + public ByteBuffer valueInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); } + + public static int createKeyValue(FlatBufferBuilder builder, + int keyOffset, + int valueOffset) { + builder.startTable(2); + KeyValue.addValue(builder, valueOffset); + KeyValue.addKey(builder, keyOffset); + return KeyValue.endKeyValue(builder); + } + + public static void startKeyValue(FlatBufferBuilder builder) { builder.startTable(2); } + public static void addKey(FlatBufferBuilder builder, int keyOffset) { builder.addOffset(0, keyOffset, 0); } + public static void addValue(FlatBufferBuilder builder, int valueOffset) { builder.addOffset(1, valueOffset, 0); } + public static int endKeyValue(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 KeyValue get(int j) { return get(new KeyValue(), j); } + public KeyValue get(KeyValue obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/LargeBinary.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/LargeBinary.java new file mode 100644 index 000000000..b7377bbe9 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/LargeBinary.java @@ -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 Binary, but with 64-bit offsets, allowing to represent + * extremely large data values. + */ +public final class LargeBinary extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static LargeBinary getRootAsLargeBinary(ByteBuffer _bb) { return getRootAsLargeBinary(_bb, new LargeBinary()); } + public static LargeBinary getRootAsLargeBinary(ByteBuffer _bb, LargeBinary 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 LargeBinary __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void startLargeBinary(FlatBufferBuilder builder) { builder.startTable(0); } + public static int endLargeBinary(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 LargeBinary get(int j) { return get(new LargeBinary(), j); } + public LargeBinary get(LargeBinary obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/LargeList.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/LargeList.java new file mode 100644 index 000000000..32cc0034c --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/LargeList.java @@ -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 List, but with 64-bit offsets, allowing to represent + * extremely large data values. + */ +public final class LargeList extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static LargeList getRootAsLargeList(ByteBuffer _bb) { return getRootAsLargeList(_bb, new LargeList()); } + public static LargeList getRootAsLargeList(ByteBuffer _bb, LargeList 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 LargeList __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void startLargeList(FlatBufferBuilder builder) { builder.startTable(0); } + public static int endLargeList(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 LargeList get(int j) { return get(new LargeList(), j); } + public LargeList get(LargeList obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/LargeUtf8.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/LargeUtf8.java new file mode 100644 index 000000000..7e7a20117 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/LargeUtf8.java @@ -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 Utf8, but with 64-bit offsets, allowing to represent + * extremely large data values. + */ +public final class LargeUtf8 extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static LargeUtf8 getRootAsLargeUtf8(ByteBuffer _bb) { return getRootAsLargeUtf8(_bb, new LargeUtf8()); } + public static LargeUtf8 getRootAsLargeUtf8(ByteBuffer _bb, LargeUtf8 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 LargeUtf8 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void startLargeUtf8(FlatBufferBuilder builder) { builder.startTable(0); } + public static int endLargeUtf8(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 LargeUtf8 get(int j) { return get(new LargeUtf8(), j); } + public LargeUtf8 get(LargeUtf8 obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/List.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/List.java new file mode 100644 index 000000000..4493f9c5b --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/List.java @@ -0,0 +1,48 @@ +// 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") +public final class List extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static List getRootAsList(ByteBuffer _bb) { return getRootAsList(_bb, new List()); } + public static List getRootAsList(ByteBuffer _bb, List 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 List __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void startList(FlatBufferBuilder builder) { builder.startTable(0); } + public static int endList(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 List get(int j) { return get(new List(), j); } + public List get(List obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Map.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Map.java new file mode 100644 index 000000000..704426e92 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Map.java @@ -0,0 +1,87 @@ +// 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") +/** + * A Map is a logical nested type that is represented as + * + * List<entries: Struct<key: K, value: V>> + * + * In this layout, the keys and values are each respectively contiguous. We do + * not constrain the key and value types, so the application is responsible + * for ensuring that the keys are hashable and unique. Whether the keys are sorted + * may be set in the metadata for this field. + * + * In a field with Map type, the field has a child Struct field, which then + * has two children: key type and the second the value type. The names of the + * child fields may be respectively "entries", "key", and "value", but this is + * not enforced. + * + * Map + * ```text + * - child[0] entries: Struct + * - child[0] key: K + * - child[1] value: V + * ``` + * Neither the "entries" field nor the "key" field may be nullable. + * + * The metadata is structured so that Arrow systems without special handling + * for Map can make Map an alias for List. The "layout" attribute for the Map + * field must have the same contents as a List. + */ +public final class Map extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Map getRootAsMap(ByteBuffer _bb) { return getRootAsMap(_bb, new Map()); } + public static Map getRootAsMap(ByteBuffer _bb, Map 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 Map __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * Set to true if the keys within each value are sorted + */ + public boolean keysSorted() { int o = __offset(4); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } + + public static int createMap(FlatBufferBuilder builder, + boolean keysSorted) { + builder.startTable(1); + Map.addKeysSorted(builder, keysSorted); + return Map.endMap(builder); + } + + public static void startMap(FlatBufferBuilder builder) { builder.startTable(1); } + public static void addKeysSorted(FlatBufferBuilder builder, boolean keysSorted) { builder.addBoolean(0, keysSorted, false); } + public static int endMap(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 Map get(int j) { return get(new Map(), j); } + public Map get(Map obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Message.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Message.java new file mode 100644 index 000000000..c7738ad95 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Message.java @@ -0,0 +1,81 @@ +// 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") +public final class Message extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Message getRootAsMessage(ByteBuffer _bb) { return getRootAsMessage(_bb, new Message()); } + public static Message getRootAsMessage(ByteBuffer _bb, Message 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 Message __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public short version() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 0; } + public byte headerType() { int o = __offset(6); return o != 0 ? bb.get(o + bb_pos) : 0; } + public Table header(Table obj) { int o = __offset(8); return o != 0 ? __union(obj, o + bb_pos) : null; } + public long bodyLength() { int o = __offset(10); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } + public org.apache.arrow.flatbuf.KeyValue customMetadata(int j) { return customMetadata(new org.apache.arrow.flatbuf.KeyValue(), j); } + public org.apache.arrow.flatbuf.KeyValue customMetadata(org.apache.arrow.flatbuf.KeyValue obj, int j) { int o = __offset(12); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } + public int customMetadataLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.KeyValue.Vector customMetadataVector() { return customMetadataVector(new org.apache.arrow.flatbuf.KeyValue.Vector()); } + public org.apache.arrow.flatbuf.KeyValue.Vector customMetadataVector(org.apache.arrow.flatbuf.KeyValue.Vector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } + + public static int createMessage(FlatBufferBuilder builder, + short version, + byte header_type, + int headerOffset, + long bodyLength, + int custom_metadataOffset) { + builder.startTable(5); + Message.addBodyLength(builder, bodyLength); + Message.addCustomMetadata(builder, custom_metadataOffset); + Message.addHeader(builder, headerOffset); + Message.addVersion(builder, version); + Message.addHeaderType(builder, header_type); + return Message.endMessage(builder); + } + + public static void startMessage(FlatBufferBuilder builder) { builder.startTable(5); } + public static void addVersion(FlatBufferBuilder builder, short version) { builder.addShort(0, version, 0); } + public static void addHeaderType(FlatBufferBuilder builder, byte headerType) { builder.addByte(1, headerType, 0); } + public static void addHeader(FlatBufferBuilder builder, int headerOffset) { builder.addOffset(2, headerOffset, 0); } + public static void addBodyLength(FlatBufferBuilder builder, long bodyLength) { builder.addLong(3, bodyLength, 0L); } + public static void addCustomMetadata(FlatBufferBuilder builder, int customMetadataOffset) { builder.addOffset(4, customMetadataOffset, 0); } + public static int createCustomMetadataVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } + public static void startCustomMetadataVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } + public static int endMessage(FlatBufferBuilder builder) { + int o = builder.endTable(); + return o; + } + public static void finishMessageBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); } + public static void finishSizePrefixedMessageBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); } + + 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 Message get(int j) { return get(new Message(), j); } + public Message get(Message obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/MessageHeader.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/MessageHeader.java new file mode 100644 index 000000000..179b6ba0f --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/MessageHeader.java @@ -0,0 +1,44 @@ +// 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; + +/** + * ---------------------------------------------------------------------- + * The root Message type + * This union enables us to easily send different message types without + * redundant storage, and in the future we can easily add new message types. + * + * Arrow implementations do not need to implement all of the message types, + * which may include experimental metadata types. For maximum compatibility, + * it is best to send data using RecordBatch + */ +public final class MessageHeader { + private MessageHeader() { } + public static final byte NONE = 0; + public static final byte Schema = 1; + public static final byte DictionaryBatch = 2; + public static final byte RecordBatch = 3; + public static final byte Tensor = 4; + public static final byte SparseTensor = 5; + + public static final String[] names = { "NONE", "Schema", "DictionaryBatch", "RecordBatch", "Tensor", "SparseTensor", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/MetadataVersion.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/MetadataVersion.java new file mode 100644 index 000000000..8ce9d84fc --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/MetadataVersion.java @@ -0,0 +1,54 @@ +// 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; + +public final class MetadataVersion { + private MetadataVersion() { } + /** + * 0.1.0 (October 2016). + */ + public static final short V1 = 0; + /** + * 0.2.0 (February 2017). Non-backwards compatible with V1. + */ + public static final short V2 = 1; + /** + * 0.3.0 -> 0.7.1 (May - December 2017). Non-backwards compatible with V2. + */ + public static final short V3 = 2; + /** + * >= 0.8.0 (December 2017). Non-backwards compatible with V3. + */ + public static final short V4 = 3; + /** + * >= 1.0.0 (July 2020. Backwards compatible with V4 (V5 readers can read V4 + * metadata and IPC messages). Implementations are recommended to provide a + * V4 compatibility mode with V5 format changes disabled. + * + * Incompatible changes between V4 and V5: + * - Union buffer layout has changed. In V5, Unions don't have a validity + * bitmap buffer. + */ + public static final short V5 = 4; + + public static final String[] names = { "V1", "V2", "V3", "V4", "V5", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Null.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Null.java new file mode 100644 index 000000000..b7a30f2e8 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Null.java @@ -0,0 +1,51 @@ +// 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") +/** + * These are stored in the flatbuffer in the Type union below + */ +public final class Null extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Null getRootAsNull(ByteBuffer _bb) { return getRootAsNull(_bb, new Null()); } + public static Null getRootAsNull(ByteBuffer _bb, Null 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 Null __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void startNull(FlatBufferBuilder builder) { builder.startTable(0); } + public static int endNull(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 Null get(int j) { return get(new Null(), j); } + public Null get(Null obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Precision.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Precision.java new file mode 100644 index 000000000..e2c42237a --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Precision.java @@ -0,0 +1,31 @@ +// 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; + +public final class Precision { + private Precision() { } + public static final short HALF = 0; + public static final short SINGLE = 1; + public static final short DOUBLE = 2; + + public static final String[] names = { "HALF", "SINGLE", "DOUBLE", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/RecordBatch.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/RecordBatch.java new file mode 100644 index 000000000..eb814e07d --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/RecordBatch.java @@ -0,0 +1,103 @@ +// 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") +/** + * A data header describing the shared memory layout of a "record" or "row" + * batch. Some systems call this a "row batch" internally and others a "record + * batch". + */ +public final class RecordBatch extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static RecordBatch getRootAsRecordBatch(ByteBuffer _bb) { return getRootAsRecordBatch(_bb, new RecordBatch()); } + public static RecordBatch getRootAsRecordBatch(ByteBuffer _bb, RecordBatch 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 RecordBatch __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * number of records / rows. The arrays in the batch should all have this + * length + */ + public long length() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } + /** + * Nodes correspond to the pre-ordered flattened logical schema + */ + public org.apache.arrow.flatbuf.FieldNode nodes(int j) { return nodes(new org.apache.arrow.flatbuf.FieldNode(), j); } + public org.apache.arrow.flatbuf.FieldNode nodes(org.apache.arrow.flatbuf.FieldNode obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o) + j * 16, bb) : null; } + public int nodesLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.FieldNode.Vector nodesVector() { return nodesVector(new org.apache.arrow.flatbuf.FieldNode.Vector()); } + public org.apache.arrow.flatbuf.FieldNode.Vector nodesVector(org.apache.arrow.flatbuf.FieldNode.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 16, bb) : null; } + /** + * Buffers correspond to the pre-ordered flattened buffer tree + * + * The number of buffers appended to this list depends on the schema. For + * example, most primitive arrays will have 2 buffers, 1 for the validity + * bitmap and 1 for the values. For struct arrays, there will only be a + * single buffer for the validity (nulls) bitmap + */ + public org.apache.arrow.flatbuf.Buffer buffers(int j) { return buffers(new org.apache.arrow.flatbuf.Buffer(), j); } + public org.apache.arrow.flatbuf.Buffer buffers(org.apache.arrow.flatbuf.Buffer obj, int j) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o) + j * 16, bb) : null; } + public int buffersLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.Buffer.Vector buffersVector() { return buffersVector(new org.apache.arrow.flatbuf.Buffer.Vector()); } + public org.apache.arrow.flatbuf.Buffer.Vector buffersVector(org.apache.arrow.flatbuf.Buffer.Vector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 16, bb) : null; } + /** + * Optional compression of the message body + */ + 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; } + + public static int createRecordBatch(FlatBufferBuilder builder, + long length, + int nodesOffset, + int buffersOffset, + int compressionOffset) { + builder.startTable(4); + RecordBatch.addLength(builder, length); + 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 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 int endRecordBatch(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 RecordBatch get(int j) { return get(new RecordBatch(), j); } + public RecordBatch get(RecordBatch obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Schema.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Schema.java new file mode 100644 index 000000000..69c025254 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Schema.java @@ -0,0 +1,102 @@ +// 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") +/** + * ---------------------------------------------------------------------- + * A Schema describes the columns in a row batch + */ +public final class Schema extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Schema getRootAsSchema(ByteBuffer _bb) { return getRootAsSchema(_bb, new Schema()); } + public static Schema getRootAsSchema(ByteBuffer _bb, Schema 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 Schema __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * endianness of the buffer + * it is Little Endian by default + * if endianness doesn't match the underlying system then the vectors need to be converted + */ + public short endianness() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 0; } + public org.apache.arrow.flatbuf.Field fields(int j) { return fields(new org.apache.arrow.flatbuf.Field(), j); } + public org.apache.arrow.flatbuf.Field fields(org.apache.arrow.flatbuf.Field obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } + public int fieldsLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.Field.Vector fieldsVector() { return fieldsVector(new org.apache.arrow.flatbuf.Field.Vector()); } + public org.apache.arrow.flatbuf.Field.Vector fieldsVector(org.apache.arrow.flatbuf.Field.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } + public org.apache.arrow.flatbuf.KeyValue customMetadata(int j) { return customMetadata(new org.apache.arrow.flatbuf.KeyValue(), j); } + public org.apache.arrow.flatbuf.KeyValue customMetadata(org.apache.arrow.flatbuf.KeyValue obj, int j) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } + public int customMetadataLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.KeyValue.Vector customMetadataVector() { return customMetadataVector(new org.apache.arrow.flatbuf.KeyValue.Vector()); } + public org.apache.arrow.flatbuf.KeyValue.Vector customMetadataVector(org.apache.arrow.flatbuf.KeyValue.Vector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } + /** + * Features used in the stream/file. + */ + public long features(int j) { int o = __offset(10); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; } + public int featuresLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; } + public LongVector featuresVector() { return featuresVector(new LongVector()); } + public LongVector featuresVector(LongVector obj) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o), bb) : null; } + public ByteBuffer featuresAsByteBuffer() { return __vector_as_bytebuffer(10, 8); } + public ByteBuffer featuresInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 10, 8); } + + public static int createSchema(FlatBufferBuilder builder, + short endianness, + int fieldsOffset, + int custom_metadataOffset, + int featuresOffset) { + builder.startTable(4); + Schema.addFeatures(builder, featuresOffset); + Schema.addCustomMetadata(builder, custom_metadataOffset); + Schema.addFields(builder, fieldsOffset); + Schema.addEndianness(builder, endianness); + return Schema.endSchema(builder); + } + + public static void startSchema(FlatBufferBuilder builder) { builder.startTable(4); } + public static void addEndianness(FlatBufferBuilder builder, short endianness) { builder.addShort(0, endianness, 0); } + public static void addFields(FlatBufferBuilder builder, int fieldsOffset) { builder.addOffset(1, fieldsOffset, 0); } + public static int createFieldsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } + public static void startFieldsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } + public static void addCustomMetadata(FlatBufferBuilder builder, int customMetadataOffset) { builder.addOffset(2, customMetadataOffset, 0); } + public static int createCustomMetadataVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } + public static void startCustomMetadataVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } + public static void addFeatures(FlatBufferBuilder builder, int featuresOffset) { builder.addOffset(3, featuresOffset, 0); } + public static int createFeaturesVector(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 startFeaturesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); } + public static int endSchema(FlatBufferBuilder builder) { + int o = builder.endTable(); + return o; + } + public static void finishSchemaBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); } + public static void finishSizePrefixedSchemaBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); } + + 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 Schema get(int j) { return get(new Schema(), j); } + public Schema get(Schema obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseMatrixCompressedAxis.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseMatrixCompressedAxis.java new file mode 100644 index 000000000..2ad314f2e --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseMatrixCompressedAxis.java @@ -0,0 +1,30 @@ +// 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; + +public final class SparseMatrixCompressedAxis { + private SparseMatrixCompressedAxis() { } + public static final short Row = 0; + public static final short Column = 1; + + public static final String[] names = { "Row", "Column", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseMatrixIndexCSX.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseMatrixIndexCSX.java new file mode 100644 index 000000000..9516a6ec1 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseMatrixIndexCSX.java @@ -0,0 +1,114 @@ +// 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") +/** + * Compressed Sparse format, that is matrix-specific. + */ +public final class SparseMatrixIndexCSX extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static SparseMatrixIndexCSX getRootAsSparseMatrixIndexCSX(ByteBuffer _bb) { return getRootAsSparseMatrixIndexCSX(_bb, new SparseMatrixIndexCSX()); } + public static SparseMatrixIndexCSX getRootAsSparseMatrixIndexCSX(ByteBuffer _bb, SparseMatrixIndexCSX 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 SparseMatrixIndexCSX __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * Which axis, row or column, is compressed + */ + public short compressedAxis() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 0; } + /** + * The type of values in indptrBuffer + */ + public org.apache.arrow.flatbuf.Int indptrType() { return indptrType(new org.apache.arrow.flatbuf.Int()); } + public org.apache.arrow.flatbuf.Int indptrType(org.apache.arrow.flatbuf.Int obj) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } + /** + * indptrBuffer stores the location and size of indptr array that + * represents the range of the rows. + * The i-th row spans from `indptr[i]` to `indptr[i+1]` in the data. + * The length of this array is 1 + (the number of rows), and the type + * of index value is long. + * + * For example, let X be the following 6x4 matrix: + * ```text + * X := [[0, 1, 2, 0], + * [0, 0, 3, 0], + * [0, 4, 0, 5], + * [0, 0, 0, 0], + * [6, 0, 7, 8], + * [0, 9, 0, 0]]. + * ``` + * The array of non-zero values in X is: + * ```text + * values(X) = [1, 2, 3, 4, 5, 6, 7, 8, 9]. + * ``` + * And the indptr of X is: + * ```text + * indptr(X) = [0, 2, 3, 5, 5, 8, 10]. + * ``` + */ + public org.apache.arrow.flatbuf.Buffer indptrBuffer() { return indptrBuffer(new org.apache.arrow.flatbuf.Buffer()); } + public org.apache.arrow.flatbuf.Buffer indptrBuffer(org.apache.arrow.flatbuf.Buffer obj) { int o = __offset(8); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; } + /** + * The type of values in indicesBuffer + */ + public org.apache.arrow.flatbuf.Int indicesType() { return indicesType(new org.apache.arrow.flatbuf.Int()); } + public org.apache.arrow.flatbuf.Int indicesType(org.apache.arrow.flatbuf.Int obj) { int o = __offset(10); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } + /** + * indicesBuffer stores the location and size of the array that + * contains the column indices of the corresponding non-zero values. + * The type of index value is long. + * + * For example, the indices of the above X is: + * ```text + * indices(X) = [1, 2, 2, 1, 3, 0, 2, 3, 1]. + * ``` + * Note that the indices are sorted in lexicographical order for each row. + */ + public org.apache.arrow.flatbuf.Buffer indicesBuffer() { return indicesBuffer(new org.apache.arrow.flatbuf.Buffer()); } + public org.apache.arrow.flatbuf.Buffer indicesBuffer(org.apache.arrow.flatbuf.Buffer obj) { int o = __offset(12); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; } + + public static void startSparseMatrixIndexCSX(FlatBufferBuilder builder) { builder.startTable(5); } + public static void addCompressedAxis(FlatBufferBuilder builder, short compressedAxis) { builder.addShort(0, compressedAxis, 0); } + public static void addIndptrType(FlatBufferBuilder builder, int indptrTypeOffset) { builder.addOffset(1, indptrTypeOffset, 0); } + public static void addIndptrBuffer(FlatBufferBuilder builder, int indptrBufferOffset) { builder.addStruct(2, indptrBufferOffset, 0); } + public static void addIndicesType(FlatBufferBuilder builder, int indicesTypeOffset) { builder.addOffset(3, indicesTypeOffset, 0); } + public static void addIndicesBuffer(FlatBufferBuilder builder, int indicesBufferOffset) { builder.addStruct(4, indicesBufferOffset, 0); } + public static int endSparseMatrixIndexCSX(FlatBufferBuilder builder) { + int o = builder.endTable(); + builder.required(o, 6); // indptrType + builder.required(o, 8); // indptrBuffer + builder.required(o, 10); // indicesType + builder.required(o, 12); // indicesBuffer + 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 SparseMatrixIndexCSX get(int j) { return get(new SparseMatrixIndexCSX(), j); } + public SparseMatrixIndexCSX get(SparseMatrixIndexCSX obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensor.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensor.java new file mode 100644 index 000000000..9b4cdf6e8 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensor.java @@ -0,0 +1,92 @@ +// 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") +public final class SparseTensor extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static SparseTensor getRootAsSparseTensor(ByteBuffer _bb) { return getRootAsSparseTensor(_bb, new SparseTensor()); } + public static SparseTensor getRootAsSparseTensor(ByteBuffer _bb, SparseTensor 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 SparseTensor __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public byte typeType() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 0; } + /** + * The type of data contained in a value cell. + * Currently only fixed-width value types are supported, + * no strings or nested types. + */ + public Table type(Table obj) { int o = __offset(6); return o != 0 ? __union(obj, o + bb_pos) : null; } + /** + * The dimensions of the tensor, optionally named. + */ + public org.apache.arrow.flatbuf.TensorDim shape(int j) { return shape(new org.apache.arrow.flatbuf.TensorDim(), j); } + public org.apache.arrow.flatbuf.TensorDim shape(org.apache.arrow.flatbuf.TensorDim obj, int j) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } + public int shapeLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.TensorDim.Vector shapeVector() { return shapeVector(new org.apache.arrow.flatbuf.TensorDim.Vector()); } + public org.apache.arrow.flatbuf.TensorDim.Vector shapeVector(org.apache.arrow.flatbuf.TensorDim.Vector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } + /** + * The number of non-zero values in a sparse tensor. + */ + public long nonZeroLength() { int o = __offset(10); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } + public byte sparseIndexType() { int o = __offset(12); return o != 0 ? bb.get(o + bb_pos) : 0; } + /** + * Sparse tensor index + */ + public Table sparseIndex(Table obj) { int o = __offset(14); return o != 0 ? __union(obj, o + bb_pos) : null; } + /** + * The location and size of the tensor's data + */ + public org.apache.arrow.flatbuf.Buffer data() { return data(new org.apache.arrow.flatbuf.Buffer()); } + public org.apache.arrow.flatbuf.Buffer data(org.apache.arrow.flatbuf.Buffer obj) { int o = __offset(16); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; } + + public static void startSparseTensor(FlatBufferBuilder builder) { builder.startTable(7); } + public static void addTypeType(FlatBufferBuilder builder, byte typeType) { builder.addByte(0, typeType, 0); } + public static void addType(FlatBufferBuilder builder, int typeOffset) { builder.addOffset(1, typeOffset, 0); } + public static void addShape(FlatBufferBuilder builder, int shapeOffset) { builder.addOffset(2, shapeOffset, 0); } + public static int createShapeVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } + public static void startShapeVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } + public static void addNonZeroLength(FlatBufferBuilder builder, long nonZeroLength) { builder.addLong(3, nonZeroLength, 0L); } + public static void addSparseIndexType(FlatBufferBuilder builder, byte sparseIndexType) { builder.addByte(4, sparseIndexType, 0); } + public static void addSparseIndex(FlatBufferBuilder builder, int sparseIndexOffset) { builder.addOffset(5, sparseIndexOffset, 0); } + public static void addData(FlatBufferBuilder builder, int dataOffset) { builder.addStruct(6, dataOffset, 0); } + public static int endSparseTensor(FlatBufferBuilder builder) { + int o = builder.endTable(); + builder.required(o, 6); // type + builder.required(o, 8); // shape + builder.required(o, 14); // sparseIndex + builder.required(o, 16); // data + return o; + } + public static void finishSparseTensorBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); } + public static void finishSizePrefixedSparseTensorBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); } + + 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 SparseTensor get(int j) { return get(new SparseTensor(), j); } + public SparseTensor get(SparseTensor obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensorIndex.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensorIndex.java new file mode 100644 index 000000000..5b9444abc --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensorIndex.java @@ -0,0 +1,32 @@ +// 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; + +public final class SparseTensorIndex { + private SparseTensorIndex() { } + public static final byte NONE = 0; + public static final byte SparseTensorIndexCOO = 1; + public static final byte SparseMatrixIndexCSX = 2; + public static final byte SparseTensorIndexCSF = 3; + + public static final String[] names = { "NONE", "SparseTensorIndexCOO", "SparseMatrixIndexCSX", "SparseTensorIndexCSF", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensorIndexCOO.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensorIndexCOO.java new file mode 100644 index 000000000..a84238d66 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensorIndexCOO.java @@ -0,0 +1,118 @@ +// 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") +/** + * ---------------------------------------------------------------------- + * EXPERIMENTAL: Data structures for sparse tensors + * Coordinate (COO) format of sparse tensor index. + * + * COO's index list are represented as a NxM matrix, + * where N is the number of non-zero values, + * and M is the number of dimensions of a sparse tensor. + * + * indicesBuffer stores the location and size of the data of this indices + * matrix. The value type and the stride of the indices matrix is + * specified in indicesType and indicesStrides fields. + * + * For example, let X be a 2x3x4x5 tensor, and it has the following + * 6 non-zero values: + * ```text + * X[0, 1, 2, 0] := 1 + * X[1, 1, 2, 3] := 2 + * X[0, 2, 1, 0] := 3 + * X[0, 1, 3, 0] := 4 + * X[0, 1, 2, 1] := 5 + * X[1, 2, 0, 4] := 6 + * ``` + * In COO format, the index matrix of X is the following 4x6 matrix: + * ```text + * [[0, 0, 0, 0, 1, 1], + * [1, 1, 1, 2, 1, 2], + * [2, 2, 3, 1, 2, 0], + * [0, 1, 0, 0, 3, 4]] + * ``` + * When isCanonical is true, the indices is sorted in lexicographical order + * (row-major order), and it does not have duplicated entries. Otherwise, + * the indices may not be sorted, or may have duplicated entries. + */ +public final class SparseTensorIndexCOO extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static SparseTensorIndexCOO getRootAsSparseTensorIndexCOO(ByteBuffer _bb) { return getRootAsSparseTensorIndexCOO(_bb, new SparseTensorIndexCOO()); } + public static SparseTensorIndexCOO getRootAsSparseTensorIndexCOO(ByteBuffer _bb, SparseTensorIndexCOO 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 SparseTensorIndexCOO __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * The type of values in indicesBuffer + */ + public org.apache.arrow.flatbuf.Int indicesType() { return indicesType(new org.apache.arrow.flatbuf.Int()); } + public org.apache.arrow.flatbuf.Int indicesType(org.apache.arrow.flatbuf.Int obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } + /** + * Non-negative byte offsets to advance one value cell along each dimension + * If omitted, default to row-major order (C-like). + */ + public long indicesStrides(int j) { int o = __offset(6); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; } + public int indicesStridesLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } + public LongVector indicesStridesVector() { return indicesStridesVector(new LongVector()); } + public LongVector indicesStridesVector(LongVector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), bb) : null; } + public ByteBuffer indicesStridesAsByteBuffer() { return __vector_as_bytebuffer(6, 8); } + public ByteBuffer indicesStridesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 8); } + /** + * The location and size of the indices matrix's data + */ + public org.apache.arrow.flatbuf.Buffer indicesBuffer() { return indicesBuffer(new org.apache.arrow.flatbuf.Buffer()); } + public org.apache.arrow.flatbuf.Buffer indicesBuffer(org.apache.arrow.flatbuf.Buffer obj) { int o = __offset(8); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; } + /** + * This flag is true if and only if the indices matrix is sorted in + * row-major order, and does not have duplicated entries. + * This sort order is the same as of Tensorflow's SparseTensor, + * but it is inverse order of SciPy's canonical coo_matrix + * (SciPy employs column-major order for its coo_matrix). + */ + public boolean isCanonical() { int o = __offset(10); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } + + public static void startSparseTensorIndexCOO(FlatBufferBuilder builder) { builder.startTable(4); } + public static void addIndicesType(FlatBufferBuilder builder, int indicesTypeOffset) { builder.addOffset(0, indicesTypeOffset, 0); } + public static void addIndicesStrides(FlatBufferBuilder builder, int indicesStridesOffset) { builder.addOffset(1, indicesStridesOffset, 0); } + public static int createIndicesStridesVector(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 startIndicesStridesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); } + public static void addIndicesBuffer(FlatBufferBuilder builder, int indicesBufferOffset) { builder.addStruct(2, indicesBufferOffset, 0); } + public static void addIsCanonical(FlatBufferBuilder builder, boolean isCanonical) { builder.addBoolean(3, isCanonical, false); } + public static int endSparseTensorIndexCOO(FlatBufferBuilder builder) { + int o = builder.endTable(); + builder.required(o, 4); // indicesType + builder.required(o, 8); // indicesBuffer + 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 SparseTensorIndexCOO get(int j) { return get(new SparseTensorIndexCOO(), j); } + public SparseTensorIndexCOO get(SparseTensorIndexCOO obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensorIndexCSF.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensorIndexCSF.java new file mode 100644 index 000000000..abc4662be --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/SparseTensorIndexCSF.java @@ -0,0 +1,173 @@ +// 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") +/** + * Compressed Sparse Fiber (CSF) sparse tensor index. + */ +public final class SparseTensorIndexCSF extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static SparseTensorIndexCSF getRootAsSparseTensorIndexCSF(ByteBuffer _bb) { return getRootAsSparseTensorIndexCSF(_bb, new SparseTensorIndexCSF()); } + public static SparseTensorIndexCSF getRootAsSparseTensorIndexCSF(ByteBuffer _bb, SparseTensorIndexCSF 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 SparseTensorIndexCSF __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * CSF is a generalization of compressed sparse row (CSR) index. + * See [smith2017knl](http://shaden.io/pub-files/smith2017knl.pdf) + * + * CSF index recursively compresses each dimension of a tensor into a set + * of prefix trees. Each path from a root to leaf forms one tensor + * non-zero index. CSF is implemented with two arrays of buffers and one + * arrays of integers. + * + * For example, let X be a 2x3x4x5 tensor and let it have the following + * 8 non-zero values: + * ```text + * X[0, 0, 0, 1] := 1 + * X[0, 0, 0, 2] := 2 + * X[0, 1, 0, 0] := 3 + * X[0, 1, 0, 2] := 4 + * X[0, 1, 1, 0] := 5 + * X[1, 1, 1, 0] := 6 + * X[1, 1, 1, 1] := 7 + * X[1, 1, 1, 2] := 8 + * ``` + * As a prefix tree this would be represented as: + * ```text + * 0 1 + * / \ | + * 0 1 1 + * / / \ | + * 0 0 1 1 + * /| /| | /| | + * 1 2 0 2 0 0 1 2 + * ``` + * The type of values in indptrBuffers + */ + public org.apache.arrow.flatbuf.Int indptrType() { return indptrType(new org.apache.arrow.flatbuf.Int()); } + public org.apache.arrow.flatbuf.Int indptrType(org.apache.arrow.flatbuf.Int obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } + /** + * indptrBuffers stores the sparsity structure. + * Each two consecutive dimensions in a tensor correspond to a buffer in + * indptrBuffers. A pair of consecutive values at `indptrBuffers[dim][i]` + * and `indptrBuffers[dim][i + 1]` signify a range of nodes in + * `indicesBuffers[dim + 1]` who are children of `indicesBuffers[dim][i]` node. + * + * For example, the indptrBuffers for the above X is: + * ```text + * indptrBuffer(X) = [ + * [0, 2, 3], + * [0, 1, 3, 4], + * [0, 2, 4, 5, 8] + * ]. + * ``` + */ + public org.apache.arrow.flatbuf.Buffer indptrBuffers(int j) { return indptrBuffers(new org.apache.arrow.flatbuf.Buffer(), j); } + public org.apache.arrow.flatbuf.Buffer indptrBuffers(org.apache.arrow.flatbuf.Buffer obj, int j) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o) + j * 16, bb) : null; } + public int indptrBuffersLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.Buffer.Vector indptrBuffersVector() { return indptrBuffersVector(new org.apache.arrow.flatbuf.Buffer.Vector()); } + public org.apache.arrow.flatbuf.Buffer.Vector indptrBuffersVector(org.apache.arrow.flatbuf.Buffer.Vector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), 16, bb) : null; } + /** + * The type of values in indicesBuffers + */ + public org.apache.arrow.flatbuf.Int indicesType() { return indicesType(new org.apache.arrow.flatbuf.Int()); } + public org.apache.arrow.flatbuf.Int indicesType(org.apache.arrow.flatbuf.Int obj) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; } + /** + * indicesBuffers stores values of nodes. + * Each tensor dimension corresponds to a buffer in indicesBuffers. + * For example, the indicesBuffers for the above X is: + * ```text + * indicesBuffer(X) = [ + * [0, 1], + * [0, 1, 1], + * [0, 0, 1, 1], + * [1, 2, 0, 2, 0, 0, 1, 2] + * ]. + * ``` + */ + public org.apache.arrow.flatbuf.Buffer indicesBuffers(int j) { return indicesBuffers(new org.apache.arrow.flatbuf.Buffer(), j); } + public org.apache.arrow.flatbuf.Buffer indicesBuffers(org.apache.arrow.flatbuf.Buffer obj, int j) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o) + j * 16, bb) : null; } + public int indicesBuffersLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.Buffer.Vector indicesBuffersVector() { return indicesBuffersVector(new org.apache.arrow.flatbuf.Buffer.Vector()); } + public org.apache.arrow.flatbuf.Buffer.Vector indicesBuffersVector(org.apache.arrow.flatbuf.Buffer.Vector obj) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o), 16, bb) : null; } + /** + * axisOrder stores the sequence in which dimensions were traversed to + * produce the prefix tree. + * For example, the axisOrder for the above X is: + * ```text + * axisOrder(X) = [0, 1, 2, 3]. + * ``` + */ + public int axisOrder(int j) { int o = __offset(12); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; } + public int axisOrderLength() { int o = __offset(12); return o != 0 ? __vector_len(o) : 0; } + public IntVector axisOrderVector() { return axisOrderVector(new IntVector()); } + public IntVector axisOrderVector(IntVector obj) { int o = __offset(12); return o != 0 ? obj.__assign(__vector(o), bb) : null; } + public ByteBuffer axisOrderAsByteBuffer() { return __vector_as_bytebuffer(12, 4); } + public ByteBuffer axisOrderInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 12, 4); } + + public static int createSparseTensorIndexCSF(FlatBufferBuilder builder, + int indptrTypeOffset, + int indptrBuffersOffset, + int indicesTypeOffset, + int indicesBuffersOffset, + int axisOrderOffset) { + builder.startTable(5); + SparseTensorIndexCSF.addAxisOrder(builder, axisOrderOffset); + SparseTensorIndexCSF.addIndicesBuffers(builder, indicesBuffersOffset); + SparseTensorIndexCSF.addIndicesType(builder, indicesTypeOffset); + SparseTensorIndexCSF.addIndptrBuffers(builder, indptrBuffersOffset); + SparseTensorIndexCSF.addIndptrType(builder, indptrTypeOffset); + return SparseTensorIndexCSF.endSparseTensorIndexCSF(builder); + } + + public static void startSparseTensorIndexCSF(FlatBufferBuilder builder) { builder.startTable(5); } + public static void addIndptrType(FlatBufferBuilder builder, int indptrTypeOffset) { builder.addOffset(0, indptrTypeOffset, 0); } + public static void addIndptrBuffers(FlatBufferBuilder builder, int indptrBuffersOffset) { builder.addOffset(1, indptrBuffersOffset, 0); } + public static void startIndptrBuffersVector(FlatBufferBuilder builder, int numElems) { builder.startVector(16, numElems, 8); } + public static void addIndicesType(FlatBufferBuilder builder, int indicesTypeOffset) { builder.addOffset(2, indicesTypeOffset, 0); } + public static void addIndicesBuffers(FlatBufferBuilder builder, int indicesBuffersOffset) { builder.addOffset(3, indicesBuffersOffset, 0); } + public static void startIndicesBuffersVector(FlatBufferBuilder builder, int numElems) { builder.startVector(16, numElems, 8); } + public static void addAxisOrder(FlatBufferBuilder builder, int axisOrderOffset) { builder.addOffset(4, axisOrderOffset, 0); } + public static int createAxisOrderVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); } + public static void startAxisOrderVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } + public static int endSparseTensorIndexCSF(FlatBufferBuilder builder) { + int o = builder.endTable(); + builder.required(o, 4); // indptrType + builder.required(o, 6); // indptrBuffers + builder.required(o, 8); // indicesType + builder.required(o, 10); // indicesBuffers + builder.required(o, 12); // axisOrder + 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 SparseTensorIndexCSF get(int j) { return get(new SparseTensorIndexCSF(), j); } + public SparseTensorIndexCSF get(SparseTensorIndexCSF obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Struct_.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Struct_.java new file mode 100644 index 000000000..1285f2884 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Struct_.java @@ -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") +/** + * A Struct_ in the flatbuffer metadata is the same as an Arrow Struct + * (according to the physical memory layout). We used Struct_ here as + * Struct is a reserved word in Flatbuffers + */ +public final class Struct_ extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Struct_ getRootAsStruct_(ByteBuffer _bb) { return getRootAsStruct_(_bb, new Struct_()); } + public static Struct_ getRootAsStruct_(ByteBuffer _bb, Struct_ 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 Struct_ __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void startStruct_(FlatBufferBuilder builder) { builder.startTable(0); } + public static int endStruct_(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 Struct_ get(int j) { return get(new Struct_(), j); } + public Struct_ get(Struct_ obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Tensor.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Tensor.java new file mode 100644 index 000000000..d4466bcf2 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Tensor.java @@ -0,0 +1,91 @@ +// 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") +public final class Tensor extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Tensor getRootAsTensor(ByteBuffer _bb) { return getRootAsTensor(_bb, new Tensor()); } + public static Tensor getRootAsTensor(ByteBuffer _bb, Tensor 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 Tensor __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public byte typeType() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 0; } + /** + * The type of data contained in a value cell. Currently only fixed-width + * value types are supported, no strings or nested types + */ + public Table type(Table obj) { int o = __offset(6); return o != 0 ? __union(obj, o + bb_pos) : null; } + /** + * The dimensions of the tensor, optionally named + */ + public org.apache.arrow.flatbuf.TensorDim shape(int j) { return shape(new org.apache.arrow.flatbuf.TensorDim(), j); } + public org.apache.arrow.flatbuf.TensorDim shape(org.apache.arrow.flatbuf.TensorDim obj, int j) { int o = __offset(8); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } + public int shapeLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; } + public org.apache.arrow.flatbuf.TensorDim.Vector shapeVector() { return shapeVector(new org.apache.arrow.flatbuf.TensorDim.Vector()); } + public org.apache.arrow.flatbuf.TensorDim.Vector shapeVector(org.apache.arrow.flatbuf.TensorDim.Vector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } + /** + * Non-negative byte offsets to advance one value cell along each dimension + * If omitted, default to row-major order (C-like). + */ + public long strides(int j) { int o = __offset(10); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; } + public int stridesLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; } + public LongVector stridesVector() { return stridesVector(new LongVector()); } + public LongVector stridesVector(LongVector obj) { int o = __offset(10); return o != 0 ? obj.__assign(__vector(o), bb) : null; } + public ByteBuffer stridesAsByteBuffer() { return __vector_as_bytebuffer(10, 8); } + public ByteBuffer stridesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 10, 8); } + /** + * The location and size of the tensor's data + */ + public org.apache.arrow.flatbuf.Buffer data() { return data(new org.apache.arrow.flatbuf.Buffer()); } + public org.apache.arrow.flatbuf.Buffer data(org.apache.arrow.flatbuf.Buffer obj) { int o = __offset(12); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; } + + public static void startTensor(FlatBufferBuilder builder) { builder.startTable(5); } + public static void addTypeType(FlatBufferBuilder builder, byte typeType) { builder.addByte(0, typeType, 0); } + public static void addType(FlatBufferBuilder builder, int typeOffset) { builder.addOffset(1, typeOffset, 0); } + public static void addShape(FlatBufferBuilder builder, int shapeOffset) { builder.addOffset(2, shapeOffset, 0); } + public static int createShapeVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } + public static void startShapeVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } + public static void addStrides(FlatBufferBuilder builder, int stridesOffset) { builder.addOffset(3, stridesOffset, 0); } + public static int createStridesVector(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 startStridesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); } + public static void addData(FlatBufferBuilder builder, int dataOffset) { builder.addStruct(4, dataOffset, 0); } + public static int endTensor(FlatBufferBuilder builder) { + int o = builder.endTable(); + builder.required(o, 6); // type + builder.required(o, 8); // shape + builder.required(o, 12); // data + return o; + } + public static void finishTensorBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); } + public static void finishSizePrefixedTensorBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); } + + 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 Tensor get(int j) { return get(new Tensor(), j); } + public Tensor get(Tensor obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/TensorDim.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/TensorDim.java new file mode 100644 index 000000000..fad8caacd --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/TensorDim.java @@ -0,0 +1,74 @@ +// 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") +/** + * ---------------------------------------------------------------------- + * Data structures for dense tensors + * Shape data for a single axis in a tensor + */ +public final class TensorDim extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static TensorDim getRootAsTensorDim(ByteBuffer _bb) { return getRootAsTensorDim(_bb, new TensorDim()); } + public static TensorDim getRootAsTensorDim(ByteBuffer _bb, TensorDim 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 TensorDim __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + /** + * Length of dimension + */ + public long size() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } + /** + * Name of the dimension, optional + */ + public String name() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; } + public ByteBuffer nameAsByteBuffer() { return __vector_as_bytebuffer(6, 1); } + public ByteBuffer nameInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); } + + public static int createTensorDim(FlatBufferBuilder builder, + long size, + int nameOffset) { + builder.startTable(2); + TensorDim.addSize(builder, size); + TensorDim.addName(builder, nameOffset); + return TensorDim.endTensorDim(builder); + } + + public static void startTensorDim(FlatBufferBuilder builder) { builder.startTable(2); } + public static void addSize(FlatBufferBuilder builder, long size) { builder.addLong(0, size, 0L); } + public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(1, nameOffset, 0); } + public static int endTensorDim(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 TensorDim get(int j) { return get(new TensorDim(), j); } + public TensorDim get(TensorDim obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Time.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Time.java new file mode 100644 index 000000000..596d403a3 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Time.java @@ -0,0 +1,66 @@ +// 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") +/** + * Time type. The physical storage type depends on the unit + * - SECOND and MILLISECOND: 32 bits + * - MICROSECOND and NANOSECOND: 64 bits + */ +public final class Time extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Time getRootAsTime(ByteBuffer _bb) { return getRootAsTime(_bb, new Time()); } + public static Time getRootAsTime(ByteBuffer _bb, Time 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 Time __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public short unit() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 1; } + public int bitWidth() { int o = __offset(6); return o != 0 ? bb.getInt(o + bb_pos) : 32; } + + public static int createTime(FlatBufferBuilder builder, + short unit, + int bitWidth) { + builder.startTable(2); + Time.addBitWidth(builder, bitWidth); + Time.addUnit(builder, unit); + return Time.endTime(builder); + } + + public static void startTime(FlatBufferBuilder builder) { builder.startTable(2); } + public static void addUnit(FlatBufferBuilder builder, short unit) { builder.addShort(0, unit, 1); } + public static void addBitWidth(FlatBufferBuilder builder, int bitWidth) { builder.addInt(1, bitWidth, 32); } + public static int endTime(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 Time get(int j) { return get(new Time(), j); } + public Time get(Time obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/TimeUnit.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/TimeUnit.java new file mode 100644 index 000000000..828e44c13 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/TimeUnit.java @@ -0,0 +1,32 @@ +// 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; + +public final class TimeUnit { + private TimeUnit() { } + public static final short SECOND = 0; + public static final short MILLISECOND = 1; + public static final short MICROSECOND = 2; + public static final short NANOSECOND = 3; + + public static final String[] names = { "SECOND", "MILLISECOND", "MICROSECOND", "NANOSECOND", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Timestamp.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Timestamp.java new file mode 100644 index 000000000..041452607 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Timestamp.java @@ -0,0 +1,116 @@ +// 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") +/** + * Time elapsed from the Unix epoch, 00:00:00.000 on 1 January 1970, excluding + * leap seconds, as a 64-bit integer. Note that UNIX time does not include + * leap seconds. + * + * Date & time libraries often have multiple different data types for temporal + * data. In order to ease interoperability between different implementations the + * Arrow project has some recommendations for encoding these types into a Timestamp + * column. + * + * An "instant" represents a single moment in time that has no meaningful time zone + * or the time zone is unknown. A column of instants can also contain values from + * multiple time zones. To encode an instant set the timezone string to "UTC". + * + * A "zoned date-time" represents a single moment in time that has a meaningful + * reference time zone. To encode a zoned date-time as a Timestamp set the timezone + * string to the name of the timezone. There is some ambiguity between an instant + * and a zoned date-time with the UTC time zone. Both of these are stored the same. + * Typically, this distinction does not matter. If it does, then an application should + * use custom metadata or an extension type to distinguish between the two cases. + * + * An "offset date-time" represents a single moment in time combined with a meaningful + * offset from UTC. To encode an offset date-time as a Timestamp set the timezone string + * to the numeric time zone offset string (e.g. "+03:00"). + * + * A "local date-time" does not represent a single moment in time. It represents a wall + * clock time combined with a date. Because of daylight savings time there may multiple + * instants that correspond to a single local date-time in any given time zone. A + * local date-time is often stored as a struct or a Date32/Time64 pair. However, it can + * also be encoded into a Timestamp column. To do so the value should be the the time + * elapsed from the Unix epoch so that a wall clock in UTC would display the desired time. + * The timezone string should be set to null or the empty string. + */ +public final class Timestamp extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Timestamp getRootAsTimestamp(ByteBuffer _bb) { return getRootAsTimestamp(_bb, new Timestamp()); } + public static Timestamp getRootAsTimestamp(ByteBuffer _bb, Timestamp 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 Timestamp __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public short unit() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 0; } + /** + * The time zone is a string indicating the name of a time zone, one of: + * + * * As used in the Olson time zone database (the "tz database" or + * "tzdata"), such as "America/New_York" + * * An absolute time zone offset of the form +XX:XX or -XX:XX, such as +07:30 + * + * Whether a timezone string is present indicates different semantics about + * the data: + * + * * If the time zone is null or an empty string, the data is a local date-time + * and does not represent a single moment in time. Instead it represents a wall clock + * time and care should be taken to avoid interpreting it semantically as an instant. + * + * * If the time zone is set to a valid value, values can be displayed as + * "localized" to that time zone, even though the underlying 64-bit + * integers are identical to the same data stored in UTC. Converting + * between time zones is a metadata-only operation and does not change the + * underlying values + */ + public String timezone() { int o = __offset(6); return o != 0 ? __string(o + bb_pos) : null; } + public ByteBuffer timezoneAsByteBuffer() { return __vector_as_bytebuffer(6, 1); } + public ByteBuffer timezoneInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); } + + public static int createTimestamp(FlatBufferBuilder builder, + short unit, + int timezoneOffset) { + builder.startTable(2); + Timestamp.addTimezone(builder, timezoneOffset); + Timestamp.addUnit(builder, unit); + return Timestamp.endTimestamp(builder); + } + + public static void startTimestamp(FlatBufferBuilder builder) { builder.startTable(2); } + public static void addUnit(FlatBufferBuilder builder, short unit) { builder.addShort(0, unit, 0); } + public static void addTimezone(FlatBufferBuilder builder, int timezoneOffset) { builder.addOffset(1, timezoneOffset, 0); } + public static int endTimestamp(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 Timestamp get(int j) { return get(new Timestamp(), j); } + public Timestamp get(Timestamp obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Type.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Type.java new file mode 100644 index 000000000..5f1a550cf --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Type.java @@ -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; + +/** + * ---------------------------------------------------------------------- + * Top-level Type value, enabling extensible type-specific metadata. We can + * add new logical types to Type without breaking backwards compatibility + */ +public final class Type { + private Type() { } + public static final byte NONE = 0; + public static final byte Null = 1; + public static final byte Int = 2; + public static final byte FloatingPoint = 3; + public static final byte Binary = 4; + public static final byte Utf8 = 5; + public static final byte Bool = 6; + public static final byte Decimal = 7; + public static final byte Date = 8; + public static final byte Time = 9; + public static final byte Timestamp = 10; + public static final byte Interval = 11; + public static final byte List = 12; + public static final byte Struct_ = 13; + public static final byte Union = 14; + public static final byte FixedSizeBinary = 15; + public static final byte FixedSizeList = 16; + public static final byte Map = 17; + public static final byte Duration = 18; + public static final byte LargeBinary = 19; + public static final byte LargeUtf8 = 20; + public static final byte LargeList = 21; + + public static final String[] names = { "NONE", "Null", "Int", "FloatingPoint", "Binary", "Utf8", "Bool", "Decimal", "Date", "Time", "Timestamp", "Interval", "List", "Struct_", "Union", "FixedSizeBinary", "FixedSizeList", "Map", "Duration", "LargeBinary", "LargeUtf8", "LargeList", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Union.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Union.java new file mode 100644 index 000000000..7e2822434 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Union.java @@ -0,0 +1,74 @@ +// 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") +/** + * A union is a complex type with children in Field + * By default ids in the type vector refer to the offsets in the children + * optionally typeIds provides an indirection between the child offset and the type id + * for each child `typeIds[offset]` is the id used in the type vector + */ +public final class Union extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Union getRootAsUnion(ByteBuffer _bb) { return getRootAsUnion(_bb, new Union()); } + public static Union getRootAsUnion(ByteBuffer _bb, Union 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 Union __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public short mode() { int o = __offset(4); return o != 0 ? bb.getShort(o + bb_pos) : 0; } + public int typeIds(int j) { int o = __offset(6); return o != 0 ? bb.getInt(__vector(o) + j * 4) : 0; } + public int typeIdsLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } + public IntVector typeIdsVector() { return typeIdsVector(new IntVector()); } + public IntVector typeIdsVector(IntVector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), bb) : null; } + public ByteBuffer typeIdsAsByteBuffer() { return __vector_as_bytebuffer(6, 4); } + public ByteBuffer typeIdsInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 4); } + + public static int createUnion(FlatBufferBuilder builder, + short mode, + int typeIdsOffset) { + builder.startTable(2); + Union.addTypeIds(builder, typeIdsOffset); + Union.addMode(builder, mode); + return Union.endUnion(builder); + } + + public static void startUnion(FlatBufferBuilder builder) { builder.startTable(2); } + public static void addMode(FlatBufferBuilder builder, short mode) { builder.addShort(0, mode, 0); } + public static void addTypeIds(FlatBufferBuilder builder, int typeIdsOffset) { builder.addOffset(1, typeIdsOffset, 0); } + public static int createTypeIdsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addInt(data[i]); return builder.endVector(); } + public static void startTypeIdsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } + public static int endUnion(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 Union get(int j) { return get(new Union(), j); } + public Union get(Union obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/UnionMode.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/UnionMode.java new file mode 100644 index 000000000..23a6013f8 --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/UnionMode.java @@ -0,0 +1,30 @@ +// 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; + +public final class UnionMode { + private UnionMode() { } + public static final short Sparse = 0; + public static final short Dense = 1; + + public static final String[] names = { "Sparse", "Dense", }; + + public static String name(int e) { return names[e]; } +} + diff --git a/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Utf8.java b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Utf8.java new file mode 100644 index 000000000..d77fe205f --- /dev/null +++ b/src/arrow/java/format/src/main/java/org/apache/arrow/flatbuf/Utf8.java @@ -0,0 +1,51 @@ +// 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") +/** + * Unicode with UTF-8 encoding + */ +public final class Utf8 extends Table { + public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); } + public static Utf8 getRootAsUtf8(ByteBuffer _bb) { return getRootAsUtf8(_bb, new Utf8()); } + public static Utf8 getRootAsUtf8(ByteBuffer _bb, Utf8 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 Utf8 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + + public static void startUtf8(FlatBufferBuilder builder) { builder.startTable(0); } + public static int endUtf8(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 Utf8 get(int j) { return get(new Utf8(), j); } + public Utf8 get(Utf8 obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } + } +} + |