1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
17 // automatically generated by the FlatBuffers compiler, do not modify
19 package org
.apache
.arrow
.flatbuf
;
24 import com
.google
.flatbuffers
.*;
26 @SuppressWarnings("unused")
28 * ----------------------------------------------------------------------
29 * A Schema describes the columns in a row batch
31 public final class Schema
extends Table
{
32 public static void ValidateVersion() { Constants
.FLATBUFFERS_1_12_0(); }
33 public static Schema
getRootAsSchema(ByteBuffer _bb
) { return getRootAsSchema(_bb
, new Schema()); }
34 public static Schema
getRootAsSchema(ByteBuffer _bb
, Schema obj
) { _bb
.order(ByteOrder
.LITTLE_ENDIAN
); return (obj
.__assign(_bb
.getInt(_bb
.position()) + _bb
.position(), _bb
)); }
35 public void __init(int _i
, ByteBuffer _bb
) { __reset(_i
, _bb
); }
36 public Schema
__assign(int _i
, ByteBuffer _bb
) { __init(_i
, _bb
); return this; }
39 * endianness of the buffer
40 * it is Little Endian by default
41 * if endianness doesn't match the underlying system then the vectors need to be converted
43 public short endianness() { int o
= __offset(4); return o
!= 0 ? bb
.getShort(o
+ bb_pos
) : 0; }
44 public org
.apache
.arrow
.flatbuf
.Field
fields(int j
) { return fields(new org
.apache
.arrow
.flatbuf
.Field(), j
); }
45 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; }
46 public int fieldsLength() { int o
= __offset(6); return o
!= 0 ?
__vector_len(o
) : 0; }
47 public org
.apache
.arrow
.flatbuf
.Field
.Vector
fieldsVector() { return fieldsVector(new org
.apache
.arrow
.flatbuf
.Field
.Vector()); }
48 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; }
49 public org
.apache
.arrow
.flatbuf
.KeyValue
customMetadata(int j
) { return customMetadata(new org
.apache
.arrow
.flatbuf
.KeyValue(), j
); }
50 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; }
51 public int customMetadataLength() { int o
= __offset(8); return o
!= 0 ?
__vector_len(o
) : 0; }
52 public org
.apache
.arrow
.flatbuf
.KeyValue
.Vector
customMetadataVector() { return customMetadataVector(new org
.apache
.arrow
.flatbuf
.KeyValue
.Vector()); }
53 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; }
55 * Features used in the stream/file.
57 public long features(int j
) { int o
= __offset(10); return o
!= 0 ? bb
.getLong(__vector(o
) + j
* 8) : 0; }
58 public int featuresLength() { int o
= __offset(10); return o
!= 0 ?
__vector_len(o
) : 0; }
59 public LongVector
featuresVector() { return featuresVector(new LongVector()); }
60 public LongVector
featuresVector(LongVector obj
) { int o
= __offset(10); return o
!= 0 ? obj
.__assign(__vector(o
), bb
) : null; }
61 public ByteBuffer
featuresAsByteBuffer() { return __vector_as_bytebuffer(10, 8); }
62 public ByteBuffer
featuresInByteBuffer(ByteBuffer _bb
) { return __vector_in_bytebuffer(_bb
, 10, 8); }
64 public static int createSchema(FlatBufferBuilder builder
,
67 int custom_metadataOffset
,
69 builder
.startTable(4);
70 Schema
.addFeatures(builder
, featuresOffset
);
71 Schema
.addCustomMetadata(builder
, custom_metadataOffset
);
72 Schema
.addFields(builder
, fieldsOffset
);
73 Schema
.addEndianness(builder
, endianness
);
74 return Schema
.endSchema(builder
);
77 public static void startSchema(FlatBufferBuilder builder
) { builder
.startTable(4); }
78 public static void addEndianness(FlatBufferBuilder builder
, short endianness
) { builder
.addShort(0, endianness
, 0); }
79 public static void addFields(FlatBufferBuilder builder
, int fieldsOffset
) { builder
.addOffset(1, fieldsOffset
, 0); }
80 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(); }
81 public static void startFieldsVector(FlatBufferBuilder builder
, int numElems
) { builder
.startVector(4, numElems
, 4); }
82 public static void addCustomMetadata(FlatBufferBuilder builder
, int customMetadataOffset
) { builder
.addOffset(2, customMetadataOffset
, 0); }
83 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(); }
84 public static void startCustomMetadataVector(FlatBufferBuilder builder
, int numElems
) { builder
.startVector(4, numElems
, 4); }
85 public static void addFeatures(FlatBufferBuilder builder
, int featuresOffset
) { builder
.addOffset(3, featuresOffset
, 0); }
86 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(); }
87 public static void startFeaturesVector(FlatBufferBuilder builder
, int numElems
) { builder
.startVector(8, numElems
, 8); }
88 public static int endSchema(FlatBufferBuilder builder
) {
89 int o
= builder
.endTable();
92 public static void finishSchemaBuffer(FlatBufferBuilder builder
, int offset
) { builder
.finish(offset
); }
93 public static void finishSizePrefixedSchemaBuffer(FlatBufferBuilder builder
, int offset
) { builder
.finishSizePrefixed(offset
); }
95 public static final class Vector
extends BaseVector
{
96 public Vector
__assign(int _vector
, int _element_size
, ByteBuffer _bb
) { __reset(_vector
, _element_size
, _bb
); return this; }
98 public Schema
get(int j
) { return get(new Schema(), j
); }
99 public Schema
get(Schema obj
, int j
) { return obj
.__assign(__indirect(__element(j
), bb
), bb
); }