1// automatically generated by the FlatBuffers compiler, do not modify
2
3
4#ifndef FLATBUFFERS_GENERATED_SCHEMA_ORG_APACHE_ARROW_FLATBUF_H_
5#define FLATBUFFERS_GENERATED_SCHEMA_ORG_APACHE_ARROW_FLATBUF_H_
6
7#include "flatbuffers/flatbuffers.h"
8
9namespace org {
10namespace apache {
11namespace arrow {
12namespace flatbuf {
13
14struct Null;
15
16struct Struct_;
17
18struct List;
19
20struct LargeList;
21
22struct FixedSizeList;
23
24struct Map;
25
26struct Union;
27
28struct Int;
29
30struct FloatingPoint;
31
32struct Utf8;
33
34struct Binary;
35
36struct LargeUtf8;
37
38struct LargeBinary;
39
40struct FixedSizeBinary;
41
42struct Bool;
43
44struct Decimal;
45
46struct Date;
47
48struct Time;
49
50struct Timestamp;
51
52struct Interval;
53
54struct Duration;
55
56struct KeyValue;
57
58struct DictionaryEncoding;
59
60struct Field;
61
62struct Buffer;
63
64struct Schema;
65
66enum MetadataVersion {
67 /// 0.1.0
68 MetadataVersion_V1 = 0 /// 0.2.0
69,
70 MetadataVersion_V2 = 1 /// 0.3.0 -> 0.7.1
71,
72 MetadataVersion_V3 = 2 /// >= 0.8.0
73,
74 MetadataVersion_V4 = 3,
75 MetadataVersion_MIN = MetadataVersion_V1,
76 MetadataVersion_MAX = MetadataVersion_V4
77};
78
79inline const MetadataVersion (&EnumValuesMetadataVersion())[4] {
80 static const MetadataVersion values[] = {
81 MetadataVersion_V1,
82 MetadataVersion_V2,
83 MetadataVersion_V3,
84 MetadataVersion_V4
85 };
86 return values;
87}
88
89inline const char * const *EnumNamesMetadataVersion() {
90 static const char * const names[] = {
91 "V1",
92 "V2",
93 "V3",
94 "V4",
95 nullptr
96 };
97 return names;
98}
99
100inline const char *EnumNameMetadataVersion(MetadataVersion e) {
101 if (e < MetadataVersion_V1 || e > MetadataVersion_V4) return "";
102 const size_t index = static_cast<size_t>(e);
103 return EnumNamesMetadataVersion()[index];
104}
105
106enum UnionMode {
107 UnionMode_Sparse = 0,
108 UnionMode_Dense = 1,
109 UnionMode_MIN = UnionMode_Sparse,
110 UnionMode_MAX = UnionMode_Dense
111};
112
113inline const UnionMode (&EnumValuesUnionMode())[2] {
114 static const UnionMode values[] = {
115 UnionMode_Sparse,
116 UnionMode_Dense
117 };
118 return values;
119}
120
121inline const char * const *EnumNamesUnionMode() {
122 static const char * const names[] = {
123 "Sparse",
124 "Dense",
125 nullptr
126 };
127 return names;
128}
129
130inline const char *EnumNameUnionMode(UnionMode e) {
131 if (e < UnionMode_Sparse || e > UnionMode_Dense) return "";
132 const size_t index = static_cast<size_t>(e);
133 return EnumNamesUnionMode()[index];
134}
135
136enum Precision {
137 Precision_HALF = 0,
138 Precision_SINGLE = 1,
139 Precision_DOUBLE = 2,
140 Precision_MIN = Precision_HALF,
141 Precision_MAX = Precision_DOUBLE
142};
143
144inline const Precision (&EnumValuesPrecision())[3] {
145 static const Precision values[] = {
146 Precision_HALF,
147 Precision_SINGLE,
148 Precision_DOUBLE
149 };
150 return values;
151}
152
153inline const char * const *EnumNamesPrecision() {
154 static const char * const names[] = {
155 "HALF",
156 "SINGLE",
157 "DOUBLE",
158 nullptr
159 };
160 return names;
161}
162
163inline const char *EnumNamePrecision(Precision e) {
164 if (e < Precision_HALF || e > Precision_DOUBLE) return "";
165 const size_t index = static_cast<size_t>(e);
166 return EnumNamesPrecision()[index];
167}
168
169enum DateUnit {
170 DateUnit_DAY = 0,
171 DateUnit_MILLISECOND = 1,
172 DateUnit_MIN = DateUnit_DAY,
173 DateUnit_MAX = DateUnit_MILLISECOND
174};
175
176inline const DateUnit (&EnumValuesDateUnit())[2] {
177 static const DateUnit values[] = {
178 DateUnit_DAY,
179 DateUnit_MILLISECOND
180 };
181 return values;
182}
183
184inline const char * const *EnumNamesDateUnit() {
185 static const char * const names[] = {
186 "DAY",
187 "MILLISECOND",
188 nullptr
189 };
190 return names;
191}
192
193inline const char *EnumNameDateUnit(DateUnit e) {
194 if (e < DateUnit_DAY || e > DateUnit_MILLISECOND) return "";
195 const size_t index = static_cast<size_t>(e);
196 return EnumNamesDateUnit()[index];
197}
198
199enum TimeUnit {
200 TimeUnit_SECOND = 0,
201 TimeUnit_MILLISECOND = 1,
202 TimeUnit_MICROSECOND = 2,
203 TimeUnit_NANOSECOND = 3,
204 TimeUnit_MIN = TimeUnit_SECOND,
205 TimeUnit_MAX = TimeUnit_NANOSECOND
206};
207
208inline const TimeUnit (&EnumValuesTimeUnit())[4] {
209 static const TimeUnit values[] = {
210 TimeUnit_SECOND,
211 TimeUnit_MILLISECOND,
212 TimeUnit_MICROSECOND,
213 TimeUnit_NANOSECOND
214 };
215 return values;
216}
217
218inline const char * const *EnumNamesTimeUnit() {
219 static const char * const names[] = {
220 "SECOND",
221 "MILLISECOND",
222 "MICROSECOND",
223 "NANOSECOND",
224 nullptr
225 };
226 return names;
227}
228
229inline const char *EnumNameTimeUnit(TimeUnit e) {
230 if (e < TimeUnit_SECOND || e > TimeUnit_NANOSECOND) return "";
231 const size_t index = static_cast<size_t>(e);
232 return EnumNamesTimeUnit()[index];
233}
234
235enum IntervalUnit {
236 IntervalUnit_YEAR_MONTH = 0,
237 IntervalUnit_DAY_TIME = 1,
238 IntervalUnit_MIN = IntervalUnit_YEAR_MONTH,
239 IntervalUnit_MAX = IntervalUnit_DAY_TIME
240};
241
242inline const IntervalUnit (&EnumValuesIntervalUnit())[2] {
243 static const IntervalUnit values[] = {
244 IntervalUnit_YEAR_MONTH,
245 IntervalUnit_DAY_TIME
246 };
247 return values;
248}
249
250inline const char * const *EnumNamesIntervalUnit() {
251 static const char * const names[] = {
252 "YEAR_MONTH",
253 "DAY_TIME",
254 nullptr
255 };
256 return names;
257}
258
259inline const char *EnumNameIntervalUnit(IntervalUnit e) {
260 if (e < IntervalUnit_YEAR_MONTH || e > IntervalUnit_DAY_TIME) return "";
261 const size_t index = static_cast<size_t>(e);
262 return EnumNamesIntervalUnit()[index];
263}
264
265/// ----------------------------------------------------------------------
266/// Top-level Type value, enabling extensible type-specific metadata. We can
267/// add new logical types to Type without breaking backwards compatibility
268enum Type {
269 Type_NONE = 0,
270 Type_Null = 1,
271 Type_Int = 2,
272 Type_FloatingPoint = 3,
273 Type_Binary = 4,
274 Type_Utf8 = 5,
275 Type_Bool = 6,
276 Type_Decimal = 7,
277 Type_Date = 8,
278 Type_Time = 9,
279 Type_Timestamp = 10,
280 Type_Interval = 11,
281 Type_List = 12,
282 Type_Struct_ = 13,
283 Type_Union = 14,
284 Type_FixedSizeBinary = 15,
285 Type_FixedSizeList = 16,
286 Type_Map = 17,
287 Type_Duration = 18,
288 Type_LargeBinary = 19,
289 Type_LargeUtf8 = 20,
290 Type_LargeList = 21,
291 Type_MIN = Type_NONE,
292 Type_MAX = Type_LargeList
293};
294
295inline const Type (&EnumValuesType())[22] {
296 static const Type values[] = {
297 Type_NONE,
298 Type_Null,
299 Type_Int,
300 Type_FloatingPoint,
301 Type_Binary,
302 Type_Utf8,
303 Type_Bool,
304 Type_Decimal,
305 Type_Date,
306 Type_Time,
307 Type_Timestamp,
308 Type_Interval,
309 Type_List,
310 Type_Struct_,
311 Type_Union,
312 Type_FixedSizeBinary,
313 Type_FixedSizeList,
314 Type_Map,
315 Type_Duration,
316 Type_LargeBinary,
317 Type_LargeUtf8,
318 Type_LargeList
319 };
320 return values;
321}
322
323inline const char * const *EnumNamesType() {
324 static const char * const names[] = {
325 "NONE",
326 "Null",
327 "Int",
328 "FloatingPoint",
329 "Binary",
330 "Utf8",
331 "Bool",
332 "Decimal",
333 "Date",
334 "Time",
335 "Timestamp",
336 "Interval",
337 "List",
338 "Struct_",
339 "Union",
340 "FixedSizeBinary",
341 "FixedSizeList",
342 "Map",
343 "Duration",
344 "LargeBinary",
345 "LargeUtf8",
346 "LargeList",
347 nullptr
348 };
349 return names;
350}
351
352inline const char *EnumNameType(Type e) {
353 if (e < Type_NONE || e > Type_LargeList) return "";
354 const size_t index = static_cast<size_t>(e);
355 return EnumNamesType()[index];
356}
357
358template<typename T> struct TypeTraits {
359 static const Type enum_value = Type_NONE;
360};
361
362template<> struct TypeTraits<Null> {
363 static const Type enum_value = Type_Null;
364};
365
366template<> struct TypeTraits<Int> {
367 static const Type enum_value = Type_Int;
368};
369
370template<> struct TypeTraits<FloatingPoint> {
371 static const Type enum_value = Type_FloatingPoint;
372};
373
374template<> struct TypeTraits<Binary> {
375 static const Type enum_value = Type_Binary;
376};
377
378template<> struct TypeTraits<Utf8> {
379 static const Type enum_value = Type_Utf8;
380};
381
382template<> struct TypeTraits<Bool> {
383 static const Type enum_value = Type_Bool;
384};
385
386template<> struct TypeTraits<Decimal> {
387 static const Type enum_value = Type_Decimal;
388};
389
390template<> struct TypeTraits<Date> {
391 static const Type enum_value = Type_Date;
392};
393
394template<> struct TypeTraits<Time> {
395 static const Type enum_value = Type_Time;
396};
397
398template<> struct TypeTraits<Timestamp> {
399 static const Type enum_value = Type_Timestamp;
400};
401
402template<> struct TypeTraits<Interval> {
403 static const Type enum_value = Type_Interval;
404};
405
406template<> struct TypeTraits<List> {
407 static const Type enum_value = Type_List;
408};
409
410template<> struct TypeTraits<Struct_> {
411 static const Type enum_value = Type_Struct_;
412};
413
414template<> struct TypeTraits<Union> {
415 static const Type enum_value = Type_Union;
416};
417
418template<> struct TypeTraits<FixedSizeBinary> {
419 static const Type enum_value = Type_FixedSizeBinary;
420};
421
422template<> struct TypeTraits<FixedSizeList> {
423 static const Type enum_value = Type_FixedSizeList;
424};
425
426template<> struct TypeTraits<Map> {
427 static const Type enum_value = Type_Map;
428};
429
430template<> struct TypeTraits<Duration> {
431 static const Type enum_value = Type_Duration;
432};
433
434template<> struct TypeTraits<LargeBinary> {
435 static const Type enum_value = Type_LargeBinary;
436};
437
438template<> struct TypeTraits<LargeUtf8> {
439 static const Type enum_value = Type_LargeUtf8;
440};
441
442template<> struct TypeTraits<LargeList> {
443 static const Type enum_value = Type_LargeList;
444};
445
446bool VerifyType(flatbuffers::Verifier &verifier, const void *obj, Type type);
447bool VerifyTypeVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
448
449/// ----------------------------------------------------------------------
450/// Endianness of the platform producing the data
451enum Endianness {
452 Endianness_Little = 0,
453 Endianness_Big = 1,
454 Endianness_MIN = Endianness_Little,
455 Endianness_MAX = Endianness_Big
456};
457
458inline const Endianness (&EnumValuesEndianness())[2] {
459 static const Endianness values[] = {
460 Endianness_Little,
461 Endianness_Big
462 };
463 return values;
464}
465
466inline const char * const *EnumNamesEndianness() {
467 static const char * const names[] = {
468 "Little",
469 "Big",
470 nullptr
471 };
472 return names;
473}
474
475inline const char *EnumNameEndianness(Endianness e) {
476 if (e < Endianness_Little || e > Endianness_Big) return "";
477 const size_t index = static_cast<size_t>(e);
478 return EnumNamesEndianness()[index];
479}
480
481/// ----------------------------------------------------------------------
482/// A Buffer represents a single contiguous memory segment
483FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Buffer FLATBUFFERS_FINAL_CLASS {
484 private:
485 int64_t offset_;
486 int64_t length_;
487
488 public:
489 Buffer() {
490 memset(static_cast<void *>(this), 0, sizeof(Buffer));
491 }
492 Buffer(int64_t _offset, int64_t _length)
493 : offset_(flatbuffers::EndianScalar(_offset)),
494 length_(flatbuffers::EndianScalar(_length)) {
495 }
496 /// The relative offset into the shared memory page where the bytes for this
497 /// buffer starts
498 int64_t offset() const {
499 return flatbuffers::EndianScalar(offset_);
500 }
501 /// The absolute length (in bytes) of the memory buffer. The memory is found
502 /// from offset (inclusive) to offset + length (non-inclusive).
503 int64_t length() const {
504 return flatbuffers::EndianScalar(length_);
505 }
506};
507FLATBUFFERS_STRUCT_END(Buffer, 16);
508
509/// These are stored in the flatbuffer in the Type union below
510struct Null FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
511 bool Verify(flatbuffers::Verifier &verifier) const {
512 return VerifyTableStart(verifier) &&
513 verifier.EndTable();
514 }
515};
516
517struct NullBuilder {
518 flatbuffers::FlatBufferBuilder &fbb_;
519 flatbuffers::uoffset_t start_;
520 explicit NullBuilder(flatbuffers::FlatBufferBuilder &_fbb)
521 : fbb_(_fbb) {
522 start_ = fbb_.StartTable();
523 }
524 NullBuilder &operator=(const NullBuilder &);
525 flatbuffers::Offset<Null> Finish() {
526 const auto end = fbb_.EndTable(start_);
527 auto o = flatbuffers::Offset<Null>(end);
528 return o;
529 }
530};
531
532inline flatbuffers::Offset<Null> CreateNull(
533 flatbuffers::FlatBufferBuilder &_fbb) {
534 NullBuilder builder_(_fbb);
535 return builder_.Finish();
536}
537
538/// A Struct_ in the flatbuffer metadata is the same as an Arrow Struct
539/// (according to the physical memory layout). We used Struct_ here as
540/// Struct is a reserved word in Flatbuffers
541struct Struct_ FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
542 bool Verify(flatbuffers::Verifier &verifier) const {
543 return VerifyTableStart(verifier) &&
544 verifier.EndTable();
545 }
546};
547
548struct Struct_Builder {
549 flatbuffers::FlatBufferBuilder &fbb_;
550 flatbuffers::uoffset_t start_;
551 explicit Struct_Builder(flatbuffers::FlatBufferBuilder &_fbb)
552 : fbb_(_fbb) {
553 start_ = fbb_.StartTable();
554 }
555 Struct_Builder &operator=(const Struct_Builder &);
556 flatbuffers::Offset<Struct_> Finish() {
557 const auto end = fbb_.EndTable(start_);
558 auto o = flatbuffers::Offset<Struct_>(end);
559 return o;
560 }
561};
562
563inline flatbuffers::Offset<Struct_> CreateStruct_(
564 flatbuffers::FlatBufferBuilder &_fbb) {
565 Struct_Builder builder_(_fbb);
566 return builder_.Finish();
567}
568
569struct List FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
570 bool Verify(flatbuffers::Verifier &verifier) const {
571 return VerifyTableStart(verifier) &&
572 verifier.EndTable();
573 }
574};
575
576struct ListBuilder {
577 flatbuffers::FlatBufferBuilder &fbb_;
578 flatbuffers::uoffset_t start_;
579 explicit ListBuilder(flatbuffers::FlatBufferBuilder &_fbb)
580 : fbb_(_fbb) {
581 start_ = fbb_.StartTable();
582 }
583 ListBuilder &operator=(const ListBuilder &);
584 flatbuffers::Offset<List> Finish() {
585 const auto end = fbb_.EndTable(start_);
586 auto o = flatbuffers::Offset<List>(end);
587 return o;
588 }
589};
590
591inline flatbuffers::Offset<List> CreateList(
592 flatbuffers::FlatBufferBuilder &_fbb) {
593 ListBuilder builder_(_fbb);
594 return builder_.Finish();
595}
596
597/// Same as List, but with 64-bit offsets, allowing to represent
598/// extremely large data values.
599struct LargeList FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
600 bool Verify(flatbuffers::Verifier &verifier) const {
601 return VerifyTableStart(verifier) &&
602 verifier.EndTable();
603 }
604};
605
606struct LargeListBuilder {
607 flatbuffers::FlatBufferBuilder &fbb_;
608 flatbuffers::uoffset_t start_;
609 explicit LargeListBuilder(flatbuffers::FlatBufferBuilder &_fbb)
610 : fbb_(_fbb) {
611 start_ = fbb_.StartTable();
612 }
613 LargeListBuilder &operator=(const LargeListBuilder &);
614 flatbuffers::Offset<LargeList> Finish() {
615 const auto end = fbb_.EndTable(start_);
616 auto o = flatbuffers::Offset<LargeList>(end);
617 return o;
618 }
619};
620
621inline flatbuffers::Offset<LargeList> CreateLargeList(
622 flatbuffers::FlatBufferBuilder &_fbb) {
623 LargeListBuilder builder_(_fbb);
624 return builder_.Finish();
625}
626
627struct FixedSizeList FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
628 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
629 VT_LISTSIZE = 4
630 };
631 /// Number of list items per value
632 int32_t listSize() const {
633 return GetField<int32_t>(VT_LISTSIZE, 0);
634 }
635 bool Verify(flatbuffers::Verifier &verifier) const {
636 return VerifyTableStart(verifier) &&
637 VerifyField<int32_t>(verifier, VT_LISTSIZE) &&
638 verifier.EndTable();
639 }
640};
641
642struct FixedSizeListBuilder {
643 flatbuffers::FlatBufferBuilder &fbb_;
644 flatbuffers::uoffset_t start_;
645 void add_listSize(int32_t listSize) {
646 fbb_.AddElement<int32_t>(FixedSizeList::VT_LISTSIZE, listSize, 0);
647 }
648 explicit FixedSizeListBuilder(flatbuffers::FlatBufferBuilder &_fbb)
649 : fbb_(_fbb) {
650 start_ = fbb_.StartTable();
651 }
652 FixedSizeListBuilder &operator=(const FixedSizeListBuilder &);
653 flatbuffers::Offset<FixedSizeList> Finish() {
654 const auto end = fbb_.EndTable(start_);
655 auto o = flatbuffers::Offset<FixedSizeList>(end);
656 return o;
657 }
658};
659
660inline flatbuffers::Offset<FixedSizeList> CreateFixedSizeList(
661 flatbuffers::FlatBufferBuilder &_fbb,
662 int32_t listSize = 0) {
663 FixedSizeListBuilder builder_(_fbb);
664 builder_.add_listSize(listSize);
665 return builder_.Finish();
666}
667
668/// A Map is a logical nested type that is represented as
669///
670/// List<entry: Struct<key: K, value: V>>
671///
672/// In this layout, the keys and values are each respectively contiguous. We do
673/// not constrain the key and value types, so the application is responsible
674/// for ensuring that the keys are hashable and unique. Whether the keys are sorted
675/// may be set in the metadata for this field
676///
677/// In a Field with Map type, the Field has a child Struct field, which then
678/// has two children: key type and the second the value type. The names of the
679/// child fields may be respectively "entry", "key", and "value", but this is
680/// not enforced
681///
682/// Map
683/// - child[0] entry: Struct
684/// - child[0] key: K
685/// - child[1] value: V
686///
687/// Neither the "entry" field nor the "key" field may be nullable.
688///
689/// The metadata is structured so that Arrow systems without special handling
690/// for Map can make Map an alias for List. The "layout" attribute for the Map
691/// field must have the same contents as a List.
692struct Map FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
693 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
694 VT_KEYSSORTED = 4
695 };
696 /// Set to true if the keys within each value are sorted
697 bool keysSorted() const {
698 return GetField<uint8_t>(VT_KEYSSORTED, 0) != 0;
699 }
700 bool Verify(flatbuffers::Verifier &verifier) const {
701 return VerifyTableStart(verifier) &&
702 VerifyField<uint8_t>(verifier, VT_KEYSSORTED) &&
703 verifier.EndTable();
704 }
705};
706
707struct MapBuilder {
708 flatbuffers::FlatBufferBuilder &fbb_;
709 flatbuffers::uoffset_t start_;
710 void add_keysSorted(bool keysSorted) {
711 fbb_.AddElement<uint8_t>(Map::VT_KEYSSORTED, static_cast<uint8_t>(keysSorted), 0);
712 }
713 explicit MapBuilder(flatbuffers::FlatBufferBuilder &_fbb)
714 : fbb_(_fbb) {
715 start_ = fbb_.StartTable();
716 }
717 MapBuilder &operator=(const MapBuilder &);
718 flatbuffers::Offset<Map> Finish() {
719 const auto end = fbb_.EndTable(start_);
720 auto o = flatbuffers::Offset<Map>(end);
721 return o;
722 }
723};
724
725inline flatbuffers::Offset<Map> CreateMap(
726 flatbuffers::FlatBufferBuilder &_fbb,
727 bool keysSorted = false) {
728 MapBuilder builder_(_fbb);
729 builder_.add_keysSorted(keysSorted);
730 return builder_.Finish();
731}
732
733/// A union is a complex type with children in Field
734/// By default ids in the type vector refer to the offsets in the children
735/// optionally typeIds provides an indirection between the child offset and the type id
736/// for each child typeIds[offset] is the id used in the type vector
737struct Union FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
738 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
739 VT_MODE = 4,
740 VT_TYPEIDS = 6
741 };
742 UnionMode mode() const {
743 return static_cast<UnionMode>(GetField<int16_t>(VT_MODE, 0));
744 }
745 const flatbuffers::Vector<int32_t> *typeIds() const {
746 return GetPointer<const flatbuffers::Vector<int32_t> *>(VT_TYPEIDS);
747 }
748 bool Verify(flatbuffers::Verifier &verifier) const {
749 return VerifyTableStart(verifier) &&
750 VerifyField<int16_t>(verifier, VT_MODE) &&
751 VerifyOffset(verifier, VT_TYPEIDS) &&
752 verifier.VerifyVector(typeIds()) &&
753 verifier.EndTable();
754 }
755};
756
757struct UnionBuilder {
758 flatbuffers::FlatBufferBuilder &fbb_;
759 flatbuffers::uoffset_t start_;
760 void add_mode(UnionMode mode) {
761 fbb_.AddElement<int16_t>(Union::VT_MODE, static_cast<int16_t>(mode), 0);
762 }
763 void add_typeIds(flatbuffers::Offset<flatbuffers::Vector<int32_t>> typeIds) {
764 fbb_.AddOffset(Union::VT_TYPEIDS, typeIds);
765 }
766 explicit UnionBuilder(flatbuffers::FlatBufferBuilder &_fbb)
767 : fbb_(_fbb) {
768 start_ = fbb_.StartTable();
769 }
770 UnionBuilder &operator=(const UnionBuilder &);
771 flatbuffers::Offset<Union> Finish() {
772 const auto end = fbb_.EndTable(start_);
773 auto o = flatbuffers::Offset<Union>(end);
774 return o;
775 }
776};
777
778inline flatbuffers::Offset<Union> CreateUnion(
779 flatbuffers::FlatBufferBuilder &_fbb,
780 UnionMode mode = UnionMode_Sparse,
781 flatbuffers::Offset<flatbuffers::Vector<int32_t>> typeIds = 0) {
782 UnionBuilder builder_(_fbb);
783 builder_.add_typeIds(typeIds);
784 builder_.add_mode(mode);
785 return builder_.Finish();
786}
787
788inline flatbuffers::Offset<Union> CreateUnionDirect(
789 flatbuffers::FlatBufferBuilder &_fbb,
790 UnionMode mode = UnionMode_Sparse,
791 const std::vector<int32_t> *typeIds = nullptr) {
792 auto typeIds__ = typeIds ? _fbb.CreateVector<int32_t>(*typeIds) : 0;
793 return org::apache::arrow::flatbuf::CreateUnion(
794 _fbb,
795 mode,
796 typeIds__);
797}
798
799struct Int FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
800 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
801 VT_BITWIDTH = 4,
802 VT_IS_SIGNED = 6
803 };
804 int32_t bitWidth() const {
805 return GetField<int32_t>(VT_BITWIDTH, 0);
806 }
807 bool is_signed() const {
808 return GetField<uint8_t>(VT_IS_SIGNED, 0) != 0;
809 }
810 bool Verify(flatbuffers::Verifier &verifier) const {
811 return VerifyTableStart(verifier) &&
812 VerifyField<int32_t>(verifier, VT_BITWIDTH) &&
813 VerifyField<uint8_t>(verifier, VT_IS_SIGNED) &&
814 verifier.EndTable();
815 }
816};
817
818struct IntBuilder {
819 flatbuffers::FlatBufferBuilder &fbb_;
820 flatbuffers::uoffset_t start_;
821 void add_bitWidth(int32_t bitWidth) {
822 fbb_.AddElement<int32_t>(Int::VT_BITWIDTH, bitWidth, 0);
823 }
824 void add_is_signed(bool is_signed) {
825 fbb_.AddElement<uint8_t>(Int::VT_IS_SIGNED, static_cast<uint8_t>(is_signed), 0);
826 }
827 explicit IntBuilder(flatbuffers::FlatBufferBuilder &_fbb)
828 : fbb_(_fbb) {
829 start_ = fbb_.StartTable();
830 }
831 IntBuilder &operator=(const IntBuilder &);
832 flatbuffers::Offset<Int> Finish() {
833 const auto end = fbb_.EndTable(start_);
834 auto o = flatbuffers::Offset<Int>(end);
835 return o;
836 }
837};
838
839inline flatbuffers::Offset<Int> CreateInt(
840 flatbuffers::FlatBufferBuilder &_fbb,
841 int32_t bitWidth = 0,
842 bool is_signed = false) {
843 IntBuilder builder_(_fbb);
844 builder_.add_bitWidth(bitWidth);
845 builder_.add_is_signed(is_signed);
846 return builder_.Finish();
847}
848
849struct FloatingPoint FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
850 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
851 VT_PRECISION = 4
852 };
853 Precision precision() const {
854 return static_cast<Precision>(GetField<int16_t>(VT_PRECISION, 0));
855 }
856 bool Verify(flatbuffers::Verifier &verifier) const {
857 return VerifyTableStart(verifier) &&
858 VerifyField<int16_t>(verifier, VT_PRECISION) &&
859 verifier.EndTable();
860 }
861};
862
863struct FloatingPointBuilder {
864 flatbuffers::FlatBufferBuilder &fbb_;
865 flatbuffers::uoffset_t start_;
866 void add_precision(Precision precision) {
867 fbb_.AddElement<int16_t>(FloatingPoint::VT_PRECISION, static_cast<int16_t>(precision), 0);
868 }
869 explicit FloatingPointBuilder(flatbuffers::FlatBufferBuilder &_fbb)
870 : fbb_(_fbb) {
871 start_ = fbb_.StartTable();
872 }
873 FloatingPointBuilder &operator=(const FloatingPointBuilder &);
874 flatbuffers::Offset<FloatingPoint> Finish() {
875 const auto end = fbb_.EndTable(start_);
876 auto o = flatbuffers::Offset<FloatingPoint>(end);
877 return o;
878 }
879};
880
881inline flatbuffers::Offset<FloatingPoint> CreateFloatingPoint(
882 flatbuffers::FlatBufferBuilder &_fbb,
883 Precision precision = Precision_HALF) {
884 FloatingPointBuilder builder_(_fbb);
885 builder_.add_precision(precision);
886 return builder_.Finish();
887}
888
889/// Unicode with UTF-8 encoding
890struct Utf8 FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
891 bool Verify(flatbuffers::Verifier &verifier) const {
892 return VerifyTableStart(verifier) &&
893 verifier.EndTable();
894 }
895};
896
897struct Utf8Builder {
898 flatbuffers::FlatBufferBuilder &fbb_;
899 flatbuffers::uoffset_t start_;
900 explicit Utf8Builder(flatbuffers::FlatBufferBuilder &_fbb)
901 : fbb_(_fbb) {
902 start_ = fbb_.StartTable();
903 }
904 Utf8Builder &operator=(const Utf8Builder &);
905 flatbuffers::Offset<Utf8> Finish() {
906 const auto end = fbb_.EndTable(start_);
907 auto o = flatbuffers::Offset<Utf8>(end);
908 return o;
909 }
910};
911
912inline flatbuffers::Offset<Utf8> CreateUtf8(
913 flatbuffers::FlatBufferBuilder &_fbb) {
914 Utf8Builder builder_(_fbb);
915 return builder_.Finish();
916}
917
918/// Opaque binary data
919struct Binary FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
920 bool Verify(flatbuffers::Verifier &verifier) const {
921 return VerifyTableStart(verifier) &&
922 verifier.EndTable();
923 }
924};
925
926struct BinaryBuilder {
927 flatbuffers::FlatBufferBuilder &fbb_;
928 flatbuffers::uoffset_t start_;
929 explicit BinaryBuilder(flatbuffers::FlatBufferBuilder &_fbb)
930 : fbb_(_fbb) {
931 start_ = fbb_.StartTable();
932 }
933 BinaryBuilder &operator=(const BinaryBuilder &);
934 flatbuffers::Offset<Binary> Finish() {
935 const auto end = fbb_.EndTable(start_);
936 auto o = flatbuffers::Offset<Binary>(end);
937 return o;
938 }
939};
940
941inline flatbuffers::Offset<Binary> CreateBinary(
942 flatbuffers::FlatBufferBuilder &_fbb) {
943 BinaryBuilder builder_(_fbb);
944 return builder_.Finish();
945}
946
947/// Same as Utf8, but with 64-bit offsets, allowing to represent
948/// extremely large data values.
949struct LargeUtf8 FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
950 bool Verify(flatbuffers::Verifier &verifier) const {
951 return VerifyTableStart(verifier) &&
952 verifier.EndTable();
953 }
954};
955
956struct LargeUtf8Builder {
957 flatbuffers::FlatBufferBuilder &fbb_;
958 flatbuffers::uoffset_t start_;
959 explicit LargeUtf8Builder(flatbuffers::FlatBufferBuilder &_fbb)
960 : fbb_(_fbb) {
961 start_ = fbb_.StartTable();
962 }
963 LargeUtf8Builder &operator=(const LargeUtf8Builder &);
964 flatbuffers::Offset<LargeUtf8> Finish() {
965 const auto end = fbb_.EndTable(start_);
966 auto o = flatbuffers::Offset<LargeUtf8>(end);
967 return o;
968 }
969};
970
971inline flatbuffers::Offset<LargeUtf8> CreateLargeUtf8(
972 flatbuffers::FlatBufferBuilder &_fbb) {
973 LargeUtf8Builder builder_(_fbb);
974 return builder_.Finish();
975}
976
977/// Same as Binary, but with 64-bit offsets, allowing to represent
978/// extremely large data values.
979struct LargeBinary FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
980 bool Verify(flatbuffers::Verifier &verifier) const {
981 return VerifyTableStart(verifier) &&
982 verifier.EndTable();
983 }
984};
985
986struct LargeBinaryBuilder {
987 flatbuffers::FlatBufferBuilder &fbb_;
988 flatbuffers::uoffset_t start_;
989 explicit LargeBinaryBuilder(flatbuffers::FlatBufferBuilder &_fbb)
990 : fbb_(_fbb) {
991 start_ = fbb_.StartTable();
992 }
993 LargeBinaryBuilder &operator=(const LargeBinaryBuilder &);
994 flatbuffers::Offset<LargeBinary> Finish() {
995 const auto end = fbb_.EndTable(start_);
996 auto o = flatbuffers::Offset<LargeBinary>(end);
997 return o;
998 }
999};
1000
1001inline flatbuffers::Offset<LargeBinary> CreateLargeBinary(
1002 flatbuffers::FlatBufferBuilder &_fbb) {
1003 LargeBinaryBuilder builder_(_fbb);
1004 return builder_.Finish();
1005}
1006
1007struct FixedSizeBinary FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1008 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1009 VT_BYTEWIDTH = 4
1010 };
1011 /// Number of bytes per value
1012 int32_t byteWidth() const {
1013 return GetField<int32_t>(VT_BYTEWIDTH, 0);
1014 }
1015 bool Verify(flatbuffers::Verifier &verifier) const {
1016 return VerifyTableStart(verifier) &&
1017 VerifyField<int32_t>(verifier, VT_BYTEWIDTH) &&
1018 verifier.EndTable();
1019 }
1020};
1021
1022struct FixedSizeBinaryBuilder {
1023 flatbuffers::FlatBufferBuilder &fbb_;
1024 flatbuffers::uoffset_t start_;
1025 void add_byteWidth(int32_t byteWidth) {
1026 fbb_.AddElement<int32_t>(FixedSizeBinary::VT_BYTEWIDTH, byteWidth, 0);
1027 }
1028 explicit FixedSizeBinaryBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1029 : fbb_(_fbb) {
1030 start_ = fbb_.StartTable();
1031 }
1032 FixedSizeBinaryBuilder &operator=(const FixedSizeBinaryBuilder &);
1033 flatbuffers::Offset<FixedSizeBinary> Finish() {
1034 const auto end = fbb_.EndTable(start_);
1035 auto o = flatbuffers::Offset<FixedSizeBinary>(end);
1036 return o;
1037 }
1038};
1039
1040inline flatbuffers::Offset<FixedSizeBinary> CreateFixedSizeBinary(
1041 flatbuffers::FlatBufferBuilder &_fbb,
1042 int32_t byteWidth = 0) {
1043 FixedSizeBinaryBuilder builder_(_fbb);
1044 builder_.add_byteWidth(byteWidth);
1045 return builder_.Finish();
1046}
1047
1048struct Bool FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1049 bool Verify(flatbuffers::Verifier &verifier) const {
1050 return VerifyTableStart(verifier) &&
1051 verifier.EndTable();
1052 }
1053};
1054
1055struct BoolBuilder {
1056 flatbuffers::FlatBufferBuilder &fbb_;
1057 flatbuffers::uoffset_t start_;
1058 explicit BoolBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1059 : fbb_(_fbb) {
1060 start_ = fbb_.StartTable();
1061 }
1062 BoolBuilder &operator=(const BoolBuilder &);
1063 flatbuffers::Offset<Bool> Finish() {
1064 const auto end = fbb_.EndTable(start_);
1065 auto o = flatbuffers::Offset<Bool>(end);
1066 return o;
1067 }
1068};
1069
1070inline flatbuffers::Offset<Bool> CreateBool(
1071 flatbuffers::FlatBufferBuilder &_fbb) {
1072 BoolBuilder builder_(_fbb);
1073 return builder_.Finish();
1074}
1075
1076struct Decimal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1077 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1078 VT_PRECISION = 4,
1079 VT_SCALE = 6
1080 };
1081 /// Total number of decimal digits
1082 int32_t precision() const {
1083 return GetField<int32_t>(VT_PRECISION, 0);
1084 }
1085 /// Number of digits after the decimal point "."
1086 int32_t scale() const {
1087 return GetField<int32_t>(VT_SCALE, 0);
1088 }
1089 bool Verify(flatbuffers::Verifier &verifier) const {
1090 return VerifyTableStart(verifier) &&
1091 VerifyField<int32_t>(verifier, VT_PRECISION) &&
1092 VerifyField<int32_t>(verifier, VT_SCALE) &&
1093 verifier.EndTable();
1094 }
1095};
1096
1097struct DecimalBuilder {
1098 flatbuffers::FlatBufferBuilder &fbb_;
1099 flatbuffers::uoffset_t start_;
1100 void add_precision(int32_t precision) {
1101 fbb_.AddElement<int32_t>(Decimal::VT_PRECISION, precision, 0);
1102 }
1103 void add_scale(int32_t scale) {
1104 fbb_.AddElement<int32_t>(Decimal::VT_SCALE, scale, 0);
1105 }
1106 explicit DecimalBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1107 : fbb_(_fbb) {
1108 start_ = fbb_.StartTable();
1109 }
1110 DecimalBuilder &operator=(const DecimalBuilder &);
1111 flatbuffers::Offset<Decimal> Finish() {
1112 const auto end = fbb_.EndTable(start_);
1113 auto o = flatbuffers::Offset<Decimal>(end);
1114 return o;
1115 }
1116};
1117
1118inline flatbuffers::Offset<Decimal> CreateDecimal(
1119 flatbuffers::FlatBufferBuilder &_fbb,
1120 int32_t precision = 0,
1121 int32_t scale = 0) {
1122 DecimalBuilder builder_(_fbb);
1123 builder_.add_scale(scale);
1124 builder_.add_precision(precision);
1125 return builder_.Finish();
1126}
1127
1128/// Date is either a 32-bit or 64-bit type representing elapsed time since UNIX
1129/// epoch (1970-01-01), stored in either of two units:
1130///
1131/// * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no
1132/// leap seconds), where the values are evenly divisible by 86400000
1133/// * Days (32 bits) since the UNIX epoch
1134struct Date FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1135 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1136 VT_UNIT = 4
1137 };
1138 DateUnit unit() const {
1139 return static_cast<DateUnit>(GetField<int16_t>(VT_UNIT, 1));
1140 }
1141 bool Verify(flatbuffers::Verifier &verifier) const {
1142 return VerifyTableStart(verifier) &&
1143 VerifyField<int16_t>(verifier, VT_UNIT) &&
1144 verifier.EndTable();
1145 }
1146};
1147
1148struct DateBuilder {
1149 flatbuffers::FlatBufferBuilder &fbb_;
1150 flatbuffers::uoffset_t start_;
1151 void add_unit(DateUnit unit) {
1152 fbb_.AddElement<int16_t>(Date::VT_UNIT, static_cast<int16_t>(unit), 1);
1153 }
1154 explicit DateBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1155 : fbb_(_fbb) {
1156 start_ = fbb_.StartTable();
1157 }
1158 DateBuilder &operator=(const DateBuilder &);
1159 flatbuffers::Offset<Date> Finish() {
1160 const auto end = fbb_.EndTable(start_);
1161 auto o = flatbuffers::Offset<Date>(end);
1162 return o;
1163 }
1164};
1165
1166inline flatbuffers::Offset<Date> CreateDate(
1167 flatbuffers::FlatBufferBuilder &_fbb,
1168 DateUnit unit = DateUnit_MILLISECOND) {
1169 DateBuilder builder_(_fbb);
1170 builder_.add_unit(unit);
1171 return builder_.Finish();
1172}
1173
1174/// Time type. The physical storage type depends on the unit
1175/// - SECOND and MILLISECOND: 32 bits
1176/// - MICROSECOND and NANOSECOND: 64 bits
1177struct Time FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1178 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1179 VT_UNIT = 4,
1180 VT_BITWIDTH = 6
1181 };
1182 TimeUnit unit() const {
1183 return static_cast<TimeUnit>(GetField<int16_t>(VT_UNIT, 1));
1184 }
1185 int32_t bitWidth() const {
1186 return GetField<int32_t>(VT_BITWIDTH, 32);
1187 }
1188 bool Verify(flatbuffers::Verifier &verifier) const {
1189 return VerifyTableStart(verifier) &&
1190 VerifyField<int16_t>(verifier, VT_UNIT) &&
1191 VerifyField<int32_t>(verifier, VT_BITWIDTH) &&
1192 verifier.EndTable();
1193 }
1194};
1195
1196struct TimeBuilder {
1197 flatbuffers::FlatBufferBuilder &fbb_;
1198 flatbuffers::uoffset_t start_;
1199 void add_unit(TimeUnit unit) {
1200 fbb_.AddElement<int16_t>(Time::VT_UNIT, static_cast<int16_t>(unit), 1);
1201 }
1202 void add_bitWidth(int32_t bitWidth) {
1203 fbb_.AddElement<int32_t>(Time::VT_BITWIDTH, bitWidth, 32);
1204 }
1205 explicit TimeBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1206 : fbb_(_fbb) {
1207 start_ = fbb_.StartTable();
1208 }
1209 TimeBuilder &operator=(const TimeBuilder &);
1210 flatbuffers::Offset<Time> Finish() {
1211 const auto end = fbb_.EndTable(start_);
1212 auto o = flatbuffers::Offset<Time>(end);
1213 return o;
1214 }
1215};
1216
1217inline flatbuffers::Offset<Time> CreateTime(
1218 flatbuffers::FlatBufferBuilder &_fbb,
1219 TimeUnit unit = TimeUnit_MILLISECOND,
1220 int32_t bitWidth = 32) {
1221 TimeBuilder builder_(_fbb);
1222 builder_.add_bitWidth(bitWidth);
1223 builder_.add_unit(unit);
1224 return builder_.Finish();
1225}
1226
1227/// Time elapsed from the Unix epoch, 00:00:00.000 on 1 January 1970, excluding
1228/// leap seconds, as a 64-bit integer. Note that UNIX time does not include
1229/// leap seconds.
1230///
1231/// The Timestamp metadata supports both "time zone naive" and "time zone
1232/// aware" timestamps. Read about the timezone attribute for more detail
1233struct Timestamp FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1234 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1235 VT_UNIT = 4,
1236 VT_TIMEZONE = 6
1237 };
1238 TimeUnit unit() const {
1239 return static_cast<TimeUnit>(GetField<int16_t>(VT_UNIT, 0));
1240 }
1241 /// The time zone is a string indicating the name of a time zone, one of:
1242 ///
1243 /// * As used in the Olson time zone database (the "tz database" or
1244 /// "tzdata"), such as "America/New_York"
1245 /// * An absolute time zone offset of the form +XX:XX or -XX:XX, such as +07:30
1246 ///
1247 /// Whether a timezone string is present indicates different semantics about
1248 /// the data:
1249 ///
1250 /// * If the time zone is null or equal to an empty string, the data is "time
1251 /// zone naive" and shall be displayed *as is* to the user, not localized
1252 /// to the locale of the user. This data can be though of as UTC but
1253 /// without having "UTC" as the time zone, it is not considered to be
1254 /// localized to any time zone
1255 ///
1256 /// * If the time zone is set to a valid value, values can be displayed as
1257 /// "localized" to that time zone, even though the underlying 64-bit
1258 /// integers are identical to the same data stored in UTC. Converting
1259 /// between time zones is a metadata-only operation and does not change the
1260 /// underlying values
1261 const flatbuffers::String *timezone() const {
1262 return GetPointer<const flatbuffers::String *>(VT_TIMEZONE);
1263 }
1264 bool Verify(flatbuffers::Verifier &verifier) const {
1265 return VerifyTableStart(verifier) &&
1266 VerifyField<int16_t>(verifier, VT_UNIT) &&
1267 VerifyOffset(verifier, VT_TIMEZONE) &&
1268 verifier.VerifyString(timezone()) &&
1269 verifier.EndTable();
1270 }
1271};
1272
1273struct TimestampBuilder {
1274 flatbuffers::FlatBufferBuilder &fbb_;
1275 flatbuffers::uoffset_t start_;
1276 void add_unit(TimeUnit unit) {
1277 fbb_.AddElement<int16_t>(Timestamp::VT_UNIT, static_cast<int16_t>(unit), 0);
1278 }
1279 void add_timezone(flatbuffers::Offset<flatbuffers::String> timezone) {
1280 fbb_.AddOffset(Timestamp::VT_TIMEZONE, timezone);
1281 }
1282 explicit TimestampBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1283 : fbb_(_fbb) {
1284 start_ = fbb_.StartTable();
1285 }
1286 TimestampBuilder &operator=(const TimestampBuilder &);
1287 flatbuffers::Offset<Timestamp> Finish() {
1288 const auto end = fbb_.EndTable(start_);
1289 auto o = flatbuffers::Offset<Timestamp>(end);
1290 return o;
1291 }
1292};
1293
1294inline flatbuffers::Offset<Timestamp> CreateTimestamp(
1295 flatbuffers::FlatBufferBuilder &_fbb,
1296 TimeUnit unit = TimeUnit_SECOND,
1297 flatbuffers::Offset<flatbuffers::String> timezone = 0) {
1298 TimestampBuilder builder_(_fbb);
1299 builder_.add_timezone(timezone);
1300 builder_.add_unit(unit);
1301 return builder_.Finish();
1302}
1303
1304inline flatbuffers::Offset<Timestamp> CreateTimestampDirect(
1305 flatbuffers::FlatBufferBuilder &_fbb,
1306 TimeUnit unit = TimeUnit_SECOND,
1307 const char *timezone = nullptr) {
1308 auto timezone__ = timezone ? _fbb.CreateString(timezone) : 0;
1309 return org::apache::arrow::flatbuf::CreateTimestamp(
1310 _fbb,
1311 unit,
1312 timezone__);
1313}
1314
1315struct Interval FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1316 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1317 VT_UNIT = 4
1318 };
1319 IntervalUnit unit() const {
1320 return static_cast<IntervalUnit>(GetField<int16_t>(VT_UNIT, 0));
1321 }
1322 bool Verify(flatbuffers::Verifier &verifier) const {
1323 return VerifyTableStart(verifier) &&
1324 VerifyField<int16_t>(verifier, VT_UNIT) &&
1325 verifier.EndTable();
1326 }
1327};
1328
1329struct IntervalBuilder {
1330 flatbuffers::FlatBufferBuilder &fbb_;
1331 flatbuffers::uoffset_t start_;
1332 void add_unit(IntervalUnit unit) {
1333 fbb_.AddElement<int16_t>(Interval::VT_UNIT, static_cast<int16_t>(unit), 0);
1334 }
1335 explicit IntervalBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1336 : fbb_(_fbb) {
1337 start_ = fbb_.StartTable();
1338 }
1339 IntervalBuilder &operator=(const IntervalBuilder &);
1340 flatbuffers::Offset<Interval> Finish() {
1341 const auto end = fbb_.EndTable(start_);
1342 auto o = flatbuffers::Offset<Interval>(end);
1343 return o;
1344 }
1345};
1346
1347inline flatbuffers::Offset<Interval> CreateInterval(
1348 flatbuffers::FlatBufferBuilder &_fbb,
1349 IntervalUnit unit = IntervalUnit_YEAR_MONTH) {
1350 IntervalBuilder builder_(_fbb);
1351 builder_.add_unit(unit);
1352 return builder_.Finish();
1353}
1354
1355struct Duration FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1356 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1357 VT_UNIT = 4
1358 };
1359 TimeUnit unit() const {
1360 return static_cast<TimeUnit>(GetField<int16_t>(VT_UNIT, 1));
1361 }
1362 bool Verify(flatbuffers::Verifier &verifier) const {
1363 return VerifyTableStart(verifier) &&
1364 VerifyField<int16_t>(verifier, VT_UNIT) &&
1365 verifier.EndTable();
1366 }
1367};
1368
1369struct DurationBuilder {
1370 flatbuffers::FlatBufferBuilder &fbb_;
1371 flatbuffers::uoffset_t start_;
1372 void add_unit(TimeUnit unit) {
1373 fbb_.AddElement<int16_t>(Duration::VT_UNIT, static_cast<int16_t>(unit), 1);
1374 }
1375 explicit DurationBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1376 : fbb_(_fbb) {
1377 start_ = fbb_.StartTable();
1378 }
1379 DurationBuilder &operator=(const DurationBuilder &);
1380 flatbuffers::Offset<Duration> Finish() {
1381 const auto end = fbb_.EndTable(start_);
1382 auto o = flatbuffers::Offset<Duration>(end);
1383 return o;
1384 }
1385};
1386
1387inline flatbuffers::Offset<Duration> CreateDuration(
1388 flatbuffers::FlatBufferBuilder &_fbb,
1389 TimeUnit unit = TimeUnit_MILLISECOND) {
1390 DurationBuilder builder_(_fbb);
1391 builder_.add_unit(unit);
1392 return builder_.Finish();
1393}
1394
1395/// ----------------------------------------------------------------------
1396/// user defined key value pairs to add custom metadata to arrow
1397/// key namespacing is the responsibility of the user
1398struct KeyValue FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1399 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1400 VT_KEY = 4,
1401 VT_VALUE = 6
1402 };
1403 const flatbuffers::String *key() const {
1404 return GetPointer<const flatbuffers::String *>(VT_KEY);
1405 }
1406 const flatbuffers::String *value() const {
1407 return GetPointer<const flatbuffers::String *>(VT_VALUE);
1408 }
1409 bool Verify(flatbuffers::Verifier &verifier) const {
1410 return VerifyTableStart(verifier) &&
1411 VerifyOffset(verifier, VT_KEY) &&
1412 verifier.VerifyString(key()) &&
1413 VerifyOffset(verifier, VT_VALUE) &&
1414 verifier.VerifyString(value()) &&
1415 verifier.EndTable();
1416 }
1417};
1418
1419struct KeyValueBuilder {
1420 flatbuffers::FlatBufferBuilder &fbb_;
1421 flatbuffers::uoffset_t start_;
1422 void add_key(flatbuffers::Offset<flatbuffers::String> key) {
1423 fbb_.AddOffset(KeyValue::VT_KEY, key);
1424 }
1425 void add_value(flatbuffers::Offset<flatbuffers::String> value) {
1426 fbb_.AddOffset(KeyValue::VT_VALUE, value);
1427 }
1428 explicit KeyValueBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1429 : fbb_(_fbb) {
1430 start_ = fbb_.StartTable();
1431 }
1432 KeyValueBuilder &operator=(const KeyValueBuilder &);
1433 flatbuffers::Offset<KeyValue> Finish() {
1434 const auto end = fbb_.EndTable(start_);
1435 auto o = flatbuffers::Offset<KeyValue>(end);
1436 return o;
1437 }
1438};
1439
1440inline flatbuffers::Offset<KeyValue> CreateKeyValue(
1441 flatbuffers::FlatBufferBuilder &_fbb,
1442 flatbuffers::Offset<flatbuffers::String> key = 0,
1443 flatbuffers::Offset<flatbuffers::String> value = 0) {
1444 KeyValueBuilder builder_(_fbb);
1445 builder_.add_value(value);
1446 builder_.add_key(key);
1447 return builder_.Finish();
1448}
1449
1450inline flatbuffers::Offset<KeyValue> CreateKeyValueDirect(
1451 flatbuffers::FlatBufferBuilder &_fbb,
1452 const char *key = nullptr,
1453 const char *value = nullptr) {
1454 auto key__ = key ? _fbb.CreateString(key) : 0;
1455 auto value__ = value ? _fbb.CreateString(value) : 0;
1456 return org::apache::arrow::flatbuf::CreateKeyValue(
1457 _fbb,
1458 key__,
1459 value__);
1460}
1461
1462/// ----------------------------------------------------------------------
1463/// Dictionary encoding metadata
1464struct DictionaryEncoding FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1465 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1466 VT_ID = 4,
1467 VT_INDEXTYPE = 6,
1468 VT_ISORDERED = 8
1469 };
1470 /// The known dictionary id in the application where this data is used. In
1471 /// the file or streaming formats, the dictionary ids are found in the
1472 /// DictionaryBatch messages
1473 int64_t id() const {
1474 return GetField<int64_t>(VT_ID, 0);
1475 }
1476 /// The dictionary indices are constrained to be positive integers. If this
1477 /// field is null, the indices must be signed int32
1478 const Int *indexType() const {
1479 return GetPointer<const Int *>(VT_INDEXTYPE);
1480 }
1481 /// By default, dictionaries are not ordered, or the order does not have
1482 /// semantic meaning. In some statistical, applications, dictionary-encoding
1483 /// is used to represent ordered categorical data, and we provide a way to
1484 /// preserve that metadata here
1485 bool isOrdered() const {
1486 return GetField<uint8_t>(VT_ISORDERED, 0) != 0;
1487 }
1488 bool Verify(flatbuffers::Verifier &verifier) const {
1489 return VerifyTableStart(verifier) &&
1490 VerifyField<int64_t>(verifier, VT_ID) &&
1491 VerifyOffset(verifier, VT_INDEXTYPE) &&
1492 verifier.VerifyTable(indexType()) &&
1493 VerifyField<uint8_t>(verifier, VT_ISORDERED) &&
1494 verifier.EndTable();
1495 }
1496};
1497
1498struct DictionaryEncodingBuilder {
1499 flatbuffers::FlatBufferBuilder &fbb_;
1500 flatbuffers::uoffset_t start_;
1501 void add_id(int64_t id) {
1502 fbb_.AddElement<int64_t>(DictionaryEncoding::VT_ID, id, 0);
1503 }
1504 void add_indexType(flatbuffers::Offset<Int> indexType) {
1505 fbb_.AddOffset(DictionaryEncoding::VT_INDEXTYPE, indexType);
1506 }
1507 void add_isOrdered(bool isOrdered) {
1508 fbb_.AddElement<uint8_t>(DictionaryEncoding::VT_ISORDERED, static_cast<uint8_t>(isOrdered), 0);
1509 }
1510 explicit DictionaryEncodingBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1511 : fbb_(_fbb) {
1512 start_ = fbb_.StartTable();
1513 }
1514 DictionaryEncodingBuilder &operator=(const DictionaryEncodingBuilder &);
1515 flatbuffers::Offset<DictionaryEncoding> Finish() {
1516 const auto end = fbb_.EndTable(start_);
1517 auto o = flatbuffers::Offset<DictionaryEncoding>(end);
1518 return o;
1519 }
1520};
1521
1522inline flatbuffers::Offset<DictionaryEncoding> CreateDictionaryEncoding(
1523 flatbuffers::FlatBufferBuilder &_fbb,
1524 int64_t id = 0,
1525 flatbuffers::Offset<Int> indexType = 0,
1526 bool isOrdered = false) {
1527 DictionaryEncodingBuilder builder_(_fbb);
1528 builder_.add_id(id);
1529 builder_.add_indexType(indexType);
1530 builder_.add_isOrdered(isOrdered);
1531 return builder_.Finish();
1532}
1533
1534/// ----------------------------------------------------------------------
1535/// A field represents a named column in a record / row batch or child of a
1536/// nested type.
1537struct Field FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1538 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1539 VT_NAME = 4,
1540 VT_NULLABLE = 6,
1541 VT_TYPE_TYPE = 8,
1542 VT_TYPE = 10,
1543 VT_DICTIONARY = 12,
1544 VT_CHILDREN = 14,
1545 VT_CUSTOM_METADATA = 16
1546 };
1547 /// Name is not required, in i.e. a List
1548 const flatbuffers::String *name() const {
1549 return GetPointer<const flatbuffers::String *>(VT_NAME);
1550 }
1551 /// Whether or not this field can contain nulls. Should be true in general.
1552 bool nullable() const {
1553 return GetField<uint8_t>(VT_NULLABLE, 0) != 0;
1554 }
1555 Type type_type() const {
1556 return static_cast<Type>(GetField<uint8_t>(VT_TYPE_TYPE, 0));
1557 }
1558 /// This is the type of the decoded value if the field is dictionary encoded.
1559 const void *type() const {
1560 return GetPointer<const void *>(VT_TYPE);
1561 }
1562 template<typename T> const T *type_as() const;
1563 const Null *type_as_Null() const {
1564 return type_type() == Type_Null ? static_cast<const Null *>(type()) : nullptr;
1565 }
1566 const Int *type_as_Int() const {
1567 return type_type() == Type_Int ? static_cast<const Int *>(type()) : nullptr;
1568 }
1569 const FloatingPoint *type_as_FloatingPoint() const {
1570 return type_type() == Type_FloatingPoint ? static_cast<const FloatingPoint *>(type()) : nullptr;
1571 }
1572 const Binary *type_as_Binary() const {
1573 return type_type() == Type_Binary ? static_cast<const Binary *>(type()) : nullptr;
1574 }
1575 const Utf8 *type_as_Utf8() const {
1576 return type_type() == Type_Utf8 ? static_cast<const Utf8 *>(type()) : nullptr;
1577 }
1578 const Bool *type_as_Bool() const {
1579 return type_type() == Type_Bool ? static_cast<const Bool *>(type()) : nullptr;
1580 }
1581 const Decimal *type_as_Decimal() const {
1582 return type_type() == Type_Decimal ? static_cast<const Decimal *>(type()) : nullptr;
1583 }
1584 const Date *type_as_Date() const {
1585 return type_type() == Type_Date ? static_cast<const Date *>(type()) : nullptr;
1586 }
1587 const Time *type_as_Time() const {
1588 return type_type() == Type_Time ? static_cast<const Time *>(type()) : nullptr;
1589 }
1590 const Timestamp *type_as_Timestamp() const {
1591 return type_type() == Type_Timestamp ? static_cast<const Timestamp *>(type()) : nullptr;
1592 }
1593 const Interval *type_as_Interval() const {
1594 return type_type() == Type_Interval ? static_cast<const Interval *>(type()) : nullptr;
1595 }
1596 const List *type_as_List() const {
1597 return type_type() == Type_List ? static_cast<const List *>(type()) : nullptr;
1598 }
1599 const Struct_ *type_as_Struct_() const {
1600 return type_type() == Type_Struct_ ? static_cast<const Struct_ *>(type()) : nullptr;
1601 }
1602 const Union *type_as_Union() const {
1603 return type_type() == Type_Union ? static_cast<const Union *>(type()) : nullptr;
1604 }
1605 const FixedSizeBinary *type_as_FixedSizeBinary() const {
1606 return type_type() == Type_FixedSizeBinary ? static_cast<const FixedSizeBinary *>(type()) : nullptr;
1607 }
1608 const FixedSizeList *type_as_FixedSizeList() const {
1609 return type_type() == Type_FixedSizeList ? static_cast<const FixedSizeList *>(type()) : nullptr;
1610 }
1611 const Map *type_as_Map() const {
1612 return type_type() == Type_Map ? static_cast<const Map *>(type()) : nullptr;
1613 }
1614 const Duration *type_as_Duration() const {
1615 return type_type() == Type_Duration ? static_cast<const Duration *>(type()) : nullptr;
1616 }
1617 const LargeBinary *type_as_LargeBinary() const {
1618 return type_type() == Type_LargeBinary ? static_cast<const LargeBinary *>(type()) : nullptr;
1619 }
1620 const LargeUtf8 *type_as_LargeUtf8() const {
1621 return type_type() == Type_LargeUtf8 ? static_cast<const LargeUtf8 *>(type()) : nullptr;
1622 }
1623 const LargeList *type_as_LargeList() const {
1624 return type_type() == Type_LargeList ? static_cast<const LargeList *>(type()) : nullptr;
1625 }
1626 /// Present only if the field is dictionary encoded.
1627 const DictionaryEncoding *dictionary() const {
1628 return GetPointer<const DictionaryEncoding *>(VT_DICTIONARY);
1629 }
1630 /// children apply only to nested data types like Struct, List and Union. For
1631 /// primitive types children will have length 0.
1632 const flatbuffers::Vector<flatbuffers::Offset<Field>> *children() const {
1633 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Field>> *>(VT_CHILDREN);
1634 }
1635 /// User-defined metadata
1636 const flatbuffers::Vector<flatbuffers::Offset<KeyValue>> *custom_metadata() const {
1637 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<KeyValue>> *>(VT_CUSTOM_METADATA);
1638 }
1639 bool Verify(flatbuffers::Verifier &verifier) const {
1640 return VerifyTableStart(verifier) &&
1641 VerifyOffset(verifier, VT_NAME) &&
1642 verifier.VerifyString(name()) &&
1643 VerifyField<uint8_t>(verifier, VT_NULLABLE) &&
1644 VerifyField<uint8_t>(verifier, VT_TYPE_TYPE) &&
1645 VerifyOffset(verifier, VT_TYPE) &&
1646 VerifyType(verifier, type(), type_type()) &&
1647 VerifyOffset(verifier, VT_DICTIONARY) &&
1648 verifier.VerifyTable(dictionary()) &&
1649 VerifyOffset(verifier, VT_CHILDREN) &&
1650 verifier.VerifyVector(children()) &&
1651 verifier.VerifyVectorOfTables(children()) &&
1652 VerifyOffset(verifier, VT_CUSTOM_METADATA) &&
1653 verifier.VerifyVector(custom_metadata()) &&
1654 verifier.VerifyVectorOfTables(custom_metadata()) &&
1655 verifier.EndTable();
1656 }
1657};
1658
1659template<> inline const Null *Field::type_as<Null>() const {
1660 return type_as_Null();
1661}
1662
1663template<> inline const Int *Field::type_as<Int>() const {
1664 return type_as_Int();
1665}
1666
1667template<> inline const FloatingPoint *Field::type_as<FloatingPoint>() const {
1668 return type_as_FloatingPoint();
1669}
1670
1671template<> inline const Binary *Field::type_as<Binary>() const {
1672 return type_as_Binary();
1673}
1674
1675template<> inline const Utf8 *Field::type_as<Utf8>() const {
1676 return type_as_Utf8();
1677}
1678
1679template<> inline const Bool *Field::type_as<Bool>() const {
1680 return type_as_Bool();
1681}
1682
1683template<> inline const Decimal *Field::type_as<Decimal>() const {
1684 return type_as_Decimal();
1685}
1686
1687template<> inline const Date *Field::type_as<Date>() const {
1688 return type_as_Date();
1689}
1690
1691template<> inline const Time *Field::type_as<Time>() const {
1692 return type_as_Time();
1693}
1694
1695template<> inline const Timestamp *Field::type_as<Timestamp>() const {
1696 return type_as_Timestamp();
1697}
1698
1699template<> inline const Interval *Field::type_as<Interval>() const {
1700 return type_as_Interval();
1701}
1702
1703template<> inline const List *Field::type_as<List>() const {
1704 return type_as_List();
1705}
1706
1707template<> inline const Struct_ *Field::type_as<Struct_>() const {
1708 return type_as_Struct_();
1709}
1710
1711template<> inline const Union *Field::type_as<Union>() const {
1712 return type_as_Union();
1713}
1714
1715template<> inline const FixedSizeBinary *Field::type_as<FixedSizeBinary>() const {
1716 return type_as_FixedSizeBinary();
1717}
1718
1719template<> inline const FixedSizeList *Field::type_as<FixedSizeList>() const {
1720 return type_as_FixedSizeList();
1721}
1722
1723template<> inline const Map *Field::type_as<Map>() const {
1724 return type_as_Map();
1725}
1726
1727template<> inline const Duration *Field::type_as<Duration>() const {
1728 return type_as_Duration();
1729}
1730
1731template<> inline const LargeBinary *Field::type_as<LargeBinary>() const {
1732 return type_as_LargeBinary();
1733}
1734
1735template<> inline const LargeUtf8 *Field::type_as<LargeUtf8>() const {
1736 return type_as_LargeUtf8();
1737}
1738
1739template<> inline const LargeList *Field::type_as<LargeList>() const {
1740 return type_as_LargeList();
1741}
1742
1743struct FieldBuilder {
1744 flatbuffers::FlatBufferBuilder &fbb_;
1745 flatbuffers::uoffset_t start_;
1746 void add_name(flatbuffers::Offset<flatbuffers::String> name) {
1747 fbb_.AddOffset(Field::VT_NAME, name);
1748 }
1749 void add_nullable(bool nullable) {
1750 fbb_.AddElement<uint8_t>(Field::VT_NULLABLE, static_cast<uint8_t>(nullable), 0);
1751 }
1752 void add_type_type(Type type_type) {
1753 fbb_.AddElement<uint8_t>(Field::VT_TYPE_TYPE, static_cast<uint8_t>(type_type), 0);
1754 }
1755 void add_type(flatbuffers::Offset<void> type) {
1756 fbb_.AddOffset(Field::VT_TYPE, type);
1757 }
1758 void add_dictionary(flatbuffers::Offset<DictionaryEncoding> dictionary) {
1759 fbb_.AddOffset(Field::VT_DICTIONARY, dictionary);
1760 }
1761 void add_children(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Field>>> children) {
1762 fbb_.AddOffset(Field::VT_CHILDREN, children);
1763 }
1764 void add_custom_metadata(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<KeyValue>>> custom_metadata) {
1765 fbb_.AddOffset(Field::VT_CUSTOM_METADATA, custom_metadata);
1766 }
1767 explicit FieldBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1768 : fbb_(_fbb) {
1769 start_ = fbb_.StartTable();
1770 }
1771 FieldBuilder &operator=(const FieldBuilder &);
1772 flatbuffers::Offset<Field> Finish() {
1773 const auto end = fbb_.EndTable(start_);
1774 auto o = flatbuffers::Offset<Field>(end);
1775 return o;
1776 }
1777};
1778
1779inline flatbuffers::Offset<Field> CreateField(
1780 flatbuffers::FlatBufferBuilder &_fbb,
1781 flatbuffers::Offset<flatbuffers::String> name = 0,
1782 bool nullable = false,
1783 Type type_type = Type_NONE,
1784 flatbuffers::Offset<void> type = 0,
1785 flatbuffers::Offset<DictionaryEncoding> dictionary = 0,
1786 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Field>>> children = 0,
1787 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<KeyValue>>> custom_metadata = 0) {
1788 FieldBuilder builder_(_fbb);
1789 builder_.add_custom_metadata(custom_metadata);
1790 builder_.add_children(children);
1791 builder_.add_dictionary(dictionary);
1792 builder_.add_type(type);
1793 builder_.add_name(name);
1794 builder_.add_type_type(type_type);
1795 builder_.add_nullable(nullable);
1796 return builder_.Finish();
1797}
1798
1799inline flatbuffers::Offset<Field> CreateFieldDirect(
1800 flatbuffers::FlatBufferBuilder &_fbb,
1801 const char *name = nullptr,
1802 bool nullable = false,
1803 Type type_type = Type_NONE,
1804 flatbuffers::Offset<void> type = 0,
1805 flatbuffers::Offset<DictionaryEncoding> dictionary = 0,
1806 const std::vector<flatbuffers::Offset<Field>> *children = nullptr,
1807 const std::vector<flatbuffers::Offset<KeyValue>> *custom_metadata = nullptr) {
1808 auto name__ = name ? _fbb.CreateString(name) : 0;
1809 auto children__ = children ? _fbb.CreateVector<flatbuffers::Offset<Field>>(*children) : 0;
1810 auto custom_metadata__ = custom_metadata ? _fbb.CreateVector<flatbuffers::Offset<KeyValue>>(*custom_metadata) : 0;
1811 return org::apache::arrow::flatbuf::CreateField(
1812 _fbb,
1813 name__,
1814 nullable,
1815 type_type,
1816 type,
1817 dictionary,
1818 children__,
1819 custom_metadata__);
1820}
1821
1822/// ----------------------------------------------------------------------
1823/// A Schema describes the columns in a row batch
1824struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1825 enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1826 VT_ENDIANNESS = 4,
1827 VT_FIELDS = 6,
1828 VT_CUSTOM_METADATA = 8
1829 };
1830 /// endianness of the buffer
1831 /// it is Little Endian by default
1832 /// if endianness doesn't match the underlying system then the vectors need to be converted
1833 Endianness endianness() const {
1834 return static_cast<Endianness>(GetField<int16_t>(VT_ENDIANNESS, 0));
1835 }
1836 const flatbuffers::Vector<flatbuffers::Offset<Field>> *fields() const {
1837 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Field>> *>(VT_FIELDS);
1838 }
1839 const flatbuffers::Vector<flatbuffers::Offset<KeyValue>> *custom_metadata() const {
1840 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<KeyValue>> *>(VT_CUSTOM_METADATA);
1841 }
1842 bool Verify(flatbuffers::Verifier &verifier) const {
1843 return VerifyTableStart(verifier) &&
1844 VerifyField<int16_t>(verifier, VT_ENDIANNESS) &&
1845 VerifyOffset(verifier, VT_FIELDS) &&
1846 verifier.VerifyVector(fields()) &&
1847 verifier.VerifyVectorOfTables(fields()) &&
1848 VerifyOffset(verifier, VT_CUSTOM_METADATA) &&
1849 verifier.VerifyVector(custom_metadata()) &&
1850 verifier.VerifyVectorOfTables(custom_metadata()) &&
1851 verifier.EndTable();
1852 }
1853};
1854
1855struct SchemaBuilder {
1856 flatbuffers::FlatBufferBuilder &fbb_;
1857 flatbuffers::uoffset_t start_;
1858 void add_endianness(Endianness endianness) {
1859 fbb_.AddElement<int16_t>(Schema::VT_ENDIANNESS, static_cast<int16_t>(endianness), 0);
1860 }
1861 void add_fields(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Field>>> fields) {
1862 fbb_.AddOffset(Schema::VT_FIELDS, fields);
1863 }
1864 void add_custom_metadata(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<KeyValue>>> custom_metadata) {
1865 fbb_.AddOffset(Schema::VT_CUSTOM_METADATA, custom_metadata);
1866 }
1867 explicit SchemaBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1868 : fbb_(_fbb) {
1869 start_ = fbb_.StartTable();
1870 }
1871 SchemaBuilder &operator=(const SchemaBuilder &);
1872 flatbuffers::Offset<Schema> Finish() {
1873 const auto end = fbb_.EndTable(start_);
1874 auto o = flatbuffers::Offset<Schema>(end);
1875 return o;
1876 }
1877};
1878
1879inline flatbuffers::Offset<Schema> CreateSchema(
1880 flatbuffers::FlatBufferBuilder &_fbb,
1881 Endianness endianness = Endianness_Little,
1882 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Field>>> fields = 0,
1883 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<KeyValue>>> custom_metadata = 0) {
1884 SchemaBuilder builder_(_fbb);
1885 builder_.add_custom_metadata(custom_metadata);
1886 builder_.add_fields(fields);
1887 builder_.add_endianness(endianness);
1888 return builder_.Finish();
1889}
1890
1891inline flatbuffers::Offset<Schema> CreateSchemaDirect(
1892 flatbuffers::FlatBufferBuilder &_fbb,
1893 Endianness endianness = Endianness_Little,
1894 const std::vector<flatbuffers::Offset<Field>> *fields = nullptr,
1895 const std::vector<flatbuffers::Offset<KeyValue>> *custom_metadata = nullptr) {
1896 auto fields__ = fields ? _fbb.CreateVector<flatbuffers::Offset<Field>>(*fields) : 0;
1897 auto custom_metadata__ = custom_metadata ? _fbb.CreateVector<flatbuffers::Offset<KeyValue>>(*custom_metadata) : 0;
1898 return org::apache::arrow::flatbuf::CreateSchema(
1899 _fbb,
1900 endianness,
1901 fields__,
1902 custom_metadata__);
1903}
1904
1905inline bool VerifyType(flatbuffers::Verifier &verifier, const void *obj, Type type) {
1906 switch (type) {
1907 case Type_NONE: {
1908 return true;
1909 }
1910 case Type_Null: {
1911 auto ptr = reinterpret_cast<const Null *>(obj);
1912 return verifier.VerifyTable(ptr);
1913 }
1914 case Type_Int: {
1915 auto ptr = reinterpret_cast<const Int *>(obj);
1916 return verifier.VerifyTable(ptr);
1917 }
1918 case Type_FloatingPoint: {
1919 auto ptr = reinterpret_cast<const FloatingPoint *>(obj);
1920 return verifier.VerifyTable(ptr);
1921 }
1922 case Type_Binary: {
1923 auto ptr = reinterpret_cast<const Binary *>(obj);
1924 return verifier.VerifyTable(ptr);
1925 }
1926 case Type_Utf8: {
1927 auto ptr = reinterpret_cast<const Utf8 *>(obj);
1928 return verifier.VerifyTable(ptr);
1929 }
1930 case Type_Bool: {
1931 auto ptr = reinterpret_cast<const Bool *>(obj);
1932 return verifier.VerifyTable(ptr);
1933 }
1934 case Type_Decimal: {
1935 auto ptr = reinterpret_cast<const Decimal *>(obj);
1936 return verifier.VerifyTable(ptr);
1937 }
1938 case Type_Date: {
1939 auto ptr = reinterpret_cast<const Date *>(obj);
1940 return verifier.VerifyTable(ptr);
1941 }
1942 case Type_Time: {
1943 auto ptr = reinterpret_cast<const Time *>(obj);
1944 return verifier.VerifyTable(ptr);
1945 }
1946 case Type_Timestamp: {
1947 auto ptr = reinterpret_cast<const Timestamp *>(obj);
1948 return verifier.VerifyTable(ptr);
1949 }
1950 case Type_Interval: {
1951 auto ptr = reinterpret_cast<const Interval *>(obj);
1952 return verifier.VerifyTable(ptr);
1953 }
1954 case Type_List: {
1955 auto ptr = reinterpret_cast<const List *>(obj);
1956 return verifier.VerifyTable(ptr);
1957 }
1958 case Type_Struct_: {
1959 auto ptr = reinterpret_cast<const Struct_ *>(obj);
1960 return verifier.VerifyTable(ptr);
1961 }
1962 case Type_Union: {
1963 auto ptr = reinterpret_cast<const Union *>(obj);
1964 return verifier.VerifyTable(ptr);
1965 }
1966 case Type_FixedSizeBinary: {
1967 auto ptr = reinterpret_cast<const FixedSizeBinary *>(obj);
1968 return verifier.VerifyTable(ptr);
1969 }
1970 case Type_FixedSizeList: {
1971 auto ptr = reinterpret_cast<const FixedSizeList *>(obj);
1972 return verifier.VerifyTable(ptr);
1973 }
1974 case Type_Map: {
1975 auto ptr = reinterpret_cast<const Map *>(obj);
1976 return verifier.VerifyTable(ptr);
1977 }
1978 case Type_Duration: {
1979 auto ptr = reinterpret_cast<const Duration *>(obj);
1980 return verifier.VerifyTable(ptr);
1981 }
1982 case Type_LargeBinary: {
1983 auto ptr = reinterpret_cast<const LargeBinary *>(obj);
1984 return verifier.VerifyTable(ptr);
1985 }
1986 case Type_LargeUtf8: {
1987 auto ptr = reinterpret_cast<const LargeUtf8 *>(obj);
1988 return verifier.VerifyTable(ptr);
1989 }
1990 case Type_LargeList: {
1991 auto ptr = reinterpret_cast<const LargeList *>(obj);
1992 return verifier.VerifyTable(ptr);
1993 }
1994 default: return false;
1995 }
1996}
1997
1998inline bool VerifyTypeVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
1999 if (!values || !types) return !values && !types;
2000 if (values->size() != types->size()) return false;
2001 for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
2002 if (!VerifyType(
2003 verifier, values->Get(i), types->GetEnum<Type>(i))) {
2004 return false;
2005 }
2006 }
2007 return true;
2008}
2009
2010inline const org::apache::arrow::flatbuf::Schema *GetSchema(const void *buf) {
2011 return flatbuffers::GetRoot<org::apache::arrow::flatbuf::Schema>(buf);
2012}
2013
2014inline const org::apache::arrow::flatbuf::Schema *GetSizePrefixedSchema(const void *buf) {
2015 return flatbuffers::GetSizePrefixedRoot<org::apache::arrow::flatbuf::Schema>(buf);
2016}
2017
2018inline bool VerifySchemaBuffer(
2019 flatbuffers::Verifier &verifier) {
2020 return verifier.VerifyBuffer<org::apache::arrow::flatbuf::Schema>(nullptr);
2021}
2022
2023inline bool VerifySizePrefixedSchemaBuffer(
2024 flatbuffers::Verifier &verifier) {
2025 return verifier.VerifySizePrefixedBuffer<org::apache::arrow::flatbuf::Schema>(nullptr);
2026}
2027
2028inline void FinishSchemaBuffer(
2029 flatbuffers::FlatBufferBuilder &fbb,
2030 flatbuffers::Offset<org::apache::arrow::flatbuf::Schema> root) {
2031 fbb.Finish(root);
2032}
2033
2034inline void FinishSizePrefixedSchemaBuffer(
2035 flatbuffers::FlatBufferBuilder &fbb,
2036 flatbuffers::Offset<org::apache::arrow::flatbuf::Schema> root) {
2037 fbb.FinishSizePrefixed(root);
2038}
2039
2040} // namespace flatbuf
2041} // namespace arrow
2042} // namespace apache
2043} // namespace org
2044
2045#endif // FLATBUFFERS_GENERATED_SCHEMA_ORG_APACHE_ARROW_FLATBUF_H_
2046