1#![allow(unused_imports)]
5#![allow(unused_extern_crates)]
6#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments, type_complexity))]
7#![cfg_attr(rustfmt, rustfmt_skip)]
8
9extern crate thrift;
10
11use thrift::OrderedFloat;
12use std::cell::RefCell;
13use std::collections::{BTreeMap, BTreeSet};
14use std::convert::{From, TryFrom};
15use std::default::Default;
16use std::error::Error;
17use std::fmt;
18use std::fmt::{Display, Formatter};
19use std::rc::Rc;
20
21use thrift::{ApplicationError, ApplicationErrorKind, ProtocolError, ProtocolErrorKind, TThriftClient};
22use thrift::protocol::{TFieldIdentifier, TListIdentifier, TMapIdentifier, TMessageIdentifier, TMessageType, TInputProtocol, TOutputProtocol, TSetIdentifier, TStructIdentifier, TType};
23use thrift::protocol::field_id;
24use thrift::protocol::verify_expected_message_type;
25use thrift::protocol::verify_expected_sequence_number;
26use thrift::protocol::verify_expected_service_call;
27use thrift::protocol::verify_required_field_exists;
28use thrift::server::TProcessor;
29
30#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub enum Type {
36 Boolean = 0,
37 Int32 = 1,
38 Int64 = 2,
39 Int96 = 3,
40 Float = 4,
41 Double = 5,
42 ByteArray = 6,
43 FixedLenByteArray = 7,
44}
45
46impl Type {
47 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
48 o_prot.write_i32(*self as i32)
49 }
50 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<Type> {
51 let enum_value = i_prot.read_i32()?;
52 Type::try_from(enum_value) }
53}
54
55impl TryFrom<i32> for Type {
56 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
57 match i {
58 0 => Ok(Type::Boolean),
59 1 => Ok(Type::Int32),
60 2 => Ok(Type::Int64),
61 3 => Ok(Type::Int96),
62 4 => Ok(Type::Float),
63 5 => Ok(Type::Double),
64 6 => Ok(Type::ByteArray),
65 7 => Ok(Type::FixedLenByteArray),
66 _ => {
67 Err(
68 thrift::Error::Protocol(
69 ProtocolError::new(
70 ProtocolErrorKind::InvalidData,
71 format!("cannot convert enum constant {} to Type", i)
72 )
73 )
74 )
75 },
76 }
77 }
78}
79
80#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
84pub enum ConvertedType {
85 Utf8 = 0,
87 Map = 1,
89 MapKeyValue = 2,
91 List = 3,
94 Enum = 4,
96 Decimal = 5,
109 Date = 6,
114 TimeMillis = 7,
119 TimeMicros = 8,
124 TimestampMillis = 9,
129 TimestampMicros = 10,
134 Uint8 = 11,
142 Uint16 = 12,
143 Uint32 = 13,
144 Uint64 = 14,
145 Int8 = 15,
153 Int16 = 16,
154 Int32 = 17,
155 Int64 = 18,
156 Json = 19,
160 Bson = 20,
164 Interval = 21,
175}
176
177impl ConvertedType {
178 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
179 o_prot.write_i32(*self as i32)
180 }
181 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<ConvertedType> {
182 let enum_value = i_prot.read_i32()?;
183 ConvertedType::try_from(enum_value) }
184}
185
186impl TryFrom<i32> for ConvertedType {
187 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
188 match i {
189 0 => Ok(ConvertedType::Utf8),
190 1 => Ok(ConvertedType::Map),
191 2 => Ok(ConvertedType::MapKeyValue),
192 3 => Ok(ConvertedType::List),
193 4 => Ok(ConvertedType::Enum),
194 5 => Ok(ConvertedType::Decimal),
195 6 => Ok(ConvertedType::Date),
196 7 => Ok(ConvertedType::TimeMillis),
197 8 => Ok(ConvertedType::TimeMicros),
198 9 => Ok(ConvertedType::TimestampMillis),
199 10 => Ok(ConvertedType::TimestampMicros),
200 11 => Ok(ConvertedType::Uint8),
201 12 => Ok(ConvertedType::Uint16),
202 13 => Ok(ConvertedType::Uint32),
203 14 => Ok(ConvertedType::Uint64),
204 15 => Ok(ConvertedType::Int8),
205 16 => Ok(ConvertedType::Int16),
206 17 => Ok(ConvertedType::Int32),
207 18 => Ok(ConvertedType::Int64),
208 19 => Ok(ConvertedType::Json),
209 20 => Ok(ConvertedType::Bson),
210 21 => Ok(ConvertedType::Interval),
211 _ => {
212 Err(
213 thrift::Error::Protocol(
214 ProtocolError::new(
215 ProtocolErrorKind::InvalidData,
216 format!("cannot convert enum constant {} to ConvertedType", i)
217 )
218 )
219 )
220 },
221 }
222 }
223}
224
225#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
227pub enum FieldRepetitionType {
228 Required = 0,
230 Optional = 1,
232 Repeated = 2,
234}
235
236impl FieldRepetitionType {
237 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
238 o_prot.write_i32(*self as i32)
239 }
240 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<FieldRepetitionType> {
241 let enum_value = i_prot.read_i32()?;
242 FieldRepetitionType::try_from(enum_value) }
243}
244
245impl TryFrom<i32> for FieldRepetitionType {
246 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
247 match i {
248 0 => Ok(FieldRepetitionType::Required),
249 1 => Ok(FieldRepetitionType::Optional),
250 2 => Ok(FieldRepetitionType::Repeated),
251 _ => {
252 Err(
253 thrift::Error::Protocol(
254 ProtocolError::new(
255 ProtocolErrorKind::InvalidData,
256 format!("cannot convert enum constant {} to FieldRepetitionType", i)
257 )
258 )
259 )
260 },
261 }
262 }
263}
264
265#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
269pub enum Encoding {
270 Plain = 0,
279 PlainDictionary = 2,
284 Rle = 3,
287 BitPacked = 4,
290 DeltaBinaryPacked = 5,
293 DeltaLengthByteArray = 6,
296 DeltaByteArray = 7,
299 RleDictionary = 8,
301 ByteStreamSplit = 9,
308}
309
310impl Encoding {
311 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
312 o_prot.write_i32(*self as i32)
313 }
314 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<Encoding> {
315 let enum_value = i_prot.read_i32()?;
316 Encoding::try_from(enum_value) }
317}
318
319impl TryFrom<i32> for Encoding {
320 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
321 match i {
322 0 => Ok(Encoding::Plain),
323 2 => Ok(Encoding::PlainDictionary),
324 3 => Ok(Encoding::Rle),
325 4 => Ok(Encoding::BitPacked),
326 5 => Ok(Encoding::DeltaBinaryPacked),
327 6 => Ok(Encoding::DeltaLengthByteArray),
328 7 => Ok(Encoding::DeltaByteArray),
329 8 => Ok(Encoding::RleDictionary),
330 9 => Ok(Encoding::ByteStreamSplit),
331 _ => {
332 Err(
333 thrift::Error::Protocol(
334 ProtocolError::new(
335 ProtocolErrorKind::InvalidData,
336 format!("cannot convert enum constant {} to Encoding", i)
337 )
338 )
339 )
340 },
341 }
342 }
343}
344
345#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
352pub enum CompressionCodec {
353 Uncompressed = 0,
354 Snappy = 1,
355 Gzip = 2,
356 Lzo = 3,
357 Brotli = 4,
358 Lz4 = 5,
359 Zstd = 6,
360}
361
362impl CompressionCodec {
363 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
364 o_prot.write_i32(*self as i32)
365 }
366 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<CompressionCodec> {
367 let enum_value = i_prot.read_i32()?;
368 CompressionCodec::try_from(enum_value) }
369}
370
371impl TryFrom<i32> for CompressionCodec {
372 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
373 match i {
374 0 => Ok(CompressionCodec::Uncompressed),
375 1 => Ok(CompressionCodec::Snappy),
376 2 => Ok(CompressionCodec::Gzip),
377 3 => Ok(CompressionCodec::Lzo),
378 4 => Ok(CompressionCodec::Brotli),
379 5 => Ok(CompressionCodec::Lz4),
380 6 => Ok(CompressionCodec::Zstd),
381 _ => {
382 Err(
383 thrift::Error::Protocol(
384 ProtocolError::new(
385 ProtocolErrorKind::InvalidData,
386 format!("cannot convert enum constant {} to CompressionCodec", i)
387 )
388 )
389 )
390 },
391 }
392 }
393}
394
395#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
396pub enum PageType {
397 DataPage = 0,
398 IndexPage = 1,
399 DictionaryPage = 2,
400 DataPageV2 = 3,
401}
402
403impl PageType {
404 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
405 o_prot.write_i32(*self as i32)
406 }
407 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<PageType> {
408 let enum_value = i_prot.read_i32()?;
409 PageType::try_from(enum_value) }
410}
411
412impl TryFrom<i32> for PageType {
413 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
414 match i {
415 0 => Ok(PageType::DataPage),
416 1 => Ok(PageType::IndexPage),
417 2 => Ok(PageType::DictionaryPage),
418 3 => Ok(PageType::DataPageV2),
419 _ => {
420 Err(
421 thrift::Error::Protocol(
422 ProtocolError::new(
423 ProtocolErrorKind::InvalidData,
424 format!("cannot convert enum constant {} to PageType", i)
425 )
426 )
427 )
428 },
429 }
430 }
431}
432
433#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
436pub enum BoundaryOrder {
437 Unordered = 0,
438 Ascending = 1,
439 Descending = 2,
440}
441
442impl BoundaryOrder {
443 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
444 o_prot.write_i32(*self as i32)
445 }
446 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<BoundaryOrder> {
447 let enum_value = i_prot.read_i32()?;
448 BoundaryOrder::try_from(enum_value) }
449}
450
451impl TryFrom<i32> for BoundaryOrder {
452 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
453 match i {
454 0 => Ok(BoundaryOrder::Unordered),
455 1 => Ok(BoundaryOrder::Ascending),
456 2 => Ok(BoundaryOrder::Descending),
457 _ => {
458 Err(
459 thrift::Error::Protocol(
460 ProtocolError::new(
461 ProtocolErrorKind::InvalidData,
462 format!("cannot convert enum constant {} to BoundaryOrder", i)
463 )
464 )
465 )
466 },
467 }
468 }
469}
470
471#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
478pub struct Statistics {
479 pub max: Option<Vec<u8>>,
491 pub min: Option<Vec<u8>>,
492 pub null_count: Option<i64>,
494 pub distinct_count: Option<i64>,
496 pub max_value: Option<Vec<u8>>,
501 pub min_value: Option<Vec<u8>>,
502}
503
504impl Statistics {
505 pub fn new<F1, F2, F3, F4, F5, F6>(max: F1, min: F2, null_count: F3, distinct_count: F4, max_value: F5, min_value: F6) -> Statistics where F1: Into<Option<Vec<u8>>>, F2: Into<Option<Vec<u8>>>, F3: Into<Option<i64>>, F4: Into<Option<i64>>, F5: Into<Option<Vec<u8>>>, F6: Into<Option<Vec<u8>>> {
506 Statistics {
507 max: max.into(),
508 min: min.into(),
509 null_count: null_count.into(),
510 distinct_count: distinct_count.into(),
511 max_value: max_value.into(),
512 min_value: min_value.into(),
513 }
514 }
515 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<Statistics> {
516 i_prot.read_struct_begin()?;
517 let mut f_1: Option<Vec<u8>> = None;
518 let mut f_2: Option<Vec<u8>> = None;
519 let mut f_3: Option<i64> = None;
520 let mut f_4: Option<i64> = None;
521 let mut f_5: Option<Vec<u8>> = None;
522 let mut f_6: Option<Vec<u8>> = None;
523 loop {
524 let field_ident = i_prot.read_field_begin()?;
525 if field_ident.field_type == TType::Stop {
526 break;
527 }
528 let field_id = field_id(&field_ident)?;
529 match field_id {
530 1 => {
531 let val = i_prot.read_bytes()?;
532 f_1 = Some(val);
533 },
534 2 => {
535 let val = i_prot.read_bytes()?;
536 f_2 = Some(val);
537 },
538 3 => {
539 let val = i_prot.read_i64()?;
540 f_3 = Some(val);
541 },
542 4 => {
543 let val = i_prot.read_i64()?;
544 f_4 = Some(val);
545 },
546 5 => {
547 let val = i_prot.read_bytes()?;
548 f_5 = Some(val);
549 },
550 6 => {
551 let val = i_prot.read_bytes()?;
552 f_6 = Some(val);
553 },
554 _ => {
555 i_prot.skip(field_ident.field_type)?;
556 },
557 };
558 i_prot.read_field_end()?;
559 }
560 i_prot.read_struct_end()?;
561 let ret = Statistics {
562 max: f_1,
563 min: f_2,
564 null_count: f_3,
565 distinct_count: f_4,
566 max_value: f_5,
567 min_value: f_6,
568 };
569 Ok(ret)
570 }
571 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
572 let struct_ident = TStructIdentifier::new("Statistics");
573 o_prot.write_struct_begin(&struct_ident)?;
574 if let Some(ref fld_var) = self.max {
575 o_prot.write_field_begin(&TFieldIdentifier::new("max", TType::String, 1))?;
576 o_prot.write_bytes(fld_var)?;
577 o_prot.write_field_end()?;
578 ()
579 } else {
580 ()
581 }
582 if let Some(ref fld_var) = self.min {
583 o_prot.write_field_begin(&TFieldIdentifier::new("min", TType::String, 2))?;
584 o_prot.write_bytes(fld_var)?;
585 o_prot.write_field_end()?;
586 ()
587 } else {
588 ()
589 }
590 if let Some(fld_var) = self.null_count {
591 o_prot.write_field_begin(&TFieldIdentifier::new("null_count", TType::I64, 3))?;
592 o_prot.write_i64(fld_var)?;
593 o_prot.write_field_end()?;
594 ()
595 } else {
596 ()
597 }
598 if let Some(fld_var) = self.distinct_count {
599 o_prot.write_field_begin(&TFieldIdentifier::new("distinct_count", TType::I64, 4))?;
600 o_prot.write_i64(fld_var)?;
601 o_prot.write_field_end()?;
602 ()
603 } else {
604 ()
605 }
606 if let Some(ref fld_var) = self.max_value {
607 o_prot.write_field_begin(&TFieldIdentifier::new("max_value", TType::String, 5))?;
608 o_prot.write_bytes(fld_var)?;
609 o_prot.write_field_end()?;
610 ()
611 } else {
612 ()
613 }
614 if let Some(ref fld_var) = self.min_value {
615 o_prot.write_field_begin(&TFieldIdentifier::new("min_value", TType::String, 6))?;
616 o_prot.write_bytes(fld_var)?;
617 o_prot.write_field_end()?;
618 ()
619 } else {
620 ()
621 }
622 o_prot.write_field_stop()?;
623 o_prot.write_struct_end()
624 }
625}
626
627impl Default for Statistics {
628 fn default() -> Self {
629 Statistics{
630 max: Some(Vec::new()),
631 min: Some(Vec::new()),
632 null_count: Some(0),
633 distinct_count: Some(0),
634 max_value: Some(Vec::new()),
635 min_value: Some(Vec::new()),
636 }
637 }
638}
639
640#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
646pub struct StringType {
647}
648
649impl StringType {
650 pub fn new() -> StringType {
651 StringType {}
652 }
653 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<StringType> {
654 i_prot.read_struct_begin()?;
655 loop {
656 let field_ident = i_prot.read_field_begin()?;
657 if field_ident.field_type == TType::Stop {
658 break;
659 }
660 let field_id = field_id(&field_ident)?;
661 match field_id {
662 _ => {
663 i_prot.skip(field_ident.field_type)?;
664 },
665 };
666 i_prot.read_field_end()?;
667 }
668 i_prot.read_struct_end()?;
669 let ret = StringType {};
670 Ok(ret)
671 }
672 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
673 let struct_ident = TStructIdentifier::new("StringType");
674 o_prot.write_struct_begin(&struct_ident)?;
675 o_prot.write_field_stop()?;
676 o_prot.write_struct_end()
677 }
678}
679
680impl Default for StringType {
681 fn default() -> Self {
682 StringType{}
683 }
684}
685
686#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
691pub struct UUIDType {
692}
693
694impl UUIDType {
695 pub fn new() -> UUIDType {
696 UUIDType {}
697 }
698 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<UUIDType> {
699 i_prot.read_struct_begin()?;
700 loop {
701 let field_ident = i_prot.read_field_begin()?;
702 if field_ident.field_type == TType::Stop {
703 break;
704 }
705 let field_id = field_id(&field_ident)?;
706 match field_id {
707 _ => {
708 i_prot.skip(field_ident.field_type)?;
709 },
710 };
711 i_prot.read_field_end()?;
712 }
713 i_prot.read_struct_end()?;
714 let ret = UUIDType {};
715 Ok(ret)
716 }
717 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
718 let struct_ident = TStructIdentifier::new("UUIDType");
719 o_prot.write_struct_begin(&struct_ident)?;
720 o_prot.write_field_stop()?;
721 o_prot.write_struct_end()
722 }
723}
724
725impl Default for UUIDType {
726 fn default() -> Self {
727 UUIDType{}
728 }
729}
730
731#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
736pub struct MapType {
737}
738
739impl MapType {
740 pub fn new() -> MapType {
741 MapType {}
742 }
743 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<MapType> {
744 i_prot.read_struct_begin()?;
745 loop {
746 let field_ident = i_prot.read_field_begin()?;
747 if field_ident.field_type == TType::Stop {
748 break;
749 }
750 let field_id = field_id(&field_ident)?;
751 match field_id {
752 _ => {
753 i_prot.skip(field_ident.field_type)?;
754 },
755 };
756 i_prot.read_field_end()?;
757 }
758 i_prot.read_struct_end()?;
759 let ret = MapType {};
760 Ok(ret)
761 }
762 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
763 let struct_ident = TStructIdentifier::new("MapType");
764 o_prot.write_struct_begin(&struct_ident)?;
765 o_prot.write_field_stop()?;
766 o_prot.write_struct_end()
767 }
768}
769
770impl Default for MapType {
771 fn default() -> Self {
772 MapType{}
773 }
774}
775
776#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
781pub struct ListType {
782}
783
784impl ListType {
785 pub fn new() -> ListType {
786 ListType {}
787 }
788 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<ListType> {
789 i_prot.read_struct_begin()?;
790 loop {
791 let field_ident = i_prot.read_field_begin()?;
792 if field_ident.field_type == TType::Stop {
793 break;
794 }
795 let field_id = field_id(&field_ident)?;
796 match field_id {
797 _ => {
798 i_prot.skip(field_ident.field_type)?;
799 },
800 };
801 i_prot.read_field_end()?;
802 }
803 i_prot.read_struct_end()?;
804 let ret = ListType {};
805 Ok(ret)
806 }
807 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
808 let struct_ident = TStructIdentifier::new("ListType");
809 o_prot.write_struct_begin(&struct_ident)?;
810 o_prot.write_field_stop()?;
811 o_prot.write_struct_end()
812 }
813}
814
815impl Default for ListType {
816 fn default() -> Self {
817 ListType{}
818 }
819}
820
821#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
826pub struct EnumType {
827}
828
829impl EnumType {
830 pub fn new() -> EnumType {
831 EnumType {}
832 }
833 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<EnumType> {
834 i_prot.read_struct_begin()?;
835 loop {
836 let field_ident = i_prot.read_field_begin()?;
837 if field_ident.field_type == TType::Stop {
838 break;
839 }
840 let field_id = field_id(&field_ident)?;
841 match field_id {
842 _ => {
843 i_prot.skip(field_ident.field_type)?;
844 },
845 };
846 i_prot.read_field_end()?;
847 }
848 i_prot.read_struct_end()?;
849 let ret = EnumType {};
850 Ok(ret)
851 }
852 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
853 let struct_ident = TStructIdentifier::new("EnumType");
854 o_prot.write_struct_begin(&struct_ident)?;
855 o_prot.write_field_stop()?;
856 o_prot.write_struct_end()
857 }
858}
859
860impl Default for EnumType {
861 fn default() -> Self {
862 EnumType{}
863 }
864}
865
866#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
871pub struct DateType {
872}
873
874impl DateType {
875 pub fn new() -> DateType {
876 DateType {}
877 }
878 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<DateType> {
879 i_prot.read_struct_begin()?;
880 loop {
881 let field_ident = i_prot.read_field_begin()?;
882 if field_ident.field_type == TType::Stop {
883 break;
884 }
885 let field_id = field_id(&field_ident)?;
886 match field_id {
887 _ => {
888 i_prot.skip(field_ident.field_type)?;
889 },
890 };
891 i_prot.read_field_end()?;
892 }
893 i_prot.read_struct_end()?;
894 let ret = DateType {};
895 Ok(ret)
896 }
897 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
898 let struct_ident = TStructIdentifier::new("DateType");
899 o_prot.write_struct_begin(&struct_ident)?;
900 o_prot.write_field_stop()?;
901 o_prot.write_struct_end()
902 }
903}
904
905impl Default for DateType {
906 fn default() -> Self {
907 DateType{}
908 }
909}
910
911#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
921pub struct NullType {
922}
923
924impl NullType {
925 pub fn new() -> NullType {
926 NullType {}
927 }
928 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<NullType> {
929 i_prot.read_struct_begin()?;
930 loop {
931 let field_ident = i_prot.read_field_begin()?;
932 if field_ident.field_type == TType::Stop {
933 break;
934 }
935 let field_id = field_id(&field_ident)?;
936 match field_id {
937 _ => {
938 i_prot.skip(field_ident.field_type)?;
939 },
940 };
941 i_prot.read_field_end()?;
942 }
943 i_prot.read_struct_end()?;
944 let ret = NullType {};
945 Ok(ret)
946 }
947 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
948 let struct_ident = TStructIdentifier::new("NullType");
949 o_prot.write_struct_begin(&struct_ident)?;
950 o_prot.write_field_stop()?;
951 o_prot.write_struct_end()
952 }
953}
954
955impl Default for NullType {
956 fn default() -> Self {
957 NullType{}
958 }
959}
960
961#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
972pub struct DecimalType {
973 pub scale: i32,
974 pub precision: i32,
975}
976
977impl DecimalType {
978 pub fn new(scale: i32, precision: i32) -> DecimalType {
979 DecimalType {
980 scale: scale,
981 precision: precision,
982 }
983 }
984 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<DecimalType> {
985 i_prot.read_struct_begin()?;
986 let mut f_1: Option<i32> = None;
987 let mut f_2: Option<i32> = None;
988 loop {
989 let field_ident = i_prot.read_field_begin()?;
990 if field_ident.field_type == TType::Stop {
991 break;
992 }
993 let field_id = field_id(&field_ident)?;
994 match field_id {
995 1 => {
996 let val = i_prot.read_i32()?;
997 f_1 = Some(val);
998 },
999 2 => {
1000 let val = i_prot.read_i32()?;
1001 f_2 = Some(val);
1002 },
1003 _ => {
1004 i_prot.skip(field_ident.field_type)?;
1005 },
1006 };
1007 i_prot.read_field_end()?;
1008 }
1009 i_prot.read_struct_end()?;
1010 verify_required_field_exists("DecimalType.scale", &f_1)?;
1011 verify_required_field_exists("DecimalType.precision", &f_2)?;
1012 let ret = DecimalType {
1013 scale: f_1.expect("auto-generated code should have checked for presence of required fields"),
1014 precision: f_2.expect("auto-generated code should have checked for presence of required fields"),
1015 };
1016 Ok(ret)
1017 }
1018 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1019 let struct_ident = TStructIdentifier::new("DecimalType");
1020 o_prot.write_struct_begin(&struct_ident)?;
1021 o_prot.write_field_begin(&TFieldIdentifier::new("scale", TType::I32, 1))?;
1022 o_prot.write_i32(self.scale)?;
1023 o_prot.write_field_end()?;
1024 o_prot.write_field_begin(&TFieldIdentifier::new("precision", TType::I32, 2))?;
1025 o_prot.write_i32(self.precision)?;
1026 o_prot.write_field_end()?;
1027 o_prot.write_field_stop()?;
1028 o_prot.write_struct_end()
1029 }
1030}
1031
1032#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1038pub struct MilliSeconds {
1039}
1040
1041impl MilliSeconds {
1042 pub fn new() -> MilliSeconds {
1043 MilliSeconds {}
1044 }
1045 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<MilliSeconds> {
1046 i_prot.read_struct_begin()?;
1047 loop {
1048 let field_ident = i_prot.read_field_begin()?;
1049 if field_ident.field_type == TType::Stop {
1050 break;
1051 }
1052 let field_id = field_id(&field_ident)?;
1053 match field_id {
1054 _ => {
1055 i_prot.skip(field_ident.field_type)?;
1056 },
1057 };
1058 i_prot.read_field_end()?;
1059 }
1060 i_prot.read_struct_end()?;
1061 let ret = MilliSeconds {};
1062 Ok(ret)
1063 }
1064 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1065 let struct_ident = TStructIdentifier::new("MilliSeconds");
1066 o_prot.write_struct_begin(&struct_ident)?;
1067 o_prot.write_field_stop()?;
1068 o_prot.write_struct_end()
1069 }
1070}
1071
1072impl Default for MilliSeconds {
1073 fn default() -> Self {
1074 MilliSeconds{}
1075 }
1076}
1077
1078#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1083pub struct MicroSeconds {
1084}
1085
1086impl MicroSeconds {
1087 pub fn new() -> MicroSeconds {
1088 MicroSeconds {}
1089 }
1090 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<MicroSeconds> {
1091 i_prot.read_struct_begin()?;
1092 loop {
1093 let field_ident = i_prot.read_field_begin()?;
1094 if field_ident.field_type == TType::Stop {
1095 break;
1096 }
1097 let field_id = field_id(&field_ident)?;
1098 match field_id {
1099 _ => {
1100 i_prot.skip(field_ident.field_type)?;
1101 },
1102 };
1103 i_prot.read_field_end()?;
1104 }
1105 i_prot.read_struct_end()?;
1106 let ret = MicroSeconds {};
1107 Ok(ret)
1108 }
1109 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1110 let struct_ident = TStructIdentifier::new("MicroSeconds");
1111 o_prot.write_struct_begin(&struct_ident)?;
1112 o_prot.write_field_stop()?;
1113 o_prot.write_struct_end()
1114 }
1115}
1116
1117impl Default for MicroSeconds {
1118 fn default() -> Self {
1119 MicroSeconds{}
1120 }
1121}
1122
1123#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1128pub struct NanoSeconds {
1129}
1130
1131impl NanoSeconds {
1132 pub fn new() -> NanoSeconds {
1133 NanoSeconds {}
1134 }
1135 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<NanoSeconds> {
1136 i_prot.read_struct_begin()?;
1137 loop {
1138 let field_ident = i_prot.read_field_begin()?;
1139 if field_ident.field_type == TType::Stop {
1140 break;
1141 }
1142 let field_id = field_id(&field_ident)?;
1143 match field_id {
1144 _ => {
1145 i_prot.skip(field_ident.field_type)?;
1146 },
1147 };
1148 i_prot.read_field_end()?;
1149 }
1150 i_prot.read_struct_end()?;
1151 let ret = NanoSeconds {};
1152 Ok(ret)
1153 }
1154 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1155 let struct_ident = TStructIdentifier::new("NanoSeconds");
1156 o_prot.write_struct_begin(&struct_ident)?;
1157 o_prot.write_field_stop()?;
1158 o_prot.write_struct_end()
1159 }
1160}
1161
1162impl Default for NanoSeconds {
1163 fn default() -> Self {
1164 NanoSeconds{}
1165 }
1166}
1167
1168#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1173pub enum TimeUnit {
1174 MILLIS(MilliSeconds),
1175 MICROS(MicroSeconds),
1176 NANOS(NanoSeconds),
1177}
1178
1179impl TimeUnit {
1180 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TimeUnit> {
1181 let mut ret: Option<TimeUnit> = None;
1182 let mut received_field_count = 0;
1183 i_prot.read_struct_begin()?;
1184 loop {
1185 let field_ident = i_prot.read_field_begin()?;
1186 if field_ident.field_type == TType::Stop {
1187 break;
1188 }
1189 let field_id = field_id(&field_ident)?;
1190 match field_id {
1191 1 => {
1192 let val = MilliSeconds::read_from_in_protocol(i_prot)?;
1193 if ret.is_none() {
1194 ret = Some(TimeUnit::MILLIS(val));
1195 }
1196 received_field_count += 1;
1197 },
1198 2 => {
1199 let val = MicroSeconds::read_from_in_protocol(i_prot)?;
1200 if ret.is_none() {
1201 ret = Some(TimeUnit::MICROS(val));
1202 }
1203 received_field_count += 1;
1204 },
1205 3 => {
1206 let val = NanoSeconds::read_from_in_protocol(i_prot)?;
1207 if ret.is_none() {
1208 ret = Some(TimeUnit::NANOS(val));
1209 }
1210 received_field_count += 1;
1211 },
1212 _ => {
1213 i_prot.skip(field_ident.field_type)?;
1214 received_field_count += 1;
1215 },
1216 };
1217 i_prot.read_field_end()?;
1218 }
1219 i_prot.read_struct_end()?;
1220 if received_field_count == 0 {
1221 Err(
1222 thrift::Error::Protocol(
1223 ProtocolError::new(
1224 ProtocolErrorKind::InvalidData,
1225 "received empty union from remote TimeUnit"
1226 )
1227 )
1228 )
1229 } else if received_field_count > 1 {
1230 Err(
1231 thrift::Error::Protocol(
1232 ProtocolError::new(
1233 ProtocolErrorKind::InvalidData,
1234 "received multiple fields for union from remote TimeUnit"
1235 )
1236 )
1237 )
1238 } else {
1239 Ok(ret.expect("return value should have been constructed"))
1240 }
1241 }
1242 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1243 let struct_ident = TStructIdentifier::new("TimeUnit");
1244 o_prot.write_struct_begin(&struct_ident)?;
1245 match *self {
1246 TimeUnit::MILLIS(ref f) => {
1247 o_prot.write_field_begin(&TFieldIdentifier::new("MILLIS", TType::Struct, 1))?;
1248 f.write_to_out_protocol(o_prot)?;
1249 o_prot.write_field_end()?;
1250 },
1251 TimeUnit::MICROS(ref f) => {
1252 o_prot.write_field_begin(&TFieldIdentifier::new("MICROS", TType::Struct, 2))?;
1253 f.write_to_out_protocol(o_prot)?;
1254 o_prot.write_field_end()?;
1255 },
1256 TimeUnit::NANOS(ref f) => {
1257 o_prot.write_field_begin(&TFieldIdentifier::new("NANOS", TType::Struct, 3))?;
1258 f.write_to_out_protocol(o_prot)?;
1259 o_prot.write_field_end()?;
1260 },
1261 }
1262 o_prot.write_field_stop()?;
1263 o_prot.write_struct_end()
1264 }
1265}
1266
1267#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1275pub struct TimestampType {
1276 pub is_adjusted_to_u_t_c: bool,
1277 pub unit: TimeUnit,
1278}
1279
1280impl TimestampType {
1281 pub fn new(is_adjusted_to_u_t_c: bool, unit: TimeUnit) -> TimestampType {
1282 TimestampType {
1283 is_adjusted_to_u_t_c: is_adjusted_to_u_t_c,
1284 unit: unit,
1285 }
1286 }
1287 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TimestampType> {
1288 i_prot.read_struct_begin()?;
1289 let mut f_1: Option<bool> = None;
1290 let mut f_2: Option<TimeUnit> = None;
1291 loop {
1292 let field_ident = i_prot.read_field_begin()?;
1293 if field_ident.field_type == TType::Stop {
1294 break;
1295 }
1296 let field_id = field_id(&field_ident)?;
1297 match field_id {
1298 1 => {
1299 let val = i_prot.read_bool()?;
1300 f_1 = Some(val);
1301 },
1302 2 => {
1303 let val = TimeUnit::read_from_in_protocol(i_prot)?;
1304 f_2 = Some(val);
1305 },
1306 _ => {
1307 i_prot.skip(field_ident.field_type)?;
1308 },
1309 };
1310 i_prot.read_field_end()?;
1311 }
1312 i_prot.read_struct_end()?;
1313 verify_required_field_exists("TimestampType.is_adjusted_to_u_t_c", &f_1)?;
1314 verify_required_field_exists("TimestampType.unit", &f_2)?;
1315 let ret = TimestampType {
1316 is_adjusted_to_u_t_c: f_1.expect("auto-generated code should have checked for presence of required fields"),
1317 unit: f_2.expect("auto-generated code should have checked for presence of required fields"),
1318 };
1319 Ok(ret)
1320 }
1321 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1322 let struct_ident = TStructIdentifier::new("TimestampType");
1323 o_prot.write_struct_begin(&struct_ident)?;
1324 o_prot.write_field_begin(&TFieldIdentifier::new("isAdjustedToUTC", TType::Bool, 1))?;
1325 o_prot.write_bool(self.is_adjusted_to_u_t_c)?;
1326 o_prot.write_field_end()?;
1327 o_prot.write_field_begin(&TFieldIdentifier::new("unit", TType::Struct, 2))?;
1328 self.unit.write_to_out_protocol(o_prot)?;
1329 o_prot.write_field_end()?;
1330 o_prot.write_field_stop()?;
1331 o_prot.write_struct_end()
1332 }
1333}
1334
1335#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1343pub struct TimeType {
1344 pub is_adjusted_to_u_t_c: bool,
1345 pub unit: TimeUnit,
1346}
1347
1348impl TimeType {
1349 pub fn new(is_adjusted_to_u_t_c: bool, unit: TimeUnit) -> TimeType {
1350 TimeType {
1351 is_adjusted_to_u_t_c: is_adjusted_to_u_t_c,
1352 unit: unit,
1353 }
1354 }
1355 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TimeType> {
1356 i_prot.read_struct_begin()?;
1357 let mut f_1: Option<bool> = None;
1358 let mut f_2: Option<TimeUnit> = None;
1359 loop {
1360 let field_ident = i_prot.read_field_begin()?;
1361 if field_ident.field_type == TType::Stop {
1362 break;
1363 }
1364 let field_id = field_id(&field_ident)?;
1365 match field_id {
1366 1 => {
1367 let val = i_prot.read_bool()?;
1368 f_1 = Some(val);
1369 },
1370 2 => {
1371 let val = TimeUnit::read_from_in_protocol(i_prot)?;
1372 f_2 = Some(val);
1373 },
1374 _ => {
1375 i_prot.skip(field_ident.field_type)?;
1376 },
1377 };
1378 i_prot.read_field_end()?;
1379 }
1380 i_prot.read_struct_end()?;
1381 verify_required_field_exists("TimeType.is_adjusted_to_u_t_c", &f_1)?;
1382 verify_required_field_exists("TimeType.unit", &f_2)?;
1383 let ret = TimeType {
1384 is_adjusted_to_u_t_c: f_1.expect("auto-generated code should have checked for presence of required fields"),
1385 unit: f_2.expect("auto-generated code should have checked for presence of required fields"),
1386 };
1387 Ok(ret)
1388 }
1389 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1390 let struct_ident = TStructIdentifier::new("TimeType");
1391 o_prot.write_struct_begin(&struct_ident)?;
1392 o_prot.write_field_begin(&TFieldIdentifier::new("isAdjustedToUTC", TType::Bool, 1))?;
1393 o_prot.write_bool(self.is_adjusted_to_u_t_c)?;
1394 o_prot.write_field_end()?;
1395 o_prot.write_field_begin(&TFieldIdentifier::new("unit", TType::Struct, 2))?;
1396 self.unit.write_to_out_protocol(o_prot)?;
1397 o_prot.write_field_end()?;
1398 o_prot.write_field_stop()?;
1399 o_prot.write_struct_end()
1400 }
1401}
1402
1403#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1413pub struct IntType {
1414 pub bit_width: i8,
1415 pub is_signed: bool,
1416}
1417
1418impl IntType {
1419 pub fn new(bit_width: i8, is_signed: bool) -> IntType {
1420 IntType {
1421 bit_width: bit_width,
1422 is_signed: is_signed,
1423 }
1424 }
1425 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<IntType> {
1426 i_prot.read_struct_begin()?;
1427 let mut f_1: Option<i8> = None;
1428 let mut f_2: Option<bool> = None;
1429 loop {
1430 let field_ident = i_prot.read_field_begin()?;
1431 if field_ident.field_type == TType::Stop {
1432 break;
1433 }
1434 let field_id = field_id(&field_ident)?;
1435 match field_id {
1436 1 => {
1437 let val = i_prot.read_i8()?;
1438 f_1 = Some(val);
1439 },
1440 2 => {
1441 let val = i_prot.read_bool()?;
1442 f_2 = Some(val);
1443 },
1444 _ => {
1445 i_prot.skip(field_ident.field_type)?;
1446 },
1447 };
1448 i_prot.read_field_end()?;
1449 }
1450 i_prot.read_struct_end()?;
1451 verify_required_field_exists("IntType.bit_width", &f_1)?;
1452 verify_required_field_exists("IntType.is_signed", &f_2)?;
1453 let ret = IntType {
1454 bit_width: f_1.expect("auto-generated code should have checked for presence of required fields"),
1455 is_signed: f_2.expect("auto-generated code should have checked for presence of required fields"),
1456 };
1457 Ok(ret)
1458 }
1459 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1460 let struct_ident = TStructIdentifier::new("IntType");
1461 o_prot.write_struct_begin(&struct_ident)?;
1462 o_prot.write_field_begin(&TFieldIdentifier::new("bitWidth", TType::I08, 1))?;
1463 o_prot.write_i8(self.bit_width)?;
1464 o_prot.write_field_end()?;
1465 o_prot.write_field_begin(&TFieldIdentifier::new("isSigned", TType::Bool, 2))?;
1466 o_prot.write_bool(self.is_signed)?;
1467 o_prot.write_field_end()?;
1468 o_prot.write_field_stop()?;
1469 o_prot.write_struct_end()
1470 }
1471}
1472
1473#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1481pub struct JsonType {
1482}
1483
1484impl JsonType {
1485 pub fn new() -> JsonType {
1486 JsonType {}
1487 }
1488 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<JsonType> {
1489 i_prot.read_struct_begin()?;
1490 loop {
1491 let field_ident = i_prot.read_field_begin()?;
1492 if field_ident.field_type == TType::Stop {
1493 break;
1494 }
1495 let field_id = field_id(&field_ident)?;
1496 match field_id {
1497 _ => {
1498 i_prot.skip(field_ident.field_type)?;
1499 },
1500 };
1501 i_prot.read_field_end()?;
1502 }
1503 i_prot.read_struct_end()?;
1504 let ret = JsonType {};
1505 Ok(ret)
1506 }
1507 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1508 let struct_ident = TStructIdentifier::new("JsonType");
1509 o_prot.write_struct_begin(&struct_ident)?;
1510 o_prot.write_field_stop()?;
1511 o_prot.write_struct_end()
1512 }
1513}
1514
1515impl Default for JsonType {
1516 fn default() -> Self {
1517 JsonType{}
1518 }
1519}
1520
1521#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1529pub struct BsonType {
1530}
1531
1532impl BsonType {
1533 pub fn new() -> BsonType {
1534 BsonType {}
1535 }
1536 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<BsonType> {
1537 i_prot.read_struct_begin()?;
1538 loop {
1539 let field_ident = i_prot.read_field_begin()?;
1540 if field_ident.field_type == TType::Stop {
1541 break;
1542 }
1543 let field_id = field_id(&field_ident)?;
1544 match field_id {
1545 _ => {
1546 i_prot.skip(field_ident.field_type)?;
1547 },
1548 };
1549 i_prot.read_field_end()?;
1550 }
1551 i_prot.read_struct_end()?;
1552 let ret = BsonType {};
1553 Ok(ret)
1554 }
1555 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1556 let struct_ident = TStructIdentifier::new("BsonType");
1557 o_prot.write_struct_begin(&struct_ident)?;
1558 o_prot.write_field_stop()?;
1559 o_prot.write_struct_end()
1560 }
1561}
1562
1563impl Default for BsonType {
1564 fn default() -> Self {
1565 BsonType{}
1566 }
1567}
1568
1569#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1574pub enum LogicalType {
1575 STRING(StringType),
1576 MAP(MapType),
1577 LIST(ListType),
1578 ENUM(EnumType),
1579 DECIMAL(DecimalType),
1580 DATE(DateType),
1581 TIME(TimeType),
1582 TIMESTAMP(TimestampType),
1583 INTEGER(IntType),
1584 UNKNOWN(NullType),
1585 JSON(JsonType),
1586 BSON(BsonType),
1587 UUID(UUIDType),
1588}
1589
1590impl LogicalType {
1591 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<LogicalType> {
1592 let mut ret: Option<LogicalType> = None;
1593 let mut received_field_count = 0;
1594 i_prot.read_struct_begin()?;
1595 loop {
1596 let field_ident = i_prot.read_field_begin()?;
1597 if field_ident.field_type == TType::Stop {
1598 break;
1599 }
1600 let field_id = field_id(&field_ident)?;
1601 match field_id {
1602 1 => {
1603 let val = StringType::read_from_in_protocol(i_prot)?;
1604 if ret.is_none() {
1605 ret = Some(LogicalType::STRING(val));
1606 }
1607 received_field_count += 1;
1608 },
1609 2 => {
1610 let val = MapType::read_from_in_protocol(i_prot)?;
1611 if ret.is_none() {
1612 ret = Some(LogicalType::MAP(val));
1613 }
1614 received_field_count += 1;
1615 },
1616 3 => {
1617 let val = ListType::read_from_in_protocol(i_prot)?;
1618 if ret.is_none() {
1619 ret = Some(LogicalType::LIST(val));
1620 }
1621 received_field_count += 1;
1622 },
1623 4 => {
1624 let val = EnumType::read_from_in_protocol(i_prot)?;
1625 if ret.is_none() {
1626 ret = Some(LogicalType::ENUM(val));
1627 }
1628 received_field_count += 1;
1629 },
1630 5 => {
1631 let val = DecimalType::read_from_in_protocol(i_prot)?;
1632 if ret.is_none() {
1633 ret = Some(LogicalType::DECIMAL(val));
1634 }
1635 received_field_count += 1;
1636 },
1637 6 => {
1638 let val = DateType::read_from_in_protocol(i_prot)?;
1639 if ret.is_none() {
1640 ret = Some(LogicalType::DATE(val));
1641 }
1642 received_field_count += 1;
1643 },
1644 7 => {
1645 let val = TimeType::read_from_in_protocol(i_prot)?;
1646 if ret.is_none() {
1647 ret = Some(LogicalType::TIME(val));
1648 }
1649 received_field_count += 1;
1650 },
1651 8 => {
1652 let val = TimestampType::read_from_in_protocol(i_prot)?;
1653 if ret.is_none() {
1654 ret = Some(LogicalType::TIMESTAMP(val));
1655 }
1656 received_field_count += 1;
1657 },
1658 10 => {
1659 let val = IntType::read_from_in_protocol(i_prot)?;
1660 if ret.is_none() {
1661 ret = Some(LogicalType::INTEGER(val));
1662 }
1663 received_field_count += 1;
1664 },
1665 11 => {
1666 let val = NullType::read_from_in_protocol(i_prot)?;
1667 if ret.is_none() {
1668 ret = Some(LogicalType::UNKNOWN(val));
1669 }
1670 received_field_count += 1;
1671 },
1672 12 => {
1673 let val = JsonType::read_from_in_protocol(i_prot)?;
1674 if ret.is_none() {
1675 ret = Some(LogicalType::JSON(val));
1676 }
1677 received_field_count += 1;
1678 },
1679 13 => {
1680 let val = BsonType::read_from_in_protocol(i_prot)?;
1681 if ret.is_none() {
1682 ret = Some(LogicalType::BSON(val));
1683 }
1684 received_field_count += 1;
1685 },
1686 14 => {
1687 let val = UUIDType::read_from_in_protocol(i_prot)?;
1688 if ret.is_none() {
1689 ret = Some(LogicalType::UUID(val));
1690 }
1691 received_field_count += 1;
1692 },
1693 _ => {
1694 i_prot.skip(field_ident.field_type)?;
1695 received_field_count += 1;
1696 },
1697 };
1698 i_prot.read_field_end()?;
1699 }
1700 i_prot.read_struct_end()?;
1701 if received_field_count == 0 {
1702 Err(
1703 thrift::Error::Protocol(
1704 ProtocolError::new(
1705 ProtocolErrorKind::InvalidData,
1706 "received empty union from remote LogicalType"
1707 )
1708 )
1709 )
1710 } else if received_field_count > 1 {
1711 Err(
1712 thrift::Error::Protocol(
1713 ProtocolError::new(
1714 ProtocolErrorKind::InvalidData,
1715 "received multiple fields for union from remote LogicalType"
1716 )
1717 )
1718 )
1719 } else {
1720 Ok(ret.expect("return value should have been constructed"))
1721 }
1722 }
1723 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1724 let struct_ident = TStructIdentifier::new("LogicalType");
1725 o_prot.write_struct_begin(&struct_ident)?;
1726 match *self {
1727 LogicalType::STRING(ref f) => {
1728 o_prot.write_field_begin(&TFieldIdentifier::new("STRING", TType::Struct, 1))?;
1729 f.write_to_out_protocol(o_prot)?;
1730 o_prot.write_field_end()?;
1731 },
1732 LogicalType::MAP(ref f) => {
1733 o_prot.write_field_begin(&TFieldIdentifier::new("MAP", TType::Struct, 2))?;
1734 f.write_to_out_protocol(o_prot)?;
1735 o_prot.write_field_end()?;
1736 },
1737 LogicalType::LIST(ref f) => {
1738 o_prot.write_field_begin(&TFieldIdentifier::new("LIST", TType::Struct, 3))?;
1739 f.write_to_out_protocol(o_prot)?;
1740 o_prot.write_field_end()?;
1741 },
1742 LogicalType::ENUM(ref f) => {
1743 o_prot.write_field_begin(&TFieldIdentifier::new("ENUM", TType::Struct, 4))?;
1744 f.write_to_out_protocol(o_prot)?;
1745 o_prot.write_field_end()?;
1746 },
1747 LogicalType::DECIMAL(ref f) => {
1748 o_prot.write_field_begin(&TFieldIdentifier::new("DECIMAL", TType::Struct, 5))?;
1749 f.write_to_out_protocol(o_prot)?;
1750 o_prot.write_field_end()?;
1751 },
1752 LogicalType::DATE(ref f) => {
1753 o_prot.write_field_begin(&TFieldIdentifier::new("DATE", TType::Struct, 6))?;
1754 f.write_to_out_protocol(o_prot)?;
1755 o_prot.write_field_end()?;
1756 },
1757 LogicalType::TIME(ref f) => {
1758 o_prot.write_field_begin(&TFieldIdentifier::new("TIME", TType::Struct, 7))?;
1759 f.write_to_out_protocol(o_prot)?;
1760 o_prot.write_field_end()?;
1761 },
1762 LogicalType::TIMESTAMP(ref f) => {
1763 o_prot.write_field_begin(&TFieldIdentifier::new("TIMESTAMP", TType::Struct, 8))?;
1764 f.write_to_out_protocol(o_prot)?;
1765 o_prot.write_field_end()?;
1766 },
1767 LogicalType::INTEGER(ref f) => {
1768 o_prot.write_field_begin(&TFieldIdentifier::new("INTEGER", TType::Struct, 10))?;
1769 f.write_to_out_protocol(o_prot)?;
1770 o_prot.write_field_end()?;
1771 },
1772 LogicalType::UNKNOWN(ref f) => {
1773 o_prot.write_field_begin(&TFieldIdentifier::new("UNKNOWN", TType::Struct, 11))?;
1774 f.write_to_out_protocol(o_prot)?;
1775 o_prot.write_field_end()?;
1776 },
1777 LogicalType::JSON(ref f) => {
1778 o_prot.write_field_begin(&TFieldIdentifier::new("JSON", TType::Struct, 12))?;
1779 f.write_to_out_protocol(o_prot)?;
1780 o_prot.write_field_end()?;
1781 },
1782 LogicalType::BSON(ref f) => {
1783 o_prot.write_field_begin(&TFieldIdentifier::new("BSON", TType::Struct, 13))?;
1784 f.write_to_out_protocol(o_prot)?;
1785 o_prot.write_field_end()?;
1786 },
1787 LogicalType::UUID(ref f) => {
1788 o_prot.write_field_begin(&TFieldIdentifier::new("UUID", TType::Struct, 14))?;
1789 f.write_to_out_protocol(o_prot)?;
1790 o_prot.write_field_end()?;
1791 },
1792 }
1793 o_prot.write_field_stop()?;
1794 o_prot.write_struct_end()
1795 }
1796}
1797
1798#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1807pub struct SchemaElement {
1808 pub type_: Option<Type>,
1810 pub type_length: Option<i32>,
1815 pub repetition_type: Option<FieldRepetitionType>,
1818 pub name: String,
1820 pub num_children: Option<i32>,
1825 pub converted_type: Option<ConvertedType>,
1828 pub scale: Option<i32>,
1831 pub precision: Option<i32>,
1832 pub field_id: Option<i32>,
1835 pub logical_type: Option<LogicalType>,
1840}
1841
1842impl SchemaElement {
1843 pub fn new<F1, F2, F3, F5, F6, F7, F8, F9, F10>(type_: F1, type_length: F2, repetition_type: F3, name: String, num_children: F5, converted_type: F6, scale: F7, precision: F8, field_id: F9, logical_type: F10) -> SchemaElement where F1: Into<Option<Type>>, F2: Into<Option<i32>>, F3: Into<Option<FieldRepetitionType>>, F5: Into<Option<i32>>, F6: Into<Option<ConvertedType>>, F7: Into<Option<i32>>, F8: Into<Option<i32>>, F9: Into<Option<i32>>, F10: Into<Option<LogicalType>> {
1844 SchemaElement {
1845 type_: type_.into(),
1846 type_length: type_length.into(),
1847 repetition_type: repetition_type.into(),
1848 name: name,
1849 num_children: num_children.into(),
1850 converted_type: converted_type.into(),
1851 scale: scale.into(),
1852 precision: precision.into(),
1853 field_id: field_id.into(),
1854 logical_type: logical_type.into(),
1855 }
1856 }
1857 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<SchemaElement> {
1858 i_prot.read_struct_begin()?;
1859 let mut f_1: Option<Type> = None;
1860 let mut f_2: Option<i32> = None;
1861 let mut f_3: Option<FieldRepetitionType> = None;
1862 let mut f_4: Option<String> = None;
1863 let mut f_5: Option<i32> = None;
1864 let mut f_6: Option<ConvertedType> = None;
1865 let mut f_7: Option<i32> = None;
1866 let mut f_8: Option<i32> = None;
1867 let mut f_9: Option<i32> = None;
1868 let mut f_10: Option<LogicalType> = None;
1869 loop {
1870 let field_ident = i_prot.read_field_begin()?;
1871 if field_ident.field_type == TType::Stop {
1872 break;
1873 }
1874 let field_id = field_id(&field_ident)?;
1875 match field_id {
1876 1 => {
1877 let val = Type::read_from_in_protocol(i_prot)?;
1878 f_1 = Some(val);
1879 },
1880 2 => {
1881 let val = i_prot.read_i32()?;
1882 f_2 = Some(val);
1883 },
1884 3 => {
1885 let val = FieldRepetitionType::read_from_in_protocol(i_prot)?;
1886 f_3 = Some(val);
1887 },
1888 4 => {
1889 let val = i_prot.read_string()?;
1890 f_4 = Some(val);
1891 },
1892 5 => {
1893 let val = i_prot.read_i32()?;
1894 f_5 = Some(val);
1895 },
1896 6 => {
1897 let val = ConvertedType::read_from_in_protocol(i_prot)?;
1898 f_6 = Some(val);
1899 },
1900 7 => {
1901 let val = i_prot.read_i32()?;
1902 f_7 = Some(val);
1903 },
1904 8 => {
1905 let val = i_prot.read_i32()?;
1906 f_8 = Some(val);
1907 },
1908 9 => {
1909 let val = i_prot.read_i32()?;
1910 f_9 = Some(val);
1911 },
1912 10 => {
1913 let val = LogicalType::read_from_in_protocol(i_prot)?;
1914 f_10 = Some(val);
1915 },
1916 _ => {
1917 i_prot.skip(field_ident.field_type)?;
1918 },
1919 };
1920 i_prot.read_field_end()?;
1921 }
1922 i_prot.read_struct_end()?;
1923 verify_required_field_exists("SchemaElement.name", &f_4)?;
1924 let ret = SchemaElement {
1925 type_: f_1,
1926 type_length: f_2,
1927 repetition_type: f_3,
1928 name: f_4.expect("auto-generated code should have checked for presence of required fields"),
1929 num_children: f_5,
1930 converted_type: f_6,
1931 scale: f_7,
1932 precision: f_8,
1933 field_id: f_9,
1934 logical_type: f_10,
1935 };
1936 Ok(ret)
1937 }
1938 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1939 let struct_ident = TStructIdentifier::new("SchemaElement");
1940 o_prot.write_struct_begin(&struct_ident)?;
1941 if let Some(ref fld_var) = self.type_ {
1942 o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1))?;
1943 fld_var.write_to_out_protocol(o_prot)?;
1944 o_prot.write_field_end()?;
1945 ()
1946 } else {
1947 ()
1948 }
1949 if let Some(fld_var) = self.type_length {
1950 o_prot.write_field_begin(&TFieldIdentifier::new("type_length", TType::I32, 2))?;
1951 o_prot.write_i32(fld_var)?;
1952 o_prot.write_field_end()?;
1953 ()
1954 } else {
1955 ()
1956 }
1957 if let Some(ref fld_var) = self.repetition_type {
1958 o_prot.write_field_begin(&TFieldIdentifier::new("repetition_type", TType::I32, 3))?;
1959 fld_var.write_to_out_protocol(o_prot)?;
1960 o_prot.write_field_end()?;
1961 ()
1962 } else {
1963 ()
1964 }
1965 o_prot.write_field_begin(&TFieldIdentifier::new("name", TType::String, 4))?;
1966 o_prot.write_string(&self.name)?;
1967 o_prot.write_field_end()?;
1968 if let Some(fld_var) = self.num_children {
1969 o_prot.write_field_begin(&TFieldIdentifier::new("num_children", TType::I32, 5))?;
1970 o_prot.write_i32(fld_var)?;
1971 o_prot.write_field_end()?;
1972 ()
1973 } else {
1974 ()
1975 }
1976 if let Some(ref fld_var) = self.converted_type {
1977 o_prot.write_field_begin(&TFieldIdentifier::new("converted_type", TType::I32, 6))?;
1978 fld_var.write_to_out_protocol(o_prot)?;
1979 o_prot.write_field_end()?;
1980 ()
1981 } else {
1982 ()
1983 }
1984 if let Some(fld_var) = self.scale {
1985 o_prot.write_field_begin(&TFieldIdentifier::new("scale", TType::I32, 7))?;
1986 o_prot.write_i32(fld_var)?;
1987 o_prot.write_field_end()?;
1988 ()
1989 } else {
1990 ()
1991 }
1992 if let Some(fld_var) = self.precision {
1993 o_prot.write_field_begin(&TFieldIdentifier::new("precision", TType::I32, 8))?;
1994 o_prot.write_i32(fld_var)?;
1995 o_prot.write_field_end()?;
1996 ()
1997 } else {
1998 ()
1999 }
2000 if let Some(fld_var) = self.field_id {
2001 o_prot.write_field_begin(&TFieldIdentifier::new("field_id", TType::I32, 9))?;
2002 o_prot.write_i32(fld_var)?;
2003 o_prot.write_field_end()?;
2004 ()
2005 } else {
2006 ()
2007 }
2008 if let Some(ref fld_var) = self.logical_type {
2009 o_prot.write_field_begin(&TFieldIdentifier::new("logicalType", TType::Struct, 10))?;
2010 fld_var.write_to_out_protocol(o_prot)?;
2011 o_prot.write_field_end()?;
2012 ()
2013 } else {
2014 ()
2015 }
2016 o_prot.write_field_stop()?;
2017 o_prot.write_struct_end()
2018 }
2019}
2020
2021#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2027pub struct DataPageHeader {
2028 pub num_values: i32,
2030 pub encoding: Encoding,
2032 pub definition_level_encoding: Encoding,
2034 pub repetition_level_encoding: Encoding,
2036 pub statistics: Option<Statistics>,
2038}
2039
2040impl DataPageHeader {
2041 pub fn new<F5>(num_values: i32, encoding: Encoding, definition_level_encoding: Encoding, repetition_level_encoding: Encoding, statistics: F5) -> DataPageHeader where F5: Into<Option<Statistics>> {
2042 DataPageHeader {
2043 num_values: num_values,
2044 encoding: encoding,
2045 definition_level_encoding: definition_level_encoding,
2046 repetition_level_encoding: repetition_level_encoding,
2047 statistics: statistics.into(),
2048 }
2049 }
2050 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<DataPageHeader> {
2051 i_prot.read_struct_begin()?;
2052 let mut f_1: Option<i32> = None;
2053 let mut f_2: Option<Encoding> = None;
2054 let mut f_3: Option<Encoding> = None;
2055 let mut f_4: Option<Encoding> = None;
2056 let mut f_5: Option<Statistics> = None;
2057 loop {
2058 let field_ident = i_prot.read_field_begin()?;
2059 if field_ident.field_type == TType::Stop {
2060 break;
2061 }
2062 let field_id = field_id(&field_ident)?;
2063 match field_id {
2064 1 => {
2065 let val = i_prot.read_i32()?;
2066 f_1 = Some(val);
2067 },
2068 2 => {
2069 let val = Encoding::read_from_in_protocol(i_prot)?;
2070 f_2 = Some(val);
2071 },
2072 3 => {
2073 let val = Encoding::read_from_in_protocol(i_prot)?;
2074 f_3 = Some(val);
2075 },
2076 4 => {
2077 let val = Encoding::read_from_in_protocol(i_prot)?;
2078 f_4 = Some(val);
2079 },
2080 5 => {
2081 let val = Statistics::read_from_in_protocol(i_prot)?;
2082 f_5 = Some(val);
2083 },
2084 _ => {
2085 i_prot.skip(field_ident.field_type)?;
2086 },
2087 };
2088 i_prot.read_field_end()?;
2089 }
2090 i_prot.read_struct_end()?;
2091 verify_required_field_exists("DataPageHeader.num_values", &f_1)?;
2092 verify_required_field_exists("DataPageHeader.encoding", &f_2)?;
2093 verify_required_field_exists("DataPageHeader.definition_level_encoding", &f_3)?;
2094 verify_required_field_exists("DataPageHeader.repetition_level_encoding", &f_4)?;
2095 let ret = DataPageHeader {
2096 num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
2097 encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
2098 definition_level_encoding: f_3.expect("auto-generated code should have checked for presence of required fields"),
2099 repetition_level_encoding: f_4.expect("auto-generated code should have checked for presence of required fields"),
2100 statistics: f_5,
2101 };
2102 Ok(ret)
2103 }
2104 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2105 let struct_ident = TStructIdentifier::new("DataPageHeader");
2106 o_prot.write_struct_begin(&struct_ident)?;
2107 o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1))?;
2108 o_prot.write_i32(self.num_values)?;
2109 o_prot.write_field_end()?;
2110 o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2))?;
2111 self.encoding.write_to_out_protocol(o_prot)?;
2112 o_prot.write_field_end()?;
2113 o_prot.write_field_begin(&TFieldIdentifier::new("definition_level_encoding", TType::I32, 3))?;
2114 self.definition_level_encoding.write_to_out_protocol(o_prot)?;
2115 o_prot.write_field_end()?;
2116 o_prot.write_field_begin(&TFieldIdentifier::new("repetition_level_encoding", TType::I32, 4))?;
2117 self.repetition_level_encoding.write_to_out_protocol(o_prot)?;
2118 o_prot.write_field_end()?;
2119 if let Some(ref fld_var) = self.statistics {
2120 o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 5))?;
2121 fld_var.write_to_out_protocol(o_prot)?;
2122 o_prot.write_field_end()?;
2123 ()
2124 } else {
2125 ()
2126 }
2127 o_prot.write_field_stop()?;
2128 o_prot.write_struct_end()
2129 }
2130}
2131
2132#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2137pub struct IndexPageHeader {
2138}
2139
2140impl IndexPageHeader {
2141 pub fn new() -> IndexPageHeader {
2142 IndexPageHeader {}
2143 }
2144 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<IndexPageHeader> {
2145 i_prot.read_struct_begin()?;
2146 loop {
2147 let field_ident = i_prot.read_field_begin()?;
2148 if field_ident.field_type == TType::Stop {
2149 break;
2150 }
2151 let field_id = field_id(&field_ident)?;
2152 match field_id {
2153 _ => {
2154 i_prot.skip(field_ident.field_type)?;
2155 },
2156 };
2157 i_prot.read_field_end()?;
2158 }
2159 i_prot.read_struct_end()?;
2160 let ret = IndexPageHeader {};
2161 Ok(ret)
2162 }
2163 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2164 let struct_ident = TStructIdentifier::new("IndexPageHeader");
2165 o_prot.write_struct_begin(&struct_ident)?;
2166 o_prot.write_field_stop()?;
2167 o_prot.write_struct_end()
2168 }
2169}
2170
2171impl Default for IndexPageHeader {
2172 fn default() -> Self {
2173 IndexPageHeader{}
2174 }
2175}
2176
2177#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2182pub struct DictionaryPageHeader {
2183 pub num_values: i32,
2185 pub encoding: Encoding,
2187 pub is_sorted: Option<bool>,
2189}
2190
2191impl DictionaryPageHeader {
2192 pub fn new<F3>(num_values: i32, encoding: Encoding, is_sorted: F3) -> DictionaryPageHeader where F3: Into<Option<bool>> {
2193 DictionaryPageHeader {
2194 num_values: num_values,
2195 encoding: encoding,
2196 is_sorted: is_sorted.into(),
2197 }
2198 }
2199 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<DictionaryPageHeader> {
2200 i_prot.read_struct_begin()?;
2201 let mut f_1: Option<i32> = None;
2202 let mut f_2: Option<Encoding> = None;
2203 let mut f_3: Option<bool> = None;
2204 loop {
2205 let field_ident = i_prot.read_field_begin()?;
2206 if field_ident.field_type == TType::Stop {
2207 break;
2208 }
2209 let field_id = field_id(&field_ident)?;
2210 match field_id {
2211 1 => {
2212 let val = i_prot.read_i32()?;
2213 f_1 = Some(val);
2214 },
2215 2 => {
2216 let val = Encoding::read_from_in_protocol(i_prot)?;
2217 f_2 = Some(val);
2218 },
2219 3 => {
2220 let val = i_prot.read_bool()?;
2221 f_3 = Some(val);
2222 },
2223 _ => {
2224 i_prot.skip(field_ident.field_type)?;
2225 },
2226 };
2227 i_prot.read_field_end()?;
2228 }
2229 i_prot.read_struct_end()?;
2230 verify_required_field_exists("DictionaryPageHeader.num_values", &f_1)?;
2231 verify_required_field_exists("DictionaryPageHeader.encoding", &f_2)?;
2232 let ret = DictionaryPageHeader {
2233 num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
2234 encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
2235 is_sorted: f_3,
2236 };
2237 Ok(ret)
2238 }
2239 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2240 let struct_ident = TStructIdentifier::new("DictionaryPageHeader");
2241 o_prot.write_struct_begin(&struct_ident)?;
2242 o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1))?;
2243 o_prot.write_i32(self.num_values)?;
2244 o_prot.write_field_end()?;
2245 o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2))?;
2246 self.encoding.write_to_out_protocol(o_prot)?;
2247 o_prot.write_field_end()?;
2248 if let Some(fld_var) = self.is_sorted {
2249 o_prot.write_field_begin(&TFieldIdentifier::new("is_sorted", TType::Bool, 3))?;
2250 o_prot.write_bool(fld_var)?;
2251 o_prot.write_field_end()?;
2252 ()
2253 } else {
2254 ()
2255 }
2256 o_prot.write_field_stop()?;
2257 o_prot.write_struct_end()
2258 }
2259}
2260
2261#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2270pub struct DataPageHeaderV2 {
2271 pub num_values: i32,
2273 pub num_nulls: i32,
2276 pub num_rows: i32,
2278 pub encoding: Encoding,
2280 pub definition_levels_byte_length: i32,
2282 pub repetition_levels_byte_length: i32,
2284 pub is_compressed: Option<bool>,
2290 pub statistics: Option<Statistics>,
2292}
2293
2294impl DataPageHeaderV2 {
2295 pub fn new<F7, F8>(num_values: i32, num_nulls: i32, num_rows: i32, encoding: Encoding, definition_levels_byte_length: i32, repetition_levels_byte_length: i32, is_compressed: F7, statistics: F8) -> DataPageHeaderV2 where F7: Into<Option<bool>>, F8: Into<Option<Statistics>> {
2296 DataPageHeaderV2 {
2297 num_values: num_values,
2298 num_nulls: num_nulls,
2299 num_rows: num_rows,
2300 encoding: encoding,
2301 definition_levels_byte_length: definition_levels_byte_length,
2302 repetition_levels_byte_length: repetition_levels_byte_length,
2303 is_compressed: is_compressed.into(),
2304 statistics: statistics.into(),
2305 }
2306 }
2307 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<DataPageHeaderV2> {
2308 i_prot.read_struct_begin()?;
2309 let mut f_1: Option<i32> = None;
2310 let mut f_2: Option<i32> = None;
2311 let mut f_3: Option<i32> = None;
2312 let mut f_4: Option<Encoding> = None;
2313 let mut f_5: Option<i32> = None;
2314 let mut f_6: Option<i32> = None;
2315 let mut f_7: Option<bool> = None;
2316 let mut f_8: Option<Statistics> = None;
2317 loop {
2318 let field_ident = i_prot.read_field_begin()?;
2319 if field_ident.field_type == TType::Stop {
2320 break;
2321 }
2322 let field_id = field_id(&field_ident)?;
2323 match field_id {
2324 1 => {
2325 let val = i_prot.read_i32()?;
2326 f_1 = Some(val);
2327 },
2328 2 => {
2329 let val = i_prot.read_i32()?;
2330 f_2 = Some(val);
2331 },
2332 3 => {
2333 let val = i_prot.read_i32()?;
2334 f_3 = Some(val);
2335 },
2336 4 => {
2337 let val = Encoding::read_from_in_protocol(i_prot)?;
2338 f_4 = Some(val);
2339 },
2340 5 => {
2341 let val = i_prot.read_i32()?;
2342 f_5 = Some(val);
2343 },
2344 6 => {
2345 let val = i_prot.read_i32()?;
2346 f_6 = Some(val);
2347 },
2348 7 => {
2349 let val = i_prot.read_bool()?;
2350 f_7 = Some(val);
2351 },
2352 8 => {
2353 let val = Statistics::read_from_in_protocol(i_prot)?;
2354 f_8 = Some(val);
2355 },
2356 _ => {
2357 i_prot.skip(field_ident.field_type)?;
2358 },
2359 };
2360 i_prot.read_field_end()?;
2361 }
2362 i_prot.read_struct_end()?;
2363 verify_required_field_exists("DataPageHeaderV2.num_values", &f_1)?;
2364 verify_required_field_exists("DataPageHeaderV2.num_nulls", &f_2)?;
2365 verify_required_field_exists("DataPageHeaderV2.num_rows", &f_3)?;
2366 verify_required_field_exists("DataPageHeaderV2.encoding", &f_4)?;
2367 verify_required_field_exists("DataPageHeaderV2.definition_levels_byte_length", &f_5)?;
2368 verify_required_field_exists("DataPageHeaderV2.repetition_levels_byte_length", &f_6)?;
2369 let ret = DataPageHeaderV2 {
2370 num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
2371 num_nulls: f_2.expect("auto-generated code should have checked for presence of required fields"),
2372 num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
2373 encoding: f_4.expect("auto-generated code should have checked for presence of required fields"),
2374 definition_levels_byte_length: f_5.expect("auto-generated code should have checked for presence of required fields"),
2375 repetition_levels_byte_length: f_6.expect("auto-generated code should have checked for presence of required fields"),
2376 is_compressed: f_7,
2377 statistics: f_8,
2378 };
2379 Ok(ret)
2380 }
2381 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2382 let struct_ident = TStructIdentifier::new("DataPageHeaderV2");
2383 o_prot.write_struct_begin(&struct_ident)?;
2384 o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1))?;
2385 o_prot.write_i32(self.num_values)?;
2386 o_prot.write_field_end()?;
2387 o_prot.write_field_begin(&TFieldIdentifier::new("num_nulls", TType::I32, 2))?;
2388 o_prot.write_i32(self.num_nulls)?;
2389 o_prot.write_field_end()?;
2390 o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I32, 3))?;
2391 o_prot.write_i32(self.num_rows)?;
2392 o_prot.write_field_end()?;
2393 o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 4))?;
2394 self.encoding.write_to_out_protocol(o_prot)?;
2395 o_prot.write_field_end()?;
2396 o_prot.write_field_begin(&TFieldIdentifier::new("definition_levels_byte_length", TType::I32, 5))?;
2397 o_prot.write_i32(self.definition_levels_byte_length)?;
2398 o_prot.write_field_end()?;
2399 o_prot.write_field_begin(&TFieldIdentifier::new("repetition_levels_byte_length", TType::I32, 6))?;
2400 o_prot.write_i32(self.repetition_levels_byte_length)?;
2401 o_prot.write_field_end()?;
2402 if let Some(fld_var) = self.is_compressed {
2403 o_prot.write_field_begin(&TFieldIdentifier::new("is_compressed", TType::Bool, 7))?;
2404 o_prot.write_bool(fld_var)?;
2405 o_prot.write_field_end()?;
2406 ()
2407 } else {
2408 ()
2409 }
2410 if let Some(ref fld_var) = self.statistics {
2411 o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 8))?;
2412 fld_var.write_to_out_protocol(o_prot)?;
2413 o_prot.write_field_end()?;
2414 ()
2415 } else {
2416 ()
2417 }
2418 o_prot.write_field_stop()?;
2419 o_prot.write_struct_end()
2420 }
2421}
2422
2423#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2429pub struct SplitBlockAlgorithm {
2430}
2431
2432impl SplitBlockAlgorithm {
2433 pub fn new() -> SplitBlockAlgorithm {
2434 SplitBlockAlgorithm {}
2435 }
2436 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<SplitBlockAlgorithm> {
2437 i_prot.read_struct_begin()?;
2438 loop {
2439 let field_ident = i_prot.read_field_begin()?;
2440 if field_ident.field_type == TType::Stop {
2441 break;
2442 }
2443 let field_id = field_id(&field_ident)?;
2444 match field_id {
2445 _ => {
2446 i_prot.skip(field_ident.field_type)?;
2447 },
2448 };
2449 i_prot.read_field_end()?;
2450 }
2451 i_prot.read_struct_end()?;
2452 let ret = SplitBlockAlgorithm {};
2453 Ok(ret)
2454 }
2455 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2456 let struct_ident = TStructIdentifier::new("SplitBlockAlgorithm");
2457 o_prot.write_struct_begin(&struct_ident)?;
2458 o_prot.write_field_stop()?;
2459 o_prot.write_struct_end()
2460 }
2461}
2462
2463impl Default for SplitBlockAlgorithm {
2464 fn default() -> Self {
2465 SplitBlockAlgorithm{}
2466 }
2467}
2468
2469#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2474pub enum BloomFilterAlgorithm {
2475 BLOCK(SplitBlockAlgorithm),
2476}
2477
2478impl BloomFilterAlgorithm {
2479 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<BloomFilterAlgorithm> {
2480 let mut ret: Option<BloomFilterAlgorithm> = None;
2481 let mut received_field_count = 0;
2482 i_prot.read_struct_begin()?;
2483 loop {
2484 let field_ident = i_prot.read_field_begin()?;
2485 if field_ident.field_type == TType::Stop {
2486 break;
2487 }
2488 let field_id = field_id(&field_ident)?;
2489 match field_id {
2490 1 => {
2491 let val = SplitBlockAlgorithm::read_from_in_protocol(i_prot)?;
2492 if ret.is_none() {
2493 ret = Some(BloomFilterAlgorithm::BLOCK(val));
2494 }
2495 received_field_count += 1;
2496 },
2497 _ => {
2498 i_prot.skip(field_ident.field_type)?;
2499 received_field_count += 1;
2500 },
2501 };
2502 i_prot.read_field_end()?;
2503 }
2504 i_prot.read_struct_end()?;
2505 if received_field_count == 0 {
2506 Err(
2507 thrift::Error::Protocol(
2508 ProtocolError::new(
2509 ProtocolErrorKind::InvalidData,
2510 "received empty union from remote BloomFilterAlgorithm"
2511 )
2512 )
2513 )
2514 } else if received_field_count > 1 {
2515 Err(
2516 thrift::Error::Protocol(
2517 ProtocolError::new(
2518 ProtocolErrorKind::InvalidData,
2519 "received multiple fields for union from remote BloomFilterAlgorithm"
2520 )
2521 )
2522 )
2523 } else {
2524 Ok(ret.expect("return value should have been constructed"))
2525 }
2526 }
2527 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2528 let struct_ident = TStructIdentifier::new("BloomFilterAlgorithm");
2529 o_prot.write_struct_begin(&struct_ident)?;
2530 match *self {
2531 BloomFilterAlgorithm::BLOCK(ref f) => {
2532 o_prot.write_field_begin(&TFieldIdentifier::new("BLOCK", TType::Struct, 1))?;
2533 f.write_to_out_protocol(o_prot)?;
2534 o_prot.write_field_end()?;
2535 },
2536 }
2537 o_prot.write_field_stop()?;
2538 o_prot.write_struct_end()
2539 }
2540}
2541
2542#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2550pub struct XxHash {
2551}
2552
2553impl XxHash {
2554 pub fn new() -> XxHash {
2555 XxHash {}
2556 }
2557 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<XxHash> {
2558 i_prot.read_struct_begin()?;
2559 loop {
2560 let field_ident = i_prot.read_field_begin()?;
2561 if field_ident.field_type == TType::Stop {
2562 break;
2563 }
2564 let field_id = field_id(&field_ident)?;
2565 match field_id {
2566 _ => {
2567 i_prot.skip(field_ident.field_type)?;
2568 },
2569 };
2570 i_prot.read_field_end()?;
2571 }
2572 i_prot.read_struct_end()?;
2573 let ret = XxHash {};
2574 Ok(ret)
2575 }
2576 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2577 let struct_ident = TStructIdentifier::new("XxHash");
2578 o_prot.write_struct_begin(&struct_ident)?;
2579 o_prot.write_field_stop()?;
2580 o_prot.write_struct_end()
2581 }
2582}
2583
2584impl Default for XxHash {
2585 fn default() -> Self {
2586 XxHash{}
2587 }
2588}
2589
2590#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2595pub enum BloomFilterHash {
2596 XXHASH(XxHash),
2597}
2598
2599impl BloomFilterHash {
2600 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<BloomFilterHash> {
2601 let mut ret: Option<BloomFilterHash> = None;
2602 let mut received_field_count = 0;
2603 i_prot.read_struct_begin()?;
2604 loop {
2605 let field_ident = i_prot.read_field_begin()?;
2606 if field_ident.field_type == TType::Stop {
2607 break;
2608 }
2609 let field_id = field_id(&field_ident)?;
2610 match field_id {
2611 1 => {
2612 let val = XxHash::read_from_in_protocol(i_prot)?;
2613 if ret.is_none() {
2614 ret = Some(BloomFilterHash::XXHASH(val));
2615 }
2616 received_field_count += 1;
2617 },
2618 _ => {
2619 i_prot.skip(field_ident.field_type)?;
2620 received_field_count += 1;
2621 },
2622 };
2623 i_prot.read_field_end()?;
2624 }
2625 i_prot.read_struct_end()?;
2626 if received_field_count == 0 {
2627 Err(
2628 thrift::Error::Protocol(
2629 ProtocolError::new(
2630 ProtocolErrorKind::InvalidData,
2631 "received empty union from remote BloomFilterHash"
2632 )
2633 )
2634 )
2635 } else if received_field_count > 1 {
2636 Err(
2637 thrift::Error::Protocol(
2638 ProtocolError::new(
2639 ProtocolErrorKind::InvalidData,
2640 "received multiple fields for union from remote BloomFilterHash"
2641 )
2642 )
2643 )
2644 } else {
2645 Ok(ret.expect("return value should have been constructed"))
2646 }
2647 }
2648 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2649 let struct_ident = TStructIdentifier::new("BloomFilterHash");
2650 o_prot.write_struct_begin(&struct_ident)?;
2651 match *self {
2652 BloomFilterHash::XXHASH(ref f) => {
2653 o_prot.write_field_begin(&TFieldIdentifier::new("XXHASH", TType::Struct, 1))?;
2654 f.write_to_out_protocol(o_prot)?;
2655 o_prot.write_field_end()?;
2656 },
2657 }
2658 o_prot.write_field_stop()?;
2659 o_prot.write_struct_end()
2660 }
2661}
2662
2663#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2670pub struct Uncompressed {
2671}
2672
2673impl Uncompressed {
2674 pub fn new() -> Uncompressed {
2675 Uncompressed {}
2676 }
2677 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<Uncompressed> {
2678 i_prot.read_struct_begin()?;
2679 loop {
2680 let field_ident = i_prot.read_field_begin()?;
2681 if field_ident.field_type == TType::Stop {
2682 break;
2683 }
2684 let field_id = field_id(&field_ident)?;
2685 match field_id {
2686 _ => {
2687 i_prot.skip(field_ident.field_type)?;
2688 },
2689 };
2690 i_prot.read_field_end()?;
2691 }
2692 i_prot.read_struct_end()?;
2693 let ret = Uncompressed {};
2694 Ok(ret)
2695 }
2696 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2697 let struct_ident = TStructIdentifier::new("Uncompressed");
2698 o_prot.write_struct_begin(&struct_ident)?;
2699 o_prot.write_field_stop()?;
2700 o_prot.write_struct_end()
2701 }
2702}
2703
2704impl Default for Uncompressed {
2705 fn default() -> Self {
2706 Uncompressed{}
2707 }
2708}
2709
2710#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2715pub enum BloomFilterCompression {
2716 UNCOMPRESSED(Uncompressed),
2717}
2718
2719impl BloomFilterCompression {
2720 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<BloomFilterCompression> {
2721 let mut ret: Option<BloomFilterCompression> = None;
2722 let mut received_field_count = 0;
2723 i_prot.read_struct_begin()?;
2724 loop {
2725 let field_ident = i_prot.read_field_begin()?;
2726 if field_ident.field_type == TType::Stop {
2727 break;
2728 }
2729 let field_id = field_id(&field_ident)?;
2730 match field_id {
2731 1 => {
2732 let val = Uncompressed::read_from_in_protocol(i_prot)?;
2733 if ret.is_none() {
2734 ret = Some(BloomFilterCompression::UNCOMPRESSED(val));
2735 }
2736 received_field_count += 1;
2737 },
2738 _ => {
2739 i_prot.skip(field_ident.field_type)?;
2740 received_field_count += 1;
2741 },
2742 };
2743 i_prot.read_field_end()?;
2744 }
2745 i_prot.read_struct_end()?;
2746 if received_field_count == 0 {
2747 Err(
2748 thrift::Error::Protocol(
2749 ProtocolError::new(
2750 ProtocolErrorKind::InvalidData,
2751 "received empty union from remote BloomFilterCompression"
2752 )
2753 )
2754 )
2755 } else if received_field_count > 1 {
2756 Err(
2757 thrift::Error::Protocol(
2758 ProtocolError::new(
2759 ProtocolErrorKind::InvalidData,
2760 "received multiple fields for union from remote BloomFilterCompression"
2761 )
2762 )
2763 )
2764 } else {
2765 Ok(ret.expect("return value should have been constructed"))
2766 }
2767 }
2768 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2769 let struct_ident = TStructIdentifier::new("BloomFilterCompression");
2770 o_prot.write_struct_begin(&struct_ident)?;
2771 match *self {
2772 BloomFilterCompression::UNCOMPRESSED(ref f) => {
2773 o_prot.write_field_begin(&TFieldIdentifier::new("UNCOMPRESSED", TType::Struct, 1))?;
2774 f.write_to_out_protocol(o_prot)?;
2775 o_prot.write_field_end()?;
2776 },
2777 }
2778 o_prot.write_field_stop()?;
2779 o_prot.write_struct_end()
2780 }
2781}
2782
2783#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2791pub struct BloomFilterHeader {
2792 pub num_bytes: i32,
2794 pub algorithm: BloomFilterAlgorithm,
2796 pub hash: BloomFilterHash,
2798 pub compression: BloomFilterCompression,
2800}
2801
2802impl BloomFilterHeader {
2803 pub fn new(num_bytes: i32, algorithm: BloomFilterAlgorithm, hash: BloomFilterHash, compression: BloomFilterCompression) -> BloomFilterHeader {
2804 BloomFilterHeader {
2805 num_bytes: num_bytes,
2806 algorithm: algorithm,
2807 hash: hash,
2808 compression: compression,
2809 }
2810 }
2811 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<BloomFilterHeader> {
2812 i_prot.read_struct_begin()?;
2813 let mut f_1: Option<i32> = None;
2814 let mut f_2: Option<BloomFilterAlgorithm> = None;
2815 let mut f_3: Option<BloomFilterHash> = None;
2816 let mut f_4: Option<BloomFilterCompression> = None;
2817 loop {
2818 let field_ident = i_prot.read_field_begin()?;
2819 if field_ident.field_type == TType::Stop {
2820 break;
2821 }
2822 let field_id = field_id(&field_ident)?;
2823 match field_id {
2824 1 => {
2825 let val = i_prot.read_i32()?;
2826 f_1 = Some(val);
2827 },
2828 2 => {
2829 let val = BloomFilterAlgorithm::read_from_in_protocol(i_prot)?;
2830 f_2 = Some(val);
2831 },
2832 3 => {
2833 let val = BloomFilterHash::read_from_in_protocol(i_prot)?;
2834 f_3 = Some(val);
2835 },
2836 4 => {
2837 let val = BloomFilterCompression::read_from_in_protocol(i_prot)?;
2838 f_4 = Some(val);
2839 },
2840 _ => {
2841 i_prot.skip(field_ident.field_type)?;
2842 },
2843 };
2844 i_prot.read_field_end()?;
2845 }
2846 i_prot.read_struct_end()?;
2847 verify_required_field_exists("BloomFilterHeader.num_bytes", &f_1)?;
2848 verify_required_field_exists("BloomFilterHeader.algorithm", &f_2)?;
2849 verify_required_field_exists("BloomFilterHeader.hash", &f_3)?;
2850 verify_required_field_exists("BloomFilterHeader.compression", &f_4)?;
2851 let ret = BloomFilterHeader {
2852 num_bytes: f_1.expect("auto-generated code should have checked for presence of required fields"),
2853 algorithm: f_2.expect("auto-generated code should have checked for presence of required fields"),
2854 hash: f_3.expect("auto-generated code should have checked for presence of required fields"),
2855 compression: f_4.expect("auto-generated code should have checked for presence of required fields"),
2856 };
2857 Ok(ret)
2858 }
2859 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
2860 let struct_ident = TStructIdentifier::new("BloomFilterHeader");
2861 o_prot.write_struct_begin(&struct_ident)?;
2862 o_prot.write_field_begin(&TFieldIdentifier::new("numBytes", TType::I32, 1))?;
2863 o_prot.write_i32(self.num_bytes)?;
2864 o_prot.write_field_end()?;
2865 o_prot.write_field_begin(&TFieldIdentifier::new("algorithm", TType::Struct, 2))?;
2866 self.algorithm.write_to_out_protocol(o_prot)?;
2867 o_prot.write_field_end()?;
2868 o_prot.write_field_begin(&TFieldIdentifier::new("hash", TType::Struct, 3))?;
2869 self.hash.write_to_out_protocol(o_prot)?;
2870 o_prot.write_field_end()?;
2871 o_prot.write_field_begin(&TFieldIdentifier::new("compression", TType::Struct, 4))?;
2872 self.compression.write_to_out_protocol(o_prot)?;
2873 o_prot.write_field_end()?;
2874 o_prot.write_field_stop()?;
2875 o_prot.write_struct_end()
2876 }
2877}
2878
2879#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2884pub struct PageHeader {
2885 pub type_: PageType,
2887 pub uncompressed_page_size: i32,
2889 pub compressed_page_size: i32,
2891 pub crc: Option<i32>,
2918 pub data_page_header: Option<DataPageHeader>,
2919 pub index_page_header: Option<IndexPageHeader>,
2920 pub dictionary_page_header: Option<DictionaryPageHeader>,
2921 pub data_page_header_v2: Option<DataPageHeaderV2>,
2922}
2923
2924impl PageHeader {
2925 pub fn new<F4, F5, F6, F7, F8>(type_: PageType, uncompressed_page_size: i32, compressed_page_size: i32, crc: F4, data_page_header: F5, index_page_header: F6, dictionary_page_header: F7, data_page_header_v2: F8) -> PageHeader where F4: Into<Option<i32>>, F5: Into<Option<DataPageHeader>>, F6: Into<Option<IndexPageHeader>>, F7: Into<Option<DictionaryPageHeader>>, F8: Into<Option<DataPageHeaderV2>> {
2926 PageHeader {
2927 type_: type_,
2928 uncompressed_page_size: uncompressed_page_size,
2929 compressed_page_size: compressed_page_size,
2930 crc: crc.into(),
2931 data_page_header: data_page_header.into(),
2932 index_page_header: index_page_header.into(),
2933 dictionary_page_header: dictionary_page_header.into(),
2934 data_page_header_v2: data_page_header_v2.into(),
2935 }
2936 }
2937 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<PageHeader> {
2938 i_prot.read_struct_begin()?;
2939 let mut f_1: Option<PageType> = None;
2940 let mut f_2: Option<i32> = None;
2941 let mut f_3: Option<i32> = None;
2942 let mut f_4: Option<i32> = None;
2943 let mut f_5: Option<DataPageHeader> = None;
2944 let mut f_6: Option<IndexPageHeader> = None;
2945 let mut f_7: Option<DictionaryPageHeader> = None;
2946 let mut f_8: Option<DataPageHeaderV2> = None;
2947 loop {
2948 let field_ident = i_prot.read_field_begin()?;
2949 if field_ident.field_type == TType::Stop {
2950 break;
2951 }
2952 let field_id = field_id(&field_ident)?;
2953 match field_id {
2954 1 => {
2955 let val = PageType::read_from_in_protocol(i_prot)?;
2956 f_1 = Some(val);
2957 },
2958 2 => {
2959 let val = i_prot.read_i32()?;
2960 f_2 = Some(val);
2961 },
2962 3 => {
2963 let val = i_prot.read_i32()?;
2964 f_3 = Some(val);
2965 },
2966 4 => {
2967 let val = i_prot.read_i32()?;
2968 f_4 = Some(val);
2969 },
2970 5 => {
2971 let val = DataPageHeader::read_from_in_protocol(i_prot)?;
2972 f_5 = Some(val);
2973 },
2974 6 => {
2975 let val = IndexPageHeader::read_from_in_protocol(i_prot)?;
2976 f_6 = Some(val);
2977 },
2978 7 => {
2979 let val = DictionaryPageHeader::read_from_in_protocol(i_prot)?;
2980 f_7 = Some(val);
2981 },
2982 8 => {
2983 let val = DataPageHeaderV2::read_from_in_protocol(i_prot)?;
2984 f_8 = Some(val);
2985 },
2986 _ => {
2987 i_prot.skip(field_ident.field_type)?;
2988 },
2989 };
2990 i_prot.read_field_end()?;
2991 }
2992 i_prot.read_struct_end()?;
2993 verify_required_field_exists("PageHeader.type_", &f_1)?;
2994 verify_required_field_exists("PageHeader.uncompressed_page_size", &f_2)?;
2995 verify_required_field_exists("PageHeader.compressed_page_size", &f_3)?;
2996 let ret = PageHeader {
2997 type_: f_1.expect("auto-generated code should have checked for presence of required fields"),
2998 uncompressed_page_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
2999 compressed_page_size: f_3.expect("auto-generated code should have checked for presence of required fields"),
3000 crc: f_4,
3001 data_page_header: f_5,
3002 index_page_header: f_6,
3003 dictionary_page_header: f_7,
3004 data_page_header_v2: f_8,
3005 };
3006 Ok(ret)
3007 }
3008 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
3009 let struct_ident = TStructIdentifier::new("PageHeader");
3010 o_prot.write_struct_begin(&struct_ident)?;
3011 o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1))?;
3012 self.type_.write_to_out_protocol(o_prot)?;
3013 o_prot.write_field_end()?;
3014 o_prot.write_field_begin(&TFieldIdentifier::new("uncompressed_page_size", TType::I32, 2))?;
3015 o_prot.write_i32(self.uncompressed_page_size)?;
3016 o_prot.write_field_end()?;
3017 o_prot.write_field_begin(&TFieldIdentifier::new("compressed_page_size", TType::I32, 3))?;
3018 o_prot.write_i32(self.compressed_page_size)?;
3019 o_prot.write_field_end()?;
3020 if let Some(fld_var) = self.crc {
3021 o_prot.write_field_begin(&TFieldIdentifier::new("crc", TType::I32, 4))?;
3022 o_prot.write_i32(fld_var)?;
3023 o_prot.write_field_end()?;
3024 ()
3025 } else {
3026 ()
3027 }
3028 if let Some(ref fld_var) = self.data_page_header {
3029 o_prot.write_field_begin(&TFieldIdentifier::new("data_page_header", TType::Struct, 5))?;
3030 fld_var.write_to_out_protocol(o_prot)?;
3031 o_prot.write_field_end()?;
3032 ()
3033 } else {
3034 ()
3035 }
3036 if let Some(ref fld_var) = self.index_page_header {
3037 o_prot.write_field_begin(&TFieldIdentifier::new("index_page_header", TType::Struct, 6))?;
3038 fld_var.write_to_out_protocol(o_prot)?;
3039 o_prot.write_field_end()?;
3040 ()
3041 } else {
3042 ()
3043 }
3044 if let Some(ref fld_var) = self.dictionary_page_header {
3045 o_prot.write_field_begin(&TFieldIdentifier::new("dictionary_page_header", TType::Struct, 7))?;
3046 fld_var.write_to_out_protocol(o_prot)?;
3047 o_prot.write_field_end()?;
3048 ()
3049 } else {
3050 ()
3051 }
3052 if let Some(ref fld_var) = self.data_page_header_v2 {
3053 o_prot.write_field_begin(&TFieldIdentifier::new("data_page_header_v2", TType::Struct, 8))?;
3054 fld_var.write_to_out_protocol(o_prot)?;
3055 o_prot.write_field_end()?;
3056 ()
3057 } else {
3058 ()
3059 }
3060 o_prot.write_field_stop()?;
3061 o_prot.write_struct_end()
3062 }
3063}
3064
3065#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3071pub struct KeyValue {
3072 pub key: String,
3073 pub value: Option<String>,
3074}
3075
3076impl KeyValue {
3077 pub fn new<F2>(key: String, value: F2) -> KeyValue where F2: Into<Option<String>> {
3078 KeyValue {
3079 key: key,
3080 value: value.into(),
3081 }
3082 }
3083 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<KeyValue> {
3084 i_prot.read_struct_begin()?;
3085 let mut f_1: Option<String> = None;
3086 let mut f_2: Option<String> = None;
3087 loop {
3088 let field_ident = i_prot.read_field_begin()?;
3089 if field_ident.field_type == TType::Stop {
3090 break;
3091 }
3092 let field_id = field_id(&field_ident)?;
3093 match field_id {
3094 1 => {
3095 let val = i_prot.read_string()?;
3096 f_1 = Some(val);
3097 },
3098 2 => {
3099 let val = i_prot.read_string()?;
3100 f_2 = Some(val);
3101 },
3102 _ => {
3103 i_prot.skip(field_ident.field_type)?;
3104 },
3105 };
3106 i_prot.read_field_end()?;
3107 }
3108 i_prot.read_struct_end()?;
3109 verify_required_field_exists("KeyValue.key", &f_1)?;
3110 let ret = KeyValue {
3111 key: f_1.expect("auto-generated code should have checked for presence of required fields"),
3112 value: f_2,
3113 };
3114 Ok(ret)
3115 }
3116 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
3117 let struct_ident = TStructIdentifier::new("KeyValue");
3118 o_prot.write_struct_begin(&struct_ident)?;
3119 o_prot.write_field_begin(&TFieldIdentifier::new("key", TType::String, 1))?;
3120 o_prot.write_string(&self.key)?;
3121 o_prot.write_field_end()?;
3122 if let Some(ref fld_var) = self.value {
3123 o_prot.write_field_begin(&TFieldIdentifier::new("value", TType::String, 2))?;
3124 o_prot.write_string(fld_var)?;
3125 o_prot.write_field_end()?;
3126 ()
3127 } else {
3128 ()
3129 }
3130 o_prot.write_field_stop()?;
3131 o_prot.write_struct_end()
3132 }
3133}
3134
3135#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3141pub struct SortingColumn {
3142 pub column_idx: i32,
3144 pub descending: bool,
3146 pub nulls_first: bool,
3149}
3150
3151impl SortingColumn {
3152 pub fn new(column_idx: i32, descending: bool, nulls_first: bool) -> SortingColumn {
3153 SortingColumn {
3154 column_idx: column_idx,
3155 descending: descending,
3156 nulls_first: nulls_first,
3157 }
3158 }
3159 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<SortingColumn> {
3160 i_prot.read_struct_begin()?;
3161 let mut f_1: Option<i32> = None;
3162 let mut f_2: Option<bool> = None;
3163 let mut f_3: Option<bool> = None;
3164 loop {
3165 let field_ident = i_prot.read_field_begin()?;
3166 if field_ident.field_type == TType::Stop {
3167 break;
3168 }
3169 let field_id = field_id(&field_ident)?;
3170 match field_id {
3171 1 => {
3172 let val = i_prot.read_i32()?;
3173 f_1 = Some(val);
3174 },
3175 2 => {
3176 let val = i_prot.read_bool()?;
3177 f_2 = Some(val);
3178 },
3179 3 => {
3180 let val = i_prot.read_bool()?;
3181 f_3 = Some(val);
3182 },
3183 _ => {
3184 i_prot.skip(field_ident.field_type)?;
3185 },
3186 };
3187 i_prot.read_field_end()?;
3188 }
3189 i_prot.read_struct_end()?;
3190 verify_required_field_exists("SortingColumn.column_idx", &f_1)?;
3191 verify_required_field_exists("SortingColumn.descending", &f_2)?;
3192 verify_required_field_exists("SortingColumn.nulls_first", &f_3)?;
3193 let ret = SortingColumn {
3194 column_idx: f_1.expect("auto-generated code should have checked for presence of required fields"),
3195 descending: f_2.expect("auto-generated code should have checked for presence of required fields"),
3196 nulls_first: f_3.expect("auto-generated code should have checked for presence of required fields"),
3197 };
3198 Ok(ret)
3199 }
3200 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
3201 let struct_ident = TStructIdentifier::new("SortingColumn");
3202 o_prot.write_struct_begin(&struct_ident)?;
3203 o_prot.write_field_begin(&TFieldIdentifier::new("column_idx", TType::I32, 1))?;
3204 o_prot.write_i32(self.column_idx)?;
3205 o_prot.write_field_end()?;
3206 o_prot.write_field_begin(&TFieldIdentifier::new("descending", TType::Bool, 2))?;
3207 o_prot.write_bool(self.descending)?;
3208 o_prot.write_field_end()?;
3209 o_prot.write_field_begin(&TFieldIdentifier::new("nulls_first", TType::Bool, 3))?;
3210 o_prot.write_bool(self.nulls_first)?;
3211 o_prot.write_field_end()?;
3212 o_prot.write_field_stop()?;
3213 o_prot.write_struct_end()
3214 }
3215}
3216
3217#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3223pub struct PageEncodingStats {
3224 pub page_type: PageType,
3226 pub encoding: Encoding,
3228 pub count: i32,
3230}
3231
3232impl PageEncodingStats {
3233 pub fn new(page_type: PageType, encoding: Encoding, count: i32) -> PageEncodingStats {
3234 PageEncodingStats {
3235 page_type: page_type,
3236 encoding: encoding,
3237 count: count,
3238 }
3239 }
3240 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<PageEncodingStats> {
3241 i_prot.read_struct_begin()?;
3242 let mut f_1: Option<PageType> = None;
3243 let mut f_2: Option<Encoding> = None;
3244 let mut f_3: Option<i32> = None;
3245 loop {
3246 let field_ident = i_prot.read_field_begin()?;
3247 if field_ident.field_type == TType::Stop {
3248 break;
3249 }
3250 let field_id = field_id(&field_ident)?;
3251 match field_id {
3252 1 => {
3253 let val = PageType::read_from_in_protocol(i_prot)?;
3254 f_1 = Some(val);
3255 },
3256 2 => {
3257 let val = Encoding::read_from_in_protocol(i_prot)?;
3258 f_2 = Some(val);
3259 },
3260 3 => {
3261 let val = i_prot.read_i32()?;
3262 f_3 = Some(val);
3263 },
3264 _ => {
3265 i_prot.skip(field_ident.field_type)?;
3266 },
3267 };
3268 i_prot.read_field_end()?;
3269 }
3270 i_prot.read_struct_end()?;
3271 verify_required_field_exists("PageEncodingStats.page_type", &f_1)?;
3272 verify_required_field_exists("PageEncodingStats.encoding", &f_2)?;
3273 verify_required_field_exists("PageEncodingStats.count", &f_3)?;
3274 let ret = PageEncodingStats {
3275 page_type: f_1.expect("auto-generated code should have checked for presence of required fields"),
3276 encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
3277 count: f_3.expect("auto-generated code should have checked for presence of required fields"),
3278 };
3279 Ok(ret)
3280 }
3281 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
3282 let struct_ident = TStructIdentifier::new("PageEncodingStats");
3283 o_prot.write_struct_begin(&struct_ident)?;
3284 o_prot.write_field_begin(&TFieldIdentifier::new("page_type", TType::I32, 1))?;
3285 self.page_type.write_to_out_protocol(o_prot)?;
3286 o_prot.write_field_end()?;
3287 o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2))?;
3288 self.encoding.write_to_out_protocol(o_prot)?;
3289 o_prot.write_field_end()?;
3290 o_prot.write_field_begin(&TFieldIdentifier::new("count", TType::I32, 3))?;
3291 o_prot.write_i32(self.count)?;
3292 o_prot.write_field_end()?;
3293 o_prot.write_field_stop()?;
3294 o_prot.write_struct_end()
3295 }
3296}
3297
3298#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3304pub struct ColumnMetaData {
3305 pub type_: Type,
3307 pub encodings: Vec<Encoding>,
3310 pub path_in_schema: Vec<String>,
3312 pub codec: CompressionCodec,
3314 pub num_values: i64,
3316 pub total_uncompressed_size: i64,
3318 pub total_compressed_size: i64,
3321 pub key_value_metadata: Option<Vec<KeyValue>>,
3323 pub data_page_offset: i64,
3325 pub index_page_offset: Option<i64>,
3327 pub dictionary_page_offset: Option<i64>,
3329 pub statistics: Option<Statistics>,
3331 pub encoding_stats: Option<Vec<PageEncodingStats>>,
3335 pub bloom_filter_offset: Option<i64>,
3337}
3338
3339impl ColumnMetaData {
3340 pub fn new<F8, F10, F11, F12, F13, F14>(type_: Type, encodings: Vec<Encoding>, path_in_schema: Vec<String>, codec: CompressionCodec, num_values: i64, total_uncompressed_size: i64, total_compressed_size: i64, key_value_metadata: F8, data_page_offset: i64, index_page_offset: F10, dictionary_page_offset: F11, statistics: F12, encoding_stats: F13, bloom_filter_offset: F14) -> ColumnMetaData where F8: Into<Option<Vec<KeyValue>>>, F10: Into<Option<i64>>, F11: Into<Option<i64>>, F12: Into<Option<Statistics>>, F13: Into<Option<Vec<PageEncodingStats>>>, F14: Into<Option<i64>> {
3341 ColumnMetaData {
3342 type_: type_,
3343 encodings: encodings,
3344 path_in_schema: path_in_schema,
3345 codec: codec,
3346 num_values: num_values,
3347 total_uncompressed_size: total_uncompressed_size,
3348 total_compressed_size: total_compressed_size,
3349 key_value_metadata: key_value_metadata.into(),
3350 data_page_offset: data_page_offset,
3351 index_page_offset: index_page_offset.into(),
3352 dictionary_page_offset: dictionary_page_offset.into(),
3353 statistics: statistics.into(),
3354 encoding_stats: encoding_stats.into(),
3355 bloom_filter_offset: bloom_filter_offset.into(),
3356 }
3357 }
3358 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<ColumnMetaData> {
3359 i_prot.read_struct_begin()?;
3360 let mut f_1: Option<Type> = None;
3361 let mut f_2: Option<Vec<Encoding>> = None;
3362 let mut f_3: Option<Vec<String>> = None;
3363 let mut f_4: Option<CompressionCodec> = None;
3364 let mut f_5: Option<i64> = None;
3365 let mut f_6: Option<i64> = None;
3366 let mut f_7: Option<i64> = None;
3367 let mut f_8: Option<Vec<KeyValue>> = None;
3368 let mut f_9: Option<i64> = None;
3369 let mut f_10: Option<i64> = None;
3370 let mut f_11: Option<i64> = None;
3371 let mut f_12: Option<Statistics> = None;
3372 let mut f_13: Option<Vec<PageEncodingStats>> = None;
3373 let mut f_14: Option<i64> = None;
3374 loop {
3375 let field_ident = i_prot.read_field_begin()?;
3376 if field_ident.field_type == TType::Stop {
3377 break;
3378 }
3379 let field_id = field_id(&field_ident)?;
3380 match field_id {
3381 1 => {
3382 let val = Type::read_from_in_protocol(i_prot)?;
3383 f_1 = Some(val);
3384 },
3385 2 => {
3386 let list_ident = i_prot.read_list_begin()?;
3387 let mut val: Vec<Encoding> = Vec::with_capacity(list_ident.size as usize);
3388 for _ in 0..list_ident.size {
3389 let list_elem_0 = Encoding::read_from_in_protocol(i_prot)?;
3390 val.push(list_elem_0);
3391 }
3392 i_prot.read_list_end()?;
3393 f_2 = Some(val);
3394 },
3395 3 => {
3396 let list_ident = i_prot.read_list_begin()?;
3397 let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
3398 for _ in 0..list_ident.size {
3399 let list_elem_1 = i_prot.read_string()?;
3400 val.push(list_elem_1);
3401 }
3402 i_prot.read_list_end()?;
3403 f_3 = Some(val);
3404 },
3405 4 => {
3406 let val = CompressionCodec::read_from_in_protocol(i_prot)?;
3407 f_4 = Some(val);
3408 },
3409 5 => {
3410 let val = i_prot.read_i64()?;
3411 f_5 = Some(val);
3412 },
3413 6 => {
3414 let val = i_prot.read_i64()?;
3415 f_6 = Some(val);
3416 },
3417 7 => {
3418 let val = i_prot.read_i64()?;
3419 f_7 = Some(val);
3420 },
3421 8 => {
3422 let list_ident = i_prot.read_list_begin()?;
3423 let mut val: Vec<KeyValue> = Vec::with_capacity(list_ident.size as usize);
3424 for _ in 0..list_ident.size {
3425 let list_elem_2 = KeyValue::read_from_in_protocol(i_prot)?;
3426 val.push(list_elem_2);
3427 }
3428 i_prot.read_list_end()?;
3429 f_8 = Some(val);
3430 },
3431 9 => {
3432 let val = i_prot.read_i64()?;
3433 f_9 = Some(val);
3434 },
3435 10 => {
3436 let val = i_prot.read_i64()?;
3437 f_10 = Some(val);
3438 },
3439 11 => {
3440 let val = i_prot.read_i64()?;
3441 f_11 = Some(val);
3442 },
3443 12 => {
3444 let val = Statistics::read_from_in_protocol(i_prot)?;
3445 f_12 = Some(val);
3446 },
3447 13 => {
3448 let list_ident = i_prot.read_list_begin()?;
3449 let mut val: Vec<PageEncodingStats> = Vec::with_capacity(list_ident.size as usize);
3450 for _ in 0..list_ident.size {
3451 let list_elem_3 = PageEncodingStats::read_from_in_protocol(i_prot)?;
3452 val.push(list_elem_3);
3453 }
3454 i_prot.read_list_end()?;
3455 f_13 = Some(val);
3456 },
3457 14 => {
3458 let val = i_prot.read_i64()?;
3459 f_14 = Some(val);
3460 },
3461 _ => {
3462 i_prot.skip(field_ident.field_type)?;
3463 },
3464 };
3465 i_prot.read_field_end()?;
3466 }
3467 i_prot.read_struct_end()?;
3468 verify_required_field_exists("ColumnMetaData.type_", &f_1)?;
3469 verify_required_field_exists("ColumnMetaData.encodings", &f_2)?;
3470 verify_required_field_exists("ColumnMetaData.path_in_schema", &f_3)?;
3471 verify_required_field_exists("ColumnMetaData.codec", &f_4)?;
3472 verify_required_field_exists("ColumnMetaData.num_values", &f_5)?;
3473 verify_required_field_exists("ColumnMetaData.total_uncompressed_size", &f_6)?;
3474 verify_required_field_exists("ColumnMetaData.total_compressed_size", &f_7)?;
3475 verify_required_field_exists("ColumnMetaData.data_page_offset", &f_9)?;
3476 let ret = ColumnMetaData {
3477 type_: f_1.expect("auto-generated code should have checked for presence of required fields"),
3478 encodings: f_2.expect("auto-generated code should have checked for presence of required fields"),
3479 path_in_schema: f_3.expect("auto-generated code should have checked for presence of required fields"),
3480 codec: f_4.expect("auto-generated code should have checked for presence of required fields"),
3481 num_values: f_5.expect("auto-generated code should have checked for presence of required fields"),
3482 total_uncompressed_size: f_6.expect("auto-generated code should have checked for presence of required fields"),
3483 total_compressed_size: f_7.expect("auto-generated code should have checked for presence of required fields"),
3484 key_value_metadata: f_8,
3485 data_page_offset: f_9.expect("auto-generated code should have checked for presence of required fields"),
3486 index_page_offset: f_10,
3487 dictionary_page_offset: f_11,
3488 statistics: f_12,
3489 encoding_stats: f_13,
3490 bloom_filter_offset: f_14,
3491 };
3492 Ok(ret)
3493 }
3494 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
3495 let struct_ident = TStructIdentifier::new("ColumnMetaData");
3496 o_prot.write_struct_begin(&struct_ident)?;
3497 o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1))?;
3498 self.type_.write_to_out_protocol(o_prot)?;
3499 o_prot.write_field_end()?;
3500 o_prot.write_field_begin(&TFieldIdentifier::new("encodings", TType::List, 2))?;
3501 o_prot.write_list_begin(&TListIdentifier::new(TType::I32, self.encodings.len() as i32))?;
3502 for e in &self.encodings {
3503 e.write_to_out_protocol(o_prot)?;
3504 o_prot.write_list_end()?;
3505 }
3506 o_prot.write_field_end()?;
3507 o_prot.write_field_begin(&TFieldIdentifier::new("path_in_schema", TType::List, 3))?;
3508 o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.path_in_schema.len() as i32))?;
3509 for e in &self.path_in_schema {
3510 o_prot.write_string(e)?;
3511 o_prot.write_list_end()?;
3512 }
3513 o_prot.write_field_end()?;
3514 o_prot.write_field_begin(&TFieldIdentifier::new("codec", TType::I32, 4))?;
3515 self.codec.write_to_out_protocol(o_prot)?;
3516 o_prot.write_field_end()?;
3517 o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I64, 5))?;
3518 o_prot.write_i64(self.num_values)?;
3519 o_prot.write_field_end()?;
3520 o_prot.write_field_begin(&TFieldIdentifier::new("total_uncompressed_size", TType::I64, 6))?;
3521 o_prot.write_i64(self.total_uncompressed_size)?;
3522 o_prot.write_field_end()?;
3523 o_prot.write_field_begin(&TFieldIdentifier::new("total_compressed_size", TType::I64, 7))?;
3524 o_prot.write_i64(self.total_compressed_size)?;
3525 o_prot.write_field_end()?;
3526 if let Some(ref fld_var) = self.key_value_metadata {
3527 o_prot.write_field_begin(&TFieldIdentifier::new("key_value_metadata", TType::List, 8))?;
3528 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
3529 for e in fld_var {
3530 e.write_to_out_protocol(o_prot)?;
3531 o_prot.write_list_end()?;
3532 }
3533 o_prot.write_field_end()?;
3534 ()
3535 } else {
3536 ()
3537 }
3538 o_prot.write_field_begin(&TFieldIdentifier::new("data_page_offset", TType::I64, 9))?;
3539 o_prot.write_i64(self.data_page_offset)?;
3540 o_prot.write_field_end()?;
3541 if let Some(fld_var) = self.index_page_offset {
3542 o_prot.write_field_begin(&TFieldIdentifier::new("index_page_offset", TType::I64, 10))?;
3543 o_prot.write_i64(fld_var)?;
3544 o_prot.write_field_end()?;
3545 ()
3546 } else {
3547 ()
3548 }
3549 if let Some(fld_var) = self.dictionary_page_offset {
3550 o_prot.write_field_begin(&TFieldIdentifier::new("dictionary_page_offset", TType::I64, 11))?;
3551 o_prot.write_i64(fld_var)?;
3552 o_prot.write_field_end()?;
3553 ()
3554 } else {
3555 ()
3556 }
3557 if let Some(ref fld_var) = self.statistics {
3558 o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 12))?;
3559 fld_var.write_to_out_protocol(o_prot)?;
3560 o_prot.write_field_end()?;
3561 ()
3562 } else {
3563 ()
3564 }
3565 if let Some(ref fld_var) = self.encoding_stats {
3566 o_prot.write_field_begin(&TFieldIdentifier::new("encoding_stats", TType::List, 13))?;
3567 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
3568 for e in fld_var {
3569 e.write_to_out_protocol(o_prot)?;
3570 o_prot.write_list_end()?;
3571 }
3572 o_prot.write_field_end()?;
3573 ()
3574 } else {
3575 ()
3576 }
3577 if let Some(fld_var) = self.bloom_filter_offset {
3578 o_prot.write_field_begin(&TFieldIdentifier::new("bloom_filter_offset", TType::I64, 14))?;
3579 o_prot.write_i64(fld_var)?;
3580 o_prot.write_field_end()?;
3581 ()
3582 } else {
3583 ()
3584 }
3585 o_prot.write_field_stop()?;
3586 o_prot.write_struct_end()
3587 }
3588}
3589
3590#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3595pub struct EncryptionWithFooterKey {
3596}
3597
3598impl EncryptionWithFooterKey {
3599 pub fn new() -> EncryptionWithFooterKey {
3600 EncryptionWithFooterKey {}
3601 }
3602 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<EncryptionWithFooterKey> {
3603 i_prot.read_struct_begin()?;
3604 loop {
3605 let field_ident = i_prot.read_field_begin()?;
3606 if field_ident.field_type == TType::Stop {
3607 break;
3608 }
3609 let field_id = field_id(&field_ident)?;
3610 match field_id {
3611 _ => {
3612 i_prot.skip(field_ident.field_type)?;
3613 },
3614 };
3615 i_prot.read_field_end()?;
3616 }
3617 i_prot.read_struct_end()?;
3618 let ret = EncryptionWithFooterKey {};
3619 Ok(ret)
3620 }
3621 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
3622 let struct_ident = TStructIdentifier::new("EncryptionWithFooterKey");
3623 o_prot.write_struct_begin(&struct_ident)?;
3624 o_prot.write_field_stop()?;
3625 o_prot.write_struct_end()
3626 }
3627}
3628
3629impl Default for EncryptionWithFooterKey {
3630 fn default() -> Self {
3631 EncryptionWithFooterKey{}
3632 }
3633}
3634
3635#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3640pub struct EncryptionWithColumnKey {
3641 pub path_in_schema: Vec<String>,
3643 pub key_metadata: Option<Vec<u8>>,
3645}
3646
3647impl EncryptionWithColumnKey {
3648 pub fn new<F2>(path_in_schema: Vec<String>, key_metadata: F2) -> EncryptionWithColumnKey where F2: Into<Option<Vec<u8>>> {
3649 EncryptionWithColumnKey {
3650 path_in_schema: path_in_schema,
3651 key_metadata: key_metadata.into(),
3652 }
3653 }
3654 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<EncryptionWithColumnKey> {
3655 i_prot.read_struct_begin()?;
3656 let mut f_1: Option<Vec<String>> = None;
3657 let mut f_2: Option<Vec<u8>> = None;
3658 loop {
3659 let field_ident = i_prot.read_field_begin()?;
3660 if field_ident.field_type == TType::Stop {
3661 break;
3662 }
3663 let field_id = field_id(&field_ident)?;
3664 match field_id {
3665 1 => {
3666 let list_ident = i_prot.read_list_begin()?;
3667 let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
3668 for _ in 0..list_ident.size {
3669 let list_elem_4 = i_prot.read_string()?;
3670 val.push(list_elem_4);
3671 }
3672 i_prot.read_list_end()?;
3673 f_1 = Some(val);
3674 },
3675 2 => {
3676 let val = i_prot.read_bytes()?;
3677 f_2 = Some(val);
3678 },
3679 _ => {
3680 i_prot.skip(field_ident.field_type)?;
3681 },
3682 };
3683 i_prot.read_field_end()?;
3684 }
3685 i_prot.read_struct_end()?;
3686 verify_required_field_exists("EncryptionWithColumnKey.path_in_schema", &f_1)?;
3687 let ret = EncryptionWithColumnKey {
3688 path_in_schema: f_1.expect("auto-generated code should have checked for presence of required fields"),
3689 key_metadata: f_2,
3690 };
3691 Ok(ret)
3692 }
3693 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
3694 let struct_ident = TStructIdentifier::new("EncryptionWithColumnKey");
3695 o_prot.write_struct_begin(&struct_ident)?;
3696 o_prot.write_field_begin(&TFieldIdentifier::new("path_in_schema", TType::List, 1))?;
3697 o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.path_in_schema.len() as i32))?;
3698 for e in &self.path_in_schema {
3699 o_prot.write_string(e)?;
3700 o_prot.write_list_end()?;
3701 }
3702 o_prot.write_field_end()?;
3703 if let Some(ref fld_var) = self.key_metadata {
3704 o_prot.write_field_begin(&TFieldIdentifier::new("key_metadata", TType::String, 2))?;
3705 o_prot.write_bytes(fld_var)?;
3706 o_prot.write_field_end()?;
3707 ()
3708 } else {
3709 ()
3710 }
3711 o_prot.write_field_stop()?;
3712 o_prot.write_struct_end()
3713 }
3714}
3715
3716#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3721pub enum ColumnCryptoMetaData {
3722 ENCRYPTIONWITHFOOTERKEY(EncryptionWithFooterKey),
3723 ENCRYPTIONWITHCOLUMNKEY(EncryptionWithColumnKey),
3724}
3725
3726impl ColumnCryptoMetaData {
3727 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<ColumnCryptoMetaData> {
3728 let mut ret: Option<ColumnCryptoMetaData> = None;
3729 let mut received_field_count = 0;
3730 i_prot.read_struct_begin()?;
3731 loop {
3732 let field_ident = i_prot.read_field_begin()?;
3733 if field_ident.field_type == TType::Stop {
3734 break;
3735 }
3736 let field_id = field_id(&field_ident)?;
3737 match field_id {
3738 1 => {
3739 let val = EncryptionWithFooterKey::read_from_in_protocol(i_prot)?;
3740 if ret.is_none() {
3741 ret = Some(ColumnCryptoMetaData::ENCRYPTIONWITHFOOTERKEY(val));
3742 }
3743 received_field_count += 1;
3744 },
3745 2 => {
3746 let val = EncryptionWithColumnKey::read_from_in_protocol(i_prot)?;
3747 if ret.is_none() {
3748 ret = Some(ColumnCryptoMetaData::ENCRYPTIONWITHCOLUMNKEY(val));
3749 }
3750 received_field_count += 1;
3751 },
3752 _ => {
3753 i_prot.skip(field_ident.field_type)?;
3754 received_field_count += 1;
3755 },
3756 };
3757 i_prot.read_field_end()?;
3758 }
3759 i_prot.read_struct_end()?;
3760 if received_field_count == 0 {
3761 Err(
3762 thrift::Error::Protocol(
3763 ProtocolError::new(
3764 ProtocolErrorKind::InvalidData,
3765 "received empty union from remote ColumnCryptoMetaData"
3766 )
3767 )
3768 )
3769 } else if received_field_count > 1 {
3770 Err(
3771 thrift::Error::Protocol(
3772 ProtocolError::new(
3773 ProtocolErrorKind::InvalidData,
3774 "received multiple fields for union from remote ColumnCryptoMetaData"
3775 )
3776 )
3777 )
3778 } else {
3779 Ok(ret.expect("return value should have been constructed"))
3780 }
3781 }
3782 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
3783 let struct_ident = TStructIdentifier::new("ColumnCryptoMetaData");
3784 o_prot.write_struct_begin(&struct_ident)?;
3785 match *self {
3786 ColumnCryptoMetaData::ENCRYPTIONWITHFOOTERKEY(ref f) => {
3787 o_prot.write_field_begin(&TFieldIdentifier::new("ENCRYPTION_WITH_FOOTER_KEY", TType::Struct, 1))?;
3788 f.write_to_out_protocol(o_prot)?;
3789 o_prot.write_field_end()?;
3790 },
3791 ColumnCryptoMetaData::ENCRYPTIONWITHCOLUMNKEY(ref f) => {
3792 o_prot.write_field_begin(&TFieldIdentifier::new("ENCRYPTION_WITH_COLUMN_KEY", TType::Struct, 2))?;
3793 f.write_to_out_protocol(o_prot)?;
3794 o_prot.write_field_end()?;
3795 },
3796 }
3797 o_prot.write_field_stop()?;
3798 o_prot.write_struct_end()
3799 }
3800}
3801
3802#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3807pub struct ColumnChunk {
3808 pub file_path: Option<String>,
3812 pub file_offset: i64,
3814 pub meta_data: Option<ColumnMetaData>,
3819 pub offset_index_offset: Option<i64>,
3821 pub offset_index_length: Option<i32>,
3823 pub column_index_offset: Option<i64>,
3825 pub column_index_length: Option<i32>,
3827 pub crypto_metadata: Option<ColumnCryptoMetaData>,
3829 pub encrypted_column_metadata: Option<Vec<u8>>,
3831}
3832
3833impl ColumnChunk {
3834 pub fn new<F1, F3, F4, F5, F6, F7, F8, F9>(file_path: F1, file_offset: i64, meta_data: F3, offset_index_offset: F4, offset_index_length: F5, column_index_offset: F6, column_index_length: F7, crypto_metadata: F8, encrypted_column_metadata: F9) -> ColumnChunk where F1: Into<Option<String>>, F3: Into<Option<ColumnMetaData>>, F4: Into<Option<i64>>, F5: Into<Option<i32>>, F6: Into<Option<i64>>, F7: Into<Option<i32>>, F8: Into<Option<ColumnCryptoMetaData>>, F9: Into<Option<Vec<u8>>> {
3835 ColumnChunk {
3836 file_path: file_path.into(),
3837 file_offset: file_offset,
3838 meta_data: meta_data.into(),
3839 offset_index_offset: offset_index_offset.into(),
3840 offset_index_length: offset_index_length.into(),
3841 column_index_offset: column_index_offset.into(),
3842 column_index_length: column_index_length.into(),
3843 crypto_metadata: crypto_metadata.into(),
3844 encrypted_column_metadata: encrypted_column_metadata.into(),
3845 }
3846 }
3847 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<ColumnChunk> {
3848 i_prot.read_struct_begin()?;
3849 let mut f_1: Option<String> = None;
3850 let mut f_2: Option<i64> = None;
3851 let mut f_3: Option<ColumnMetaData> = None;
3852 let mut f_4: Option<i64> = None;
3853 let mut f_5: Option<i32> = None;
3854 let mut f_6: Option<i64> = None;
3855 let mut f_7: Option<i32> = None;
3856 let mut f_8: Option<ColumnCryptoMetaData> = None;
3857 let mut f_9: Option<Vec<u8>> = None;
3858 loop {
3859 let field_ident = i_prot.read_field_begin()?;
3860 if field_ident.field_type == TType::Stop {
3861 break;
3862 }
3863 let field_id = field_id(&field_ident)?;
3864 match field_id {
3865 1 => {
3866 let val = i_prot.read_string()?;
3867 f_1 = Some(val);
3868 },
3869 2 => {
3870 let val = i_prot.read_i64()?;
3871 f_2 = Some(val);
3872 },
3873 3 => {
3874 let val = ColumnMetaData::read_from_in_protocol(i_prot)?;
3875 f_3 = Some(val);
3876 },
3877 4 => {
3878 let val = i_prot.read_i64()?;
3879 f_4 = Some(val);
3880 },
3881 5 => {
3882 let val = i_prot.read_i32()?;
3883 f_5 = Some(val);
3884 },
3885 6 => {
3886 let val = i_prot.read_i64()?;
3887 f_6 = Some(val);
3888 },
3889 7 => {
3890 let val = i_prot.read_i32()?;
3891 f_7 = Some(val);
3892 },
3893 8 => {
3894 let val = ColumnCryptoMetaData::read_from_in_protocol(i_prot)?;
3895 f_8 = Some(val);
3896 },
3897 9 => {
3898 let val = i_prot.read_bytes()?;
3899 f_9 = Some(val);
3900 },
3901 _ => {
3902 i_prot.skip(field_ident.field_type)?;
3903 },
3904 };
3905 i_prot.read_field_end()?;
3906 }
3907 i_prot.read_struct_end()?;
3908 verify_required_field_exists("ColumnChunk.file_offset", &f_2)?;
3909 let ret = ColumnChunk {
3910 file_path: f_1,
3911 file_offset: f_2.expect("auto-generated code should have checked for presence of required fields"),
3912 meta_data: f_3,
3913 offset_index_offset: f_4,
3914 offset_index_length: f_5,
3915 column_index_offset: f_6,
3916 column_index_length: f_7,
3917 crypto_metadata: f_8,
3918 encrypted_column_metadata: f_9,
3919 };
3920 Ok(ret)
3921 }
3922 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
3923 let struct_ident = TStructIdentifier::new("ColumnChunk");
3924 o_prot.write_struct_begin(&struct_ident)?;
3925 if let Some(ref fld_var) = self.file_path {
3926 o_prot.write_field_begin(&TFieldIdentifier::new("file_path", TType::String, 1))?;
3927 o_prot.write_string(fld_var)?;
3928 o_prot.write_field_end()?;
3929 ()
3930 } else {
3931 ()
3932 }
3933 o_prot.write_field_begin(&TFieldIdentifier::new("file_offset", TType::I64, 2))?;
3934 o_prot.write_i64(self.file_offset)?;
3935 o_prot.write_field_end()?;
3936 if let Some(ref fld_var) = self.meta_data {
3937 o_prot.write_field_begin(&TFieldIdentifier::new("meta_data", TType::Struct, 3))?;
3938 fld_var.write_to_out_protocol(o_prot)?;
3939 o_prot.write_field_end()?;
3940 ()
3941 } else {
3942 ()
3943 }
3944 if let Some(fld_var) = self.offset_index_offset {
3945 o_prot.write_field_begin(&TFieldIdentifier::new("offset_index_offset", TType::I64, 4))?;
3946 o_prot.write_i64(fld_var)?;
3947 o_prot.write_field_end()?;
3948 ()
3949 } else {
3950 ()
3951 }
3952 if let Some(fld_var) = self.offset_index_length {
3953 o_prot.write_field_begin(&TFieldIdentifier::new("offset_index_length", TType::I32, 5))?;
3954 o_prot.write_i32(fld_var)?;
3955 o_prot.write_field_end()?;
3956 ()
3957 } else {
3958 ()
3959 }
3960 if let Some(fld_var) = self.column_index_offset {
3961 o_prot.write_field_begin(&TFieldIdentifier::new("column_index_offset", TType::I64, 6))?;
3962 o_prot.write_i64(fld_var)?;
3963 o_prot.write_field_end()?;
3964 ()
3965 } else {
3966 ()
3967 }
3968 if let Some(fld_var) = self.column_index_length {
3969 o_prot.write_field_begin(&TFieldIdentifier::new("column_index_length", TType::I32, 7))?;
3970 o_prot.write_i32(fld_var)?;
3971 o_prot.write_field_end()?;
3972 ()
3973 } else {
3974 ()
3975 }
3976 if let Some(ref fld_var) = self.crypto_metadata {
3977 o_prot.write_field_begin(&TFieldIdentifier::new("crypto_metadata", TType::Struct, 8))?;
3978 fld_var.write_to_out_protocol(o_prot)?;
3979 o_prot.write_field_end()?;
3980 ()
3981 } else {
3982 ()
3983 }
3984 if let Some(ref fld_var) = self.encrypted_column_metadata {
3985 o_prot.write_field_begin(&TFieldIdentifier::new("encrypted_column_metadata", TType::String, 9))?;
3986 o_prot.write_bytes(fld_var)?;
3987 o_prot.write_field_end()?;
3988 ()
3989 } else {
3990 ()
3991 }
3992 o_prot.write_field_stop()?;
3993 o_prot.write_struct_end()
3994 }
3995}
3996
3997#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4002pub struct RowGroup {
4003 pub columns: Vec<ColumnChunk>,
4007 pub total_byte_size: i64,
4009 pub num_rows: i64,
4011 pub sorting_columns: Option<Vec<SortingColumn>>,
4014 pub file_offset: Option<i64>,
4017 pub total_compressed_size: Option<i64>,
4020 pub ordinal: Option<i16>,
4022}
4023
4024impl RowGroup {
4025 pub fn new<F4, F5, F6, F7>(columns: Vec<ColumnChunk>, total_byte_size: i64, num_rows: i64, sorting_columns: F4, file_offset: F5, total_compressed_size: F6, ordinal: F7) -> RowGroup where F4: Into<Option<Vec<SortingColumn>>>, F5: Into<Option<i64>>, F6: Into<Option<i64>>, F7: Into<Option<i16>> {
4026 RowGroup {
4027 columns: columns,
4028 total_byte_size: total_byte_size,
4029 num_rows: num_rows,
4030 sorting_columns: sorting_columns.into(),
4031 file_offset: file_offset.into(),
4032 total_compressed_size: total_compressed_size.into(),
4033 ordinal: ordinal.into(),
4034 }
4035 }
4036 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<RowGroup> {
4037 i_prot.read_struct_begin()?;
4038 let mut f_1: Option<Vec<ColumnChunk>> = None;
4039 let mut f_2: Option<i64> = None;
4040 let mut f_3: Option<i64> = None;
4041 let mut f_4: Option<Vec<SortingColumn>> = None;
4042 let mut f_5: Option<i64> = None;
4043 let mut f_6: Option<i64> = None;
4044 let mut f_7: Option<i16> = None;
4045 loop {
4046 let field_ident = i_prot.read_field_begin()?;
4047 if field_ident.field_type == TType::Stop {
4048 break;
4049 }
4050 let field_id = field_id(&field_ident)?;
4051 match field_id {
4052 1 => {
4053 let list_ident = i_prot.read_list_begin()?;
4054 let mut val: Vec<ColumnChunk> = Vec::with_capacity(list_ident.size as usize);
4055 for _ in 0..list_ident.size {
4056 let list_elem_5 = ColumnChunk::read_from_in_protocol(i_prot)?;
4057 val.push(list_elem_5);
4058 }
4059 i_prot.read_list_end()?;
4060 f_1 = Some(val);
4061 },
4062 2 => {
4063 let val = i_prot.read_i64()?;
4064 f_2 = Some(val);
4065 },
4066 3 => {
4067 let val = i_prot.read_i64()?;
4068 f_3 = Some(val);
4069 },
4070 4 => {
4071 let list_ident = i_prot.read_list_begin()?;
4072 let mut val: Vec<SortingColumn> = Vec::with_capacity(list_ident.size as usize);
4073 for _ in 0..list_ident.size {
4074 let list_elem_6 = SortingColumn::read_from_in_protocol(i_prot)?;
4075 val.push(list_elem_6);
4076 }
4077 i_prot.read_list_end()?;
4078 f_4 = Some(val);
4079 },
4080 5 => {
4081 let val = i_prot.read_i64()?;
4082 f_5 = Some(val);
4083 },
4084 6 => {
4085 let val = i_prot.read_i64()?;
4086 f_6 = Some(val);
4087 },
4088 7 => {
4089 let val = i_prot.read_i16()?;
4090 f_7 = Some(val);
4091 },
4092 _ => {
4093 i_prot.skip(field_ident.field_type)?;
4094 },
4095 };
4096 i_prot.read_field_end()?;
4097 }
4098 i_prot.read_struct_end()?;
4099 verify_required_field_exists("RowGroup.columns", &f_1)?;
4100 verify_required_field_exists("RowGroup.total_byte_size", &f_2)?;
4101 verify_required_field_exists("RowGroup.num_rows", &f_3)?;
4102 let ret = RowGroup {
4103 columns: f_1.expect("auto-generated code should have checked for presence of required fields"),
4104 total_byte_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
4105 num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
4106 sorting_columns: f_4,
4107 file_offset: f_5,
4108 total_compressed_size: f_6,
4109 ordinal: f_7,
4110 };
4111 Ok(ret)
4112 }
4113 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
4114 let struct_ident = TStructIdentifier::new("RowGroup");
4115 o_prot.write_struct_begin(&struct_ident)?;
4116 o_prot.write_field_begin(&TFieldIdentifier::new("columns", TType::List, 1))?;
4117 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.columns.len() as i32))?;
4118 for e in &self.columns {
4119 e.write_to_out_protocol(o_prot)?;
4120 o_prot.write_list_end()?;
4121 }
4122 o_prot.write_field_end()?;
4123 o_prot.write_field_begin(&TFieldIdentifier::new("total_byte_size", TType::I64, 2))?;
4124 o_prot.write_i64(self.total_byte_size)?;
4125 o_prot.write_field_end()?;
4126 o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I64, 3))?;
4127 o_prot.write_i64(self.num_rows)?;
4128 o_prot.write_field_end()?;
4129 if let Some(ref fld_var) = self.sorting_columns {
4130 o_prot.write_field_begin(&TFieldIdentifier::new("sorting_columns", TType::List, 4))?;
4131 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
4132 for e in fld_var {
4133 e.write_to_out_protocol(o_prot)?;
4134 o_prot.write_list_end()?;
4135 }
4136 o_prot.write_field_end()?;
4137 ()
4138 } else {
4139 ()
4140 }
4141 if let Some(fld_var) = self.file_offset {
4142 o_prot.write_field_begin(&TFieldIdentifier::new("file_offset", TType::I64, 5))?;
4143 o_prot.write_i64(fld_var)?;
4144 o_prot.write_field_end()?;
4145 ()
4146 } else {
4147 ()
4148 }
4149 if let Some(fld_var) = self.total_compressed_size {
4150 o_prot.write_field_begin(&TFieldIdentifier::new("total_compressed_size", TType::I64, 6))?;
4151 o_prot.write_i64(fld_var)?;
4152 o_prot.write_field_end()?;
4153 ()
4154 } else {
4155 ()
4156 }
4157 if let Some(fld_var) = self.ordinal {
4158 o_prot.write_field_begin(&TFieldIdentifier::new("ordinal", TType::I16, 7))?;
4159 o_prot.write_i16(fld_var)?;
4160 o_prot.write_field_end()?;
4161 ()
4162 } else {
4163 ()
4164 }
4165 o_prot.write_field_stop()?;
4166 o_prot.write_struct_end()
4167 }
4168}
4169
4170#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4176pub struct TypeDefinedOrder {
4177}
4178
4179impl TypeDefinedOrder {
4180 pub fn new() -> TypeDefinedOrder {
4181 TypeDefinedOrder {}
4182 }
4183 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TypeDefinedOrder> {
4184 i_prot.read_struct_begin()?;
4185 loop {
4186 let field_ident = i_prot.read_field_begin()?;
4187 if field_ident.field_type == TType::Stop {
4188 break;
4189 }
4190 let field_id = field_id(&field_ident)?;
4191 match field_id {
4192 _ => {
4193 i_prot.skip(field_ident.field_type)?;
4194 },
4195 };
4196 i_prot.read_field_end()?;
4197 }
4198 i_prot.read_struct_end()?;
4199 let ret = TypeDefinedOrder {};
4200 Ok(ret)
4201 }
4202 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
4203 let struct_ident = TStructIdentifier::new("TypeDefinedOrder");
4204 o_prot.write_struct_begin(&struct_ident)?;
4205 o_prot.write_field_stop()?;
4206 o_prot.write_struct_end()
4207 }
4208}
4209
4210impl Default for TypeDefinedOrder {
4211 fn default() -> Self {
4212 TypeDefinedOrder{}
4213 }
4214}
4215
4216#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4221pub enum ColumnOrder {
4222 TYPEORDER(TypeDefinedOrder),
4223}
4224
4225impl ColumnOrder {
4226 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<ColumnOrder> {
4227 let mut ret: Option<ColumnOrder> = None;
4228 let mut received_field_count = 0;
4229 i_prot.read_struct_begin()?;
4230 loop {
4231 let field_ident = i_prot.read_field_begin()?;
4232 if field_ident.field_type == TType::Stop {
4233 break;
4234 }
4235 let field_id = field_id(&field_ident)?;
4236 match field_id {
4237 1 => {
4238 let val = TypeDefinedOrder::read_from_in_protocol(i_prot)?;
4239 if ret.is_none() {
4240 ret = Some(ColumnOrder::TYPEORDER(val));
4241 }
4242 received_field_count += 1;
4243 },
4244 _ => {
4245 i_prot.skip(field_ident.field_type)?;
4246 received_field_count += 1;
4247 },
4248 };
4249 i_prot.read_field_end()?;
4250 }
4251 i_prot.read_struct_end()?;
4252 if received_field_count == 0 {
4253 Err(
4254 thrift::Error::Protocol(
4255 ProtocolError::new(
4256 ProtocolErrorKind::InvalidData,
4257 "received empty union from remote ColumnOrder"
4258 )
4259 )
4260 )
4261 } else if received_field_count > 1 {
4262 Err(
4263 thrift::Error::Protocol(
4264 ProtocolError::new(
4265 ProtocolErrorKind::InvalidData,
4266 "received multiple fields for union from remote ColumnOrder"
4267 )
4268 )
4269 )
4270 } else {
4271 Ok(ret.expect("return value should have been constructed"))
4272 }
4273 }
4274 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
4275 let struct_ident = TStructIdentifier::new("ColumnOrder");
4276 o_prot.write_struct_begin(&struct_ident)?;
4277 match *self {
4278 ColumnOrder::TYPEORDER(ref f) => {
4279 o_prot.write_field_begin(&TFieldIdentifier::new("TYPE_ORDER", TType::Struct, 1))?;
4280 f.write_to_out_protocol(o_prot)?;
4281 o_prot.write_field_end()?;
4282 },
4283 }
4284 o_prot.write_field_stop()?;
4285 o_prot.write_struct_end()
4286 }
4287}
4288
4289#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4294pub struct PageLocation {
4295 pub offset: i64,
4297 pub compressed_page_size: i32,
4300 pub first_row_index: i64,
4303}
4304
4305impl PageLocation {
4306 pub fn new(offset: i64, compressed_page_size: i32, first_row_index: i64) -> PageLocation {
4307 PageLocation {
4308 offset: offset,
4309 compressed_page_size: compressed_page_size,
4310 first_row_index: first_row_index,
4311 }
4312 }
4313 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<PageLocation> {
4314 i_prot.read_struct_begin()?;
4315 let mut f_1: Option<i64> = None;
4316 let mut f_2: Option<i32> = None;
4317 let mut f_3: Option<i64> = None;
4318 loop {
4319 let field_ident = i_prot.read_field_begin()?;
4320 if field_ident.field_type == TType::Stop {
4321 break;
4322 }
4323 let field_id = field_id(&field_ident)?;
4324 match field_id {
4325 1 => {
4326 let val = i_prot.read_i64()?;
4327 f_1 = Some(val);
4328 },
4329 2 => {
4330 let val = i_prot.read_i32()?;
4331 f_2 = Some(val);
4332 },
4333 3 => {
4334 let val = i_prot.read_i64()?;
4335 f_3 = Some(val);
4336 },
4337 _ => {
4338 i_prot.skip(field_ident.field_type)?;
4339 },
4340 };
4341 i_prot.read_field_end()?;
4342 }
4343 i_prot.read_struct_end()?;
4344 verify_required_field_exists("PageLocation.offset", &f_1)?;
4345 verify_required_field_exists("PageLocation.compressed_page_size", &f_2)?;
4346 verify_required_field_exists("PageLocation.first_row_index", &f_3)?;
4347 let ret = PageLocation {
4348 offset: f_1.expect("auto-generated code should have checked for presence of required fields"),
4349 compressed_page_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
4350 first_row_index: f_3.expect("auto-generated code should have checked for presence of required fields"),
4351 };
4352 Ok(ret)
4353 }
4354 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
4355 let struct_ident = TStructIdentifier::new("PageLocation");
4356 o_prot.write_struct_begin(&struct_ident)?;
4357 o_prot.write_field_begin(&TFieldIdentifier::new("offset", TType::I64, 1))?;
4358 o_prot.write_i64(self.offset)?;
4359 o_prot.write_field_end()?;
4360 o_prot.write_field_begin(&TFieldIdentifier::new("compressed_page_size", TType::I32, 2))?;
4361 o_prot.write_i32(self.compressed_page_size)?;
4362 o_prot.write_field_end()?;
4363 o_prot.write_field_begin(&TFieldIdentifier::new("first_row_index", TType::I64, 3))?;
4364 o_prot.write_i64(self.first_row_index)?;
4365 o_prot.write_field_end()?;
4366 o_prot.write_field_stop()?;
4367 o_prot.write_struct_end()
4368 }
4369}
4370
4371#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4376pub struct OffsetIndex {
4377 pub page_locations: Vec<PageLocation>,
4380}
4381
4382impl OffsetIndex {
4383 pub fn new(page_locations: Vec<PageLocation>) -> OffsetIndex {
4384 OffsetIndex {
4385 page_locations: page_locations,
4386 }
4387 }
4388 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<OffsetIndex> {
4389 i_prot.read_struct_begin()?;
4390 let mut f_1: Option<Vec<PageLocation>> = None;
4391 loop {
4392 let field_ident = i_prot.read_field_begin()?;
4393 if field_ident.field_type == TType::Stop {
4394 break;
4395 }
4396 let field_id = field_id(&field_ident)?;
4397 match field_id {
4398 1 => {
4399 let list_ident = i_prot.read_list_begin()?;
4400 let mut val: Vec<PageLocation> = Vec::with_capacity(list_ident.size as usize);
4401 for _ in 0..list_ident.size {
4402 let list_elem_7 = PageLocation::read_from_in_protocol(i_prot)?;
4403 val.push(list_elem_7);
4404 }
4405 i_prot.read_list_end()?;
4406 f_1 = Some(val);
4407 },
4408 _ => {
4409 i_prot.skip(field_ident.field_type)?;
4410 },
4411 };
4412 i_prot.read_field_end()?;
4413 }
4414 i_prot.read_struct_end()?;
4415 verify_required_field_exists("OffsetIndex.page_locations", &f_1)?;
4416 let ret = OffsetIndex {
4417 page_locations: f_1.expect("auto-generated code should have checked for presence of required fields"),
4418 };
4419 Ok(ret)
4420 }
4421 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
4422 let struct_ident = TStructIdentifier::new("OffsetIndex");
4423 o_prot.write_struct_begin(&struct_ident)?;
4424 o_prot.write_field_begin(&TFieldIdentifier::new("page_locations", TType::List, 1))?;
4425 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.page_locations.len() as i32))?;
4426 for e in &self.page_locations {
4427 e.write_to_out_protocol(o_prot)?;
4428 o_prot.write_list_end()?;
4429 }
4430 o_prot.write_field_end()?;
4431 o_prot.write_field_stop()?;
4432 o_prot.write_struct_end()
4433 }
4434}
4435
4436#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4443pub struct ColumnIndex {
4444 pub null_pages: Vec<bool>,
4450 pub min_values: Vec<Vec<u8>>,
4458 pub max_values: Vec<Vec<u8>>,
4459 pub boundary_order: BoundaryOrder,
4464 pub null_counts: Option<Vec<i64>>,
4466}
4467
4468impl ColumnIndex {
4469 pub fn new<F5>(null_pages: Vec<bool>, min_values: Vec<Vec<u8>>, max_values: Vec<Vec<u8>>, boundary_order: BoundaryOrder, null_counts: F5) -> ColumnIndex where F5: Into<Option<Vec<i64>>> {
4470 ColumnIndex {
4471 null_pages: null_pages,
4472 min_values: min_values,
4473 max_values: max_values,
4474 boundary_order: boundary_order,
4475 null_counts: null_counts.into(),
4476 }
4477 }
4478 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<ColumnIndex> {
4479 i_prot.read_struct_begin()?;
4480 let mut f_1: Option<Vec<bool>> = None;
4481 let mut f_2: Option<Vec<Vec<u8>>> = None;
4482 let mut f_3: Option<Vec<Vec<u8>>> = None;
4483 let mut f_4: Option<BoundaryOrder> = None;
4484 let mut f_5: Option<Vec<i64>> = None;
4485 loop {
4486 let field_ident = i_prot.read_field_begin()?;
4487 if field_ident.field_type == TType::Stop {
4488 break;
4489 }
4490 let field_id = field_id(&field_ident)?;
4491 match field_id {
4492 1 => {
4493 let list_ident = i_prot.read_list_begin()?;
4494 let mut val: Vec<bool> = Vec::with_capacity(list_ident.size as usize);
4495 for _ in 0..list_ident.size {
4496 let list_elem_8 = i_prot.read_bool()?;
4497 val.push(list_elem_8);
4498 }
4499 i_prot.read_list_end()?;
4500 f_1 = Some(val);
4501 },
4502 2 => {
4503 let list_ident = i_prot.read_list_begin()?;
4504 let mut val: Vec<Vec<u8>> = Vec::with_capacity(list_ident.size as usize);
4505 for _ in 0..list_ident.size {
4506 let list_elem_9 = i_prot.read_bytes()?;
4507 val.push(list_elem_9);
4508 }
4509 i_prot.read_list_end()?;
4510 f_2 = Some(val);
4511 },
4512 3 => {
4513 let list_ident = i_prot.read_list_begin()?;
4514 let mut val: Vec<Vec<u8>> = Vec::with_capacity(list_ident.size as usize);
4515 for _ in 0..list_ident.size {
4516 let list_elem_10 = i_prot.read_bytes()?;
4517 val.push(list_elem_10);
4518 }
4519 i_prot.read_list_end()?;
4520 f_3 = Some(val);
4521 },
4522 4 => {
4523 let val = BoundaryOrder::read_from_in_protocol(i_prot)?;
4524 f_4 = Some(val);
4525 },
4526 5 => {
4527 let list_ident = i_prot.read_list_begin()?;
4528 let mut val: Vec<i64> = Vec::with_capacity(list_ident.size as usize);
4529 for _ in 0..list_ident.size {
4530 let list_elem_11 = i_prot.read_i64()?;
4531 val.push(list_elem_11);
4532 }
4533 i_prot.read_list_end()?;
4534 f_5 = Some(val);
4535 },
4536 _ => {
4537 i_prot.skip(field_ident.field_type)?;
4538 },
4539 };
4540 i_prot.read_field_end()?;
4541 }
4542 i_prot.read_struct_end()?;
4543 verify_required_field_exists("ColumnIndex.null_pages", &f_1)?;
4544 verify_required_field_exists("ColumnIndex.min_values", &f_2)?;
4545 verify_required_field_exists("ColumnIndex.max_values", &f_3)?;
4546 verify_required_field_exists("ColumnIndex.boundary_order", &f_4)?;
4547 let ret = ColumnIndex {
4548 null_pages: f_1.expect("auto-generated code should have checked for presence of required fields"),
4549 min_values: f_2.expect("auto-generated code should have checked for presence of required fields"),
4550 max_values: f_3.expect("auto-generated code should have checked for presence of required fields"),
4551 boundary_order: f_4.expect("auto-generated code should have checked for presence of required fields"),
4552 null_counts: f_5,
4553 };
4554 Ok(ret)
4555 }
4556 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
4557 let struct_ident = TStructIdentifier::new("ColumnIndex");
4558 o_prot.write_struct_begin(&struct_ident)?;
4559 o_prot.write_field_begin(&TFieldIdentifier::new("null_pages", TType::List, 1))?;
4560 o_prot.write_list_begin(&TListIdentifier::new(TType::Bool, self.null_pages.len() as i32))?;
4561 for e in &self.null_pages {
4562 o_prot.write_bool(*e)?;
4563 o_prot.write_list_end()?;
4564 }
4565 o_prot.write_field_end()?;
4566 o_prot.write_field_begin(&TFieldIdentifier::new("min_values", TType::List, 2))?;
4567 o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.min_values.len() as i32))?;
4568 for e in &self.min_values {
4569 o_prot.write_bytes(e)?;
4570 o_prot.write_list_end()?;
4571 }
4572 o_prot.write_field_end()?;
4573 o_prot.write_field_begin(&TFieldIdentifier::new("max_values", TType::List, 3))?;
4574 o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.max_values.len() as i32))?;
4575 for e in &self.max_values {
4576 o_prot.write_bytes(e)?;
4577 o_prot.write_list_end()?;
4578 }
4579 o_prot.write_field_end()?;
4580 o_prot.write_field_begin(&TFieldIdentifier::new("boundary_order", TType::I32, 4))?;
4581 self.boundary_order.write_to_out_protocol(o_prot)?;
4582 o_prot.write_field_end()?;
4583 if let Some(ref fld_var) = self.null_counts {
4584 o_prot.write_field_begin(&TFieldIdentifier::new("null_counts", TType::List, 5))?;
4585 o_prot.write_list_begin(&TListIdentifier::new(TType::I64, fld_var.len() as i32))?;
4586 for e in fld_var {
4587 o_prot.write_i64(*e)?;
4588 o_prot.write_list_end()?;
4589 }
4590 o_prot.write_field_end()?;
4591 ()
4592 } else {
4593 ()
4594 }
4595 o_prot.write_field_stop()?;
4596 o_prot.write_struct_end()
4597 }
4598}
4599
4600#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4605pub struct AesGcmV1 {
4606 pub aad_prefix: Option<Vec<u8>>,
4608 pub aad_file_unique: Option<Vec<u8>>,
4610 pub supply_aad_prefix: Option<bool>,
4613}
4614
4615impl AesGcmV1 {
4616 pub fn new<F1, F2, F3>(aad_prefix: F1, aad_file_unique: F2, supply_aad_prefix: F3) -> AesGcmV1 where F1: Into<Option<Vec<u8>>>, F2: Into<Option<Vec<u8>>>, F3: Into<Option<bool>> {
4617 AesGcmV1 {
4618 aad_prefix: aad_prefix.into(),
4619 aad_file_unique: aad_file_unique.into(),
4620 supply_aad_prefix: supply_aad_prefix.into(),
4621 }
4622 }
4623 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<AesGcmV1> {
4624 i_prot.read_struct_begin()?;
4625 let mut f_1: Option<Vec<u8>> = None;
4626 let mut f_2: Option<Vec<u8>> = None;
4627 let mut f_3: Option<bool> = None;
4628 loop {
4629 let field_ident = i_prot.read_field_begin()?;
4630 if field_ident.field_type == TType::Stop {
4631 break;
4632 }
4633 let field_id = field_id(&field_ident)?;
4634 match field_id {
4635 1 => {
4636 let val = i_prot.read_bytes()?;
4637 f_1 = Some(val);
4638 },
4639 2 => {
4640 let val = i_prot.read_bytes()?;
4641 f_2 = Some(val);
4642 },
4643 3 => {
4644 let val = i_prot.read_bool()?;
4645 f_3 = Some(val);
4646 },
4647 _ => {
4648 i_prot.skip(field_ident.field_type)?;
4649 },
4650 };
4651 i_prot.read_field_end()?;
4652 }
4653 i_prot.read_struct_end()?;
4654 let ret = AesGcmV1 {
4655 aad_prefix: f_1,
4656 aad_file_unique: f_2,
4657 supply_aad_prefix: f_3,
4658 };
4659 Ok(ret)
4660 }
4661 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
4662 let struct_ident = TStructIdentifier::new("AesGcmV1");
4663 o_prot.write_struct_begin(&struct_ident)?;
4664 if let Some(ref fld_var) = self.aad_prefix {
4665 o_prot.write_field_begin(&TFieldIdentifier::new("aad_prefix", TType::String, 1))?;
4666 o_prot.write_bytes(fld_var)?;
4667 o_prot.write_field_end()?;
4668 ()
4669 } else {
4670 ()
4671 }
4672 if let Some(ref fld_var) = self.aad_file_unique {
4673 o_prot.write_field_begin(&TFieldIdentifier::new("aad_file_unique", TType::String, 2))?;
4674 o_prot.write_bytes(fld_var)?;
4675 o_prot.write_field_end()?;
4676 ()
4677 } else {
4678 ()
4679 }
4680 if let Some(fld_var) = self.supply_aad_prefix {
4681 o_prot.write_field_begin(&TFieldIdentifier::new("supply_aad_prefix", TType::Bool, 3))?;
4682 o_prot.write_bool(fld_var)?;
4683 o_prot.write_field_end()?;
4684 ()
4685 } else {
4686 ()
4687 }
4688 o_prot.write_field_stop()?;
4689 o_prot.write_struct_end()
4690 }
4691}
4692
4693impl Default for AesGcmV1 {
4694 fn default() -> Self {
4695 AesGcmV1{
4696 aad_prefix: Some(Vec::new()),
4697 aad_file_unique: Some(Vec::new()),
4698 supply_aad_prefix: Some(false),
4699 }
4700 }
4701}
4702
4703#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4708pub struct AesGcmCtrV1 {
4709 pub aad_prefix: Option<Vec<u8>>,
4711 pub aad_file_unique: Option<Vec<u8>>,
4713 pub supply_aad_prefix: Option<bool>,
4716}
4717
4718impl AesGcmCtrV1 {
4719 pub fn new<F1, F2, F3>(aad_prefix: F1, aad_file_unique: F2, supply_aad_prefix: F3) -> AesGcmCtrV1 where F1: Into<Option<Vec<u8>>>, F2: Into<Option<Vec<u8>>>, F3: Into<Option<bool>> {
4720 AesGcmCtrV1 {
4721 aad_prefix: aad_prefix.into(),
4722 aad_file_unique: aad_file_unique.into(),
4723 supply_aad_prefix: supply_aad_prefix.into(),
4724 }
4725 }
4726 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<AesGcmCtrV1> {
4727 i_prot.read_struct_begin()?;
4728 let mut f_1: Option<Vec<u8>> = None;
4729 let mut f_2: Option<Vec<u8>> = None;
4730 let mut f_3: Option<bool> = None;
4731 loop {
4732 let field_ident = i_prot.read_field_begin()?;
4733 if field_ident.field_type == TType::Stop {
4734 break;
4735 }
4736 let field_id = field_id(&field_ident)?;
4737 match field_id {
4738 1 => {
4739 let val = i_prot.read_bytes()?;
4740 f_1 = Some(val);
4741 },
4742 2 => {
4743 let val = i_prot.read_bytes()?;
4744 f_2 = Some(val);
4745 },
4746 3 => {
4747 let val = i_prot.read_bool()?;
4748 f_3 = Some(val);
4749 },
4750 _ => {
4751 i_prot.skip(field_ident.field_type)?;
4752 },
4753 };
4754 i_prot.read_field_end()?;
4755 }
4756 i_prot.read_struct_end()?;
4757 let ret = AesGcmCtrV1 {
4758 aad_prefix: f_1,
4759 aad_file_unique: f_2,
4760 supply_aad_prefix: f_3,
4761 };
4762 Ok(ret)
4763 }
4764 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
4765 let struct_ident = TStructIdentifier::new("AesGcmCtrV1");
4766 o_prot.write_struct_begin(&struct_ident)?;
4767 if let Some(ref fld_var) = self.aad_prefix {
4768 o_prot.write_field_begin(&TFieldIdentifier::new("aad_prefix", TType::String, 1))?;
4769 o_prot.write_bytes(fld_var)?;
4770 o_prot.write_field_end()?;
4771 ()
4772 } else {
4773 ()
4774 }
4775 if let Some(ref fld_var) = self.aad_file_unique {
4776 o_prot.write_field_begin(&TFieldIdentifier::new("aad_file_unique", TType::String, 2))?;
4777 o_prot.write_bytes(fld_var)?;
4778 o_prot.write_field_end()?;
4779 ()
4780 } else {
4781 ()
4782 }
4783 if let Some(fld_var) = self.supply_aad_prefix {
4784 o_prot.write_field_begin(&TFieldIdentifier::new("supply_aad_prefix", TType::Bool, 3))?;
4785 o_prot.write_bool(fld_var)?;
4786 o_prot.write_field_end()?;
4787 ()
4788 } else {
4789 ()
4790 }
4791 o_prot.write_field_stop()?;
4792 o_prot.write_struct_end()
4793 }
4794}
4795
4796impl Default for AesGcmCtrV1 {
4797 fn default() -> Self {
4798 AesGcmCtrV1{
4799 aad_prefix: Some(Vec::new()),
4800 aad_file_unique: Some(Vec::new()),
4801 supply_aad_prefix: Some(false),
4802 }
4803 }
4804}
4805
4806#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4811pub enum EncryptionAlgorithm {
4812 AESGCMV1(AesGcmV1),
4813 AESGCMCTRV1(AesGcmCtrV1),
4814}
4815
4816impl EncryptionAlgorithm {
4817 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<EncryptionAlgorithm> {
4818 let mut ret: Option<EncryptionAlgorithm> = None;
4819 let mut received_field_count = 0;
4820 i_prot.read_struct_begin()?;
4821 loop {
4822 let field_ident = i_prot.read_field_begin()?;
4823 if field_ident.field_type == TType::Stop {
4824 break;
4825 }
4826 let field_id = field_id(&field_ident)?;
4827 match field_id {
4828 1 => {
4829 let val = AesGcmV1::read_from_in_protocol(i_prot)?;
4830 if ret.is_none() {
4831 ret = Some(EncryptionAlgorithm::AESGCMV1(val));
4832 }
4833 received_field_count += 1;
4834 },
4835 2 => {
4836 let val = AesGcmCtrV1::read_from_in_protocol(i_prot)?;
4837 if ret.is_none() {
4838 ret = Some(EncryptionAlgorithm::AESGCMCTRV1(val));
4839 }
4840 received_field_count += 1;
4841 },
4842 _ => {
4843 i_prot.skip(field_ident.field_type)?;
4844 received_field_count += 1;
4845 },
4846 };
4847 i_prot.read_field_end()?;
4848 }
4849 i_prot.read_struct_end()?;
4850 if received_field_count == 0 {
4851 Err(
4852 thrift::Error::Protocol(
4853 ProtocolError::new(
4854 ProtocolErrorKind::InvalidData,
4855 "received empty union from remote EncryptionAlgorithm"
4856 )
4857 )
4858 )
4859 } else if received_field_count > 1 {
4860 Err(
4861 thrift::Error::Protocol(
4862 ProtocolError::new(
4863 ProtocolErrorKind::InvalidData,
4864 "received multiple fields for union from remote EncryptionAlgorithm"
4865 )
4866 )
4867 )
4868 } else {
4869 Ok(ret.expect("return value should have been constructed"))
4870 }
4871 }
4872 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
4873 let struct_ident = TStructIdentifier::new("EncryptionAlgorithm");
4874 o_prot.write_struct_begin(&struct_ident)?;
4875 match *self {
4876 EncryptionAlgorithm::AESGCMV1(ref f) => {
4877 o_prot.write_field_begin(&TFieldIdentifier::new("AES_GCM_V1", TType::Struct, 1))?;
4878 f.write_to_out_protocol(o_prot)?;
4879 o_prot.write_field_end()?;
4880 },
4881 EncryptionAlgorithm::AESGCMCTRV1(ref f) => {
4882 o_prot.write_field_begin(&TFieldIdentifier::new("AES_GCM_CTR_V1", TType::Struct, 2))?;
4883 f.write_to_out_protocol(o_prot)?;
4884 o_prot.write_field_end()?;
4885 },
4886 }
4887 o_prot.write_field_stop()?;
4888 o_prot.write_struct_end()
4889 }
4890}
4891
4892#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4898pub struct FileMetaData {
4899 pub version: i32,
4901 pub schema: Vec<SchemaElement>,
4908 pub num_rows: i64,
4910 pub row_groups: Vec<RowGroup>,
4912 pub key_value_metadata: Option<Vec<KeyValue>>,
4914 pub created_by: Option<String>,
4919 pub column_orders: Option<Vec<ColumnOrder>>,
4931 pub encryption_algorithm: Option<EncryptionAlgorithm>,
4935 pub footer_signing_key_metadata: Option<Vec<u8>>,
4938}
4939
4940impl FileMetaData {
4941 pub fn new<F5, F6, F7, F8, F9>(version: i32, schema: Vec<SchemaElement>, num_rows: i64, row_groups: Vec<RowGroup>, key_value_metadata: F5, created_by: F6, column_orders: F7, encryption_algorithm: F8, footer_signing_key_metadata: F9) -> FileMetaData where F5: Into<Option<Vec<KeyValue>>>, F6: Into<Option<String>>, F7: Into<Option<Vec<ColumnOrder>>>, F8: Into<Option<EncryptionAlgorithm>>, F9: Into<Option<Vec<u8>>> {
4942 FileMetaData {
4943 version: version,
4944 schema: schema,
4945 num_rows: num_rows,
4946 row_groups: row_groups,
4947 key_value_metadata: key_value_metadata.into(),
4948 created_by: created_by.into(),
4949 column_orders: column_orders.into(),
4950 encryption_algorithm: encryption_algorithm.into(),
4951 footer_signing_key_metadata: footer_signing_key_metadata.into(),
4952 }
4953 }
4954 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<FileMetaData> {
4955 i_prot.read_struct_begin()?;
4956 let mut f_1: Option<i32> = None;
4957 let mut f_2: Option<Vec<SchemaElement>> = None;
4958 let mut f_3: Option<i64> = None;
4959 let mut f_4: Option<Vec<RowGroup>> = None;
4960 let mut f_5: Option<Vec<KeyValue>> = None;
4961 let mut f_6: Option<String> = None;
4962 let mut f_7: Option<Vec<ColumnOrder>> = None;
4963 let mut f_8: Option<EncryptionAlgorithm> = None;
4964 let mut f_9: Option<Vec<u8>> = None;
4965 loop {
4966 let field_ident = i_prot.read_field_begin()?;
4967 if field_ident.field_type == TType::Stop {
4968 break;
4969 }
4970 let field_id = field_id(&field_ident)?;
4971 match field_id {
4972 1 => {
4973 let val = i_prot.read_i32()?;
4974 f_1 = Some(val);
4975 },
4976 2 => {
4977 let list_ident = i_prot.read_list_begin()?;
4978 let mut val: Vec<SchemaElement> = Vec::with_capacity(list_ident.size as usize);
4979 for _ in 0..list_ident.size {
4980 let list_elem_12 = SchemaElement::read_from_in_protocol(i_prot)?;
4981 val.push(list_elem_12);
4982 }
4983 i_prot.read_list_end()?;
4984 f_2 = Some(val);
4985 },
4986 3 => {
4987 let val = i_prot.read_i64()?;
4988 f_3 = Some(val);
4989 },
4990 4 => {
4991 let list_ident = i_prot.read_list_begin()?;
4992 let mut val: Vec<RowGroup> = Vec::with_capacity(list_ident.size as usize);
4993 for _ in 0..list_ident.size {
4994 let list_elem_13 = RowGroup::read_from_in_protocol(i_prot)?;
4995 val.push(list_elem_13);
4996 }
4997 i_prot.read_list_end()?;
4998 f_4 = Some(val);
4999 },
5000 5 => {
5001 let list_ident = i_prot.read_list_begin()?;
5002 let mut val: Vec<KeyValue> = Vec::with_capacity(list_ident.size as usize);
5003 for _ in 0..list_ident.size {
5004 let list_elem_14 = KeyValue::read_from_in_protocol(i_prot)?;
5005 val.push(list_elem_14);
5006 }
5007 i_prot.read_list_end()?;
5008 f_5 = Some(val);
5009 },
5010 6 => {
5011 let val = i_prot.read_string()?;
5012 f_6 = Some(val);
5013 },
5014 7 => {
5015 let list_ident = i_prot.read_list_begin()?;
5016 let mut val: Vec<ColumnOrder> = Vec::with_capacity(list_ident.size as usize);
5017 for _ in 0..list_ident.size {
5018 let list_elem_15 = ColumnOrder::read_from_in_protocol(i_prot)?;
5019 val.push(list_elem_15);
5020 }
5021 i_prot.read_list_end()?;
5022 f_7 = Some(val);
5023 },
5024 8 => {
5025 let val = EncryptionAlgorithm::read_from_in_protocol(i_prot)?;
5026 f_8 = Some(val);
5027 },
5028 9 => {
5029 let val = i_prot.read_bytes()?;
5030 f_9 = Some(val);
5031 },
5032 _ => {
5033 i_prot.skip(field_ident.field_type)?;
5034 },
5035 };
5036 i_prot.read_field_end()?;
5037 }
5038 i_prot.read_struct_end()?;
5039 verify_required_field_exists("FileMetaData.version", &f_1)?;
5040 verify_required_field_exists("FileMetaData.schema", &f_2)?;
5041 verify_required_field_exists("FileMetaData.num_rows", &f_3)?;
5042 verify_required_field_exists("FileMetaData.row_groups", &f_4)?;
5043 let ret = FileMetaData {
5044 version: f_1.expect("auto-generated code should have checked for presence of required fields"),
5045 schema: f_2.expect("auto-generated code should have checked for presence of required fields"),
5046 num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
5047 row_groups: f_4.expect("auto-generated code should have checked for presence of required fields"),
5048 key_value_metadata: f_5,
5049 created_by: f_6,
5050 column_orders: f_7,
5051 encryption_algorithm: f_8,
5052 footer_signing_key_metadata: f_9,
5053 };
5054 Ok(ret)
5055 }
5056 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
5057 let struct_ident = TStructIdentifier::new("FileMetaData");
5058 o_prot.write_struct_begin(&struct_ident)?;
5059 o_prot.write_field_begin(&TFieldIdentifier::new("version", TType::I32, 1))?;
5060 o_prot.write_i32(self.version)?;
5061 o_prot.write_field_end()?;
5062 o_prot.write_field_begin(&TFieldIdentifier::new("schema", TType::List, 2))?;
5063 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.schema.len() as i32))?;
5064 for e in &self.schema {
5065 e.write_to_out_protocol(o_prot)?;
5066 o_prot.write_list_end()?;
5067 }
5068 o_prot.write_field_end()?;
5069 o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I64, 3))?;
5070 o_prot.write_i64(self.num_rows)?;
5071 o_prot.write_field_end()?;
5072 o_prot.write_field_begin(&TFieldIdentifier::new("row_groups", TType::List, 4))?;
5073 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.row_groups.len() as i32))?;
5074 for e in &self.row_groups {
5075 e.write_to_out_protocol(o_prot)?;
5076 o_prot.write_list_end()?;
5077 }
5078 o_prot.write_field_end()?;
5079 if let Some(ref fld_var) = self.key_value_metadata {
5080 o_prot.write_field_begin(&TFieldIdentifier::new("key_value_metadata", TType::List, 5))?;
5081 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
5082 for e in fld_var {
5083 e.write_to_out_protocol(o_prot)?;
5084 o_prot.write_list_end()?;
5085 }
5086 o_prot.write_field_end()?;
5087 ()
5088 } else {
5089 ()
5090 }
5091 if let Some(ref fld_var) = self.created_by {
5092 o_prot.write_field_begin(&TFieldIdentifier::new("created_by", TType::String, 6))?;
5093 o_prot.write_string(fld_var)?;
5094 o_prot.write_field_end()?;
5095 ()
5096 } else {
5097 ()
5098 }
5099 if let Some(ref fld_var) = self.column_orders {
5100 o_prot.write_field_begin(&TFieldIdentifier::new("column_orders", TType::List, 7))?;
5101 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
5102 for e in fld_var {
5103 e.write_to_out_protocol(o_prot)?;
5104 o_prot.write_list_end()?;
5105 }
5106 o_prot.write_field_end()?;
5107 ()
5108 } else {
5109 ()
5110 }
5111 if let Some(ref fld_var) = self.encryption_algorithm {
5112 o_prot.write_field_begin(&TFieldIdentifier::new("encryption_algorithm", TType::Struct, 8))?;
5113 fld_var.write_to_out_protocol(o_prot)?;
5114 o_prot.write_field_end()?;
5115 ()
5116 } else {
5117 ()
5118 }
5119 if let Some(ref fld_var) = self.footer_signing_key_metadata {
5120 o_prot.write_field_begin(&TFieldIdentifier::new("footer_signing_key_metadata", TType::String, 9))?;
5121 o_prot.write_bytes(fld_var)?;
5122 o_prot.write_field_end()?;
5123 ()
5124 } else {
5125 ()
5126 }
5127 o_prot.write_field_stop()?;
5128 o_prot.write_struct_end()
5129 }
5130}
5131
5132#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5138pub struct FileCryptoMetaData {
5139 pub encryption_algorithm: EncryptionAlgorithm,
5143 pub key_metadata: Option<Vec<u8>>,
5146}
5147
5148impl FileCryptoMetaData {
5149 pub fn new<F2>(encryption_algorithm: EncryptionAlgorithm, key_metadata: F2) -> FileCryptoMetaData where F2: Into<Option<Vec<u8>>> {
5150 FileCryptoMetaData {
5151 encryption_algorithm: encryption_algorithm,
5152 key_metadata: key_metadata.into(),
5153 }
5154 }
5155 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<FileCryptoMetaData> {
5156 i_prot.read_struct_begin()?;
5157 let mut f_1: Option<EncryptionAlgorithm> = None;
5158 let mut f_2: Option<Vec<u8>> = None;
5159 loop {
5160 let field_ident = i_prot.read_field_begin()?;
5161 if field_ident.field_type == TType::Stop {
5162 break;
5163 }
5164 let field_id = field_id(&field_ident)?;
5165 match field_id {
5166 1 => {
5167 let val = EncryptionAlgorithm::read_from_in_protocol(i_prot)?;
5168 f_1 = Some(val);
5169 },
5170 2 => {
5171 let val = i_prot.read_bytes()?;
5172 f_2 = Some(val);
5173 },
5174 _ => {
5175 i_prot.skip(field_ident.field_type)?;
5176 },
5177 };
5178 i_prot.read_field_end()?;
5179 }
5180 i_prot.read_struct_end()?;
5181 verify_required_field_exists("FileCryptoMetaData.encryption_algorithm", &f_1)?;
5182 let ret = FileCryptoMetaData {
5183 encryption_algorithm: f_1.expect("auto-generated code should have checked for presence of required fields"),
5184 key_metadata: f_2,
5185 };
5186 Ok(ret)
5187 }
5188 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
5189 let struct_ident = TStructIdentifier::new("FileCryptoMetaData");
5190 o_prot.write_struct_begin(&struct_ident)?;
5191 o_prot.write_field_begin(&TFieldIdentifier::new("encryption_algorithm", TType::Struct, 1))?;
5192 self.encryption_algorithm.write_to_out_protocol(o_prot)?;
5193 o_prot.write_field_end()?;
5194 if let Some(ref fld_var) = self.key_metadata {
5195 o_prot.write_field_begin(&TFieldIdentifier::new("key_metadata", TType::String, 2))?;
5196 o_prot.write_bytes(fld_var)?;
5197 o_prot.write_field_end()?;
5198 ()
5199 } else {
5200 ()
5201 }
5202 o_prot.write_field_stop()?;
5203 o_prot.write_struct_end()
5204 }
5205}
5206