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