@@ -25,6 +25,8 @@ use flatbuffers::EndianScalar;
25
25
use std:: { cmp:: Ordering , mem} ;
26
26
// automatically generated by the FlatBuffers compiler, do not modify
27
27
28
+ // @generated
29
+
28
30
#[ deprecated(
29
31
since = "2.0.0" ,
30
32
note = "Use associated constants instead. This will no longer be generated in 2021."
@@ -636,6 +638,7 @@ impl<'a> RecordBatch<'a> {
636
638
pub const VT_NODES : flatbuffers:: VOffsetT = 6 ;
637
639
pub const VT_BUFFERS : flatbuffers:: VOffsetT = 8 ;
638
640
pub const VT_COMPRESSION : flatbuffers:: VOffsetT = 10 ;
641
+ pub const VT_VARIADICBUFFERCOUNTS : flatbuffers:: VOffsetT = 12 ;
639
642
640
643
#[ inline]
641
644
pub unsafe fn init_from_table ( table : flatbuffers:: Table < ' a > ) -> Self {
@@ -648,6 +651,9 @@ impl<'a> RecordBatch<'a> {
648
651
) -> flatbuffers:: WIPOffset < RecordBatch < ' bldr > > {
649
652
let mut builder = RecordBatchBuilder :: new ( _fbb) ;
650
653
builder. add_length ( args. length ) ;
654
+ if let Some ( x) = args. variadicBufferCounts {
655
+ builder. add_variadicBufferCounts ( x) ;
656
+ }
651
657
if let Some ( x) = args. compression {
652
658
builder. add_compression ( x) ;
653
659
}
@@ -720,6 +726,33 @@ impl<'a> RecordBatch<'a> {
720
726
)
721
727
}
722
728
}
729
+ /// Some types such as Utf8View are represented using a variable number of buffers.
730
+ /// For each such Field in the pre-ordered flattened logical schema, there will be
731
+ /// an entry in variadicBufferCounts to indicate the number of number of variadic
732
+ /// buffers which belong to that Field in the current RecordBatch.
733
+ ///
734
+ /// For example, the schema
735
+ /// col1: Struct<alpha: Int32, beta: BinaryView, gamma: Float64>
736
+ /// col2: Utf8View
737
+ /// contains two Fields with variadic buffers so variadicBufferCounts will have
738
+ /// two entries, the first counting the variadic buffers of `col1.beta` and the
739
+ /// second counting `col2`'s.
740
+ ///
741
+ /// This field may be omitted if and only if the schema contains no Fields with
742
+ /// a variable number of buffers, such as BinaryView and Utf8View.
743
+ #[ inline]
744
+ pub fn variadicBufferCounts ( & self ) -> Option < flatbuffers:: Vector < ' a , i64 > > {
745
+ // Safety:
746
+ // Created from valid Table for this object
747
+ // which contains a valid value in this slot
748
+ unsafe {
749
+ self . _tab
750
+ . get :: < flatbuffers:: ForwardsUOffset < flatbuffers:: Vector < ' a , i64 > > > (
751
+ RecordBatch :: VT_VARIADICBUFFERCOUNTS ,
752
+ None ,
753
+ )
754
+ }
755
+ }
723
756
}
724
757
725
758
impl flatbuffers:: Verifiable for RecordBatch < ' _ > {
@@ -746,6 +779,11 @@ impl flatbuffers::Verifiable for RecordBatch<'_> {
746
779
Self :: VT_COMPRESSION ,
747
780
false ,
748
781
) ?
782
+ . visit_field :: < flatbuffers:: ForwardsUOffset < flatbuffers:: Vector < ' _ , i64 > > > (
783
+ "variadicBufferCounts" ,
784
+ Self :: VT_VARIADICBUFFERCOUNTS ,
785
+ false ,
786
+ ) ?
749
787
. finish ( ) ;
750
788
Ok ( ( ) )
751
789
}
@@ -755,6 +793,7 @@ pub struct RecordBatchArgs<'a> {
755
793
pub nodes : Option < flatbuffers:: WIPOffset < flatbuffers:: Vector < ' a , FieldNode > > > ,
756
794
pub buffers : Option < flatbuffers:: WIPOffset < flatbuffers:: Vector < ' a , Buffer > > > ,
757
795
pub compression : Option < flatbuffers:: WIPOffset < BodyCompression < ' a > > > ,
796
+ pub variadicBufferCounts : Option < flatbuffers:: WIPOffset < flatbuffers:: Vector < ' a , i64 > > > ,
758
797
}
759
798
impl < ' a > Default for RecordBatchArgs < ' a > {
760
799
#[ inline]
@@ -764,6 +803,7 @@ impl<'a> Default for RecordBatchArgs<'a> {
764
803
nodes : None ,
765
804
buffers : None ,
766
805
compression : None ,
806
+ variadicBufferCounts : None ,
767
807
}
768
808
}
769
809
}
@@ -800,6 +840,16 @@ impl<'a: 'b, 'b> RecordBatchBuilder<'a, 'b> {
800
840
) ;
801
841
}
802
842
#[ inline]
843
+ pub fn add_variadicBufferCounts (
844
+ & mut self ,
845
+ variadicBufferCounts : flatbuffers:: WIPOffset < flatbuffers:: Vector < ' b , i64 > > ,
846
+ ) {
847
+ self . fbb_ . push_slot_always :: < flatbuffers:: WIPOffset < _ > > (
848
+ RecordBatch :: VT_VARIADICBUFFERCOUNTS ,
849
+ variadicBufferCounts,
850
+ ) ;
851
+ }
852
+ #[ inline]
803
853
pub fn new ( _fbb : & ' b mut flatbuffers:: FlatBufferBuilder < ' a > ) -> RecordBatchBuilder < ' a , ' b > {
804
854
let start = _fbb. start_table ( ) ;
805
855
RecordBatchBuilder {
@@ -821,6 +871,7 @@ impl core::fmt::Debug for RecordBatch<'_> {
821
871
ds. field ( "nodes" , & self . nodes ( ) ) ;
822
872
ds. field ( "buffers" , & self . buffers ( ) ) ;
823
873
ds. field ( "compression" , & self . compression ( ) ) ;
874
+ ds. field ( "variadicBufferCounts" , & self . variadicBufferCounts ( ) ) ;
824
875
ds. finish ( )
825
876
}
826
877
}
0 commit comments