1#![allow(unused_imports)]
5#![allow(unused_extern_crates)]
6#![allow(clippy::too_many_arguments, clippy::type_complexity, clippy::vec_box)]
7#![cfg_attr(rustfmt, rustfmt_skip)]
8
9use std::cell::RefCell;
10use std::collections::{BTreeMap, BTreeSet};
11use std::convert::{From, TryFrom};
12use std::default::Default;
13use std::error::Error;
14use std::fmt;
15use std::fmt::{Display, Formatter};
16use std::rc::Rc;
17
18use crate::thrift;
19
20use thrift::{ApplicationError, ApplicationErrorKind, ProtocolError, ProtocolErrorKind};
21use thrift::protocol::{TFieldIdentifier, TListIdentifier, TMapIdentifier, TMessageIdentifier, TMessageType, TInputProtocol, TInputStreamProtocol, TOutputProtocol, TOutputStreamProtocol, TSetIdentifier, TStructIdentifier, TType};
22use thrift::protocol::field_id;
23use thrift::protocol::verify_expected_message_type;
24use thrift::protocol::verify_expected_sequence_number;
25use thrift::protocol::verify_expected_service_call;
26use thrift::protocol::verify_required_field_exists;
27
28#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct Type(pub i32);
34
35impl Type {
36 pub const BOOLEAN: Type = Type(0);
37 pub const INT32: Type = Type(1);
38 pub const INT64: Type = Type(2);
39 pub const INT96: Type = Type(3);
40 pub const FLOAT: Type = Type(4);
41 pub const DOUBLE: Type = Type(5);
42 pub const BYTE_ARRAY: Type = Type(6);
43 pub const FIXED_LEN_BYTE_ARRAY: Type = Type(7);
44 pub const ENUM_VALUES: &'static [Self] = &[
45 Self::BOOLEAN,
46 Self::INT32,
47 Self::INT64,
48 Self::INT96,
49 Self::FLOAT,
50 Self::DOUBLE,
51 Self::BYTE_ARRAY,
52 Self::FIXED_LEN_BYTE_ARRAY,
53 ];
54 #[allow(clippy::trivially_copy_pass_by_ref)]
55 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
56 o_prot.write_i32(self.0)
57 }
58 #[allow(clippy::trivially_copy_pass_by_ref)]
59 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
60 o_prot.write_i32(self.0).await
61 }
62 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<Type> {
63 let enum_value = i_prot.read_i32()?;
64 Ok(Type::from(enum_value))
65 }
66 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<Type> {
67 let enum_value = i_prot.read_i32().await?;
68 Ok(Type::from(enum_value))
69 }
70}
71
72impl From<i32> for Type {
73 fn from(i: i32) -> Self {
74 match i {
75 0 => Type::BOOLEAN,
76 1 => Type::INT32,
77 2 => Type::INT64,
78 3 => Type::INT96,
79 4 => Type::FLOAT,
80 5 => Type::DOUBLE,
81 6 => Type::BYTE_ARRAY,
82 7 => Type::FIXED_LEN_BYTE_ARRAY,
83 _ => Type(i)
84 }
85 }
86}
87
88impl From<&i32> for Type {
89 fn from(i: &i32) -> Self {
90 Type::from(*i)
91 }
92}
93
94impl From<Type> for i32 {
95 fn from(e: Type) -> i32 {
96 e.0
97 }
98}
99
100impl From<&Type> for i32 {
101 fn from(e: &Type) -> i32 {
102 e.0
103 }
104}
105
106#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
111pub struct ConvertedType(pub i32);
112
113impl ConvertedType {
114 pub const UTF8: ConvertedType = ConvertedType(0);
116 pub const MAP: ConvertedType = ConvertedType(1);
118 pub const MAP_KEY_VALUE: ConvertedType = ConvertedType(2);
120 pub const LIST: ConvertedType = ConvertedType(3);
123 pub const ENUM: ConvertedType = ConvertedType(4);
125 pub const DECIMAL: ConvertedType = ConvertedType(5);
138 pub const DATE: ConvertedType = ConvertedType(6);
143 pub const TIME_MILLIS: ConvertedType = ConvertedType(7);
148 pub const TIME_MICROS: ConvertedType = ConvertedType(8);
153 pub const TIMESTAMP_MILLIS: ConvertedType = ConvertedType(9);
158 pub const TIMESTAMP_MICROS: ConvertedType = ConvertedType(10);
163 pub const UINT_8: ConvertedType = ConvertedType(11);
171 pub const UINT_16: ConvertedType = ConvertedType(12);
172 pub const UINT_32: ConvertedType = ConvertedType(13);
173 pub const UINT_64: ConvertedType = ConvertedType(14);
174 pub const INT_8: ConvertedType = ConvertedType(15);
182 pub const INT_16: ConvertedType = ConvertedType(16);
183 pub const INT_32: ConvertedType = ConvertedType(17);
184 pub const INT_64: ConvertedType = ConvertedType(18);
185 pub const JSON: ConvertedType = ConvertedType(19);
189 pub const BSON: ConvertedType = ConvertedType(20);
193 pub const INTERVAL: ConvertedType = ConvertedType(21);
204 pub const ENUM_VALUES: &'static [Self] = &[
205 Self::UTF8,
206 Self::MAP,
207 Self::MAP_KEY_VALUE,
208 Self::LIST,
209 Self::ENUM,
210 Self::DECIMAL,
211 Self::DATE,
212 Self::TIME_MILLIS,
213 Self::TIME_MICROS,
214 Self::TIMESTAMP_MILLIS,
215 Self::TIMESTAMP_MICROS,
216 Self::UINT_8,
217 Self::UINT_16,
218 Self::UINT_32,
219 Self::UINT_64,
220 Self::INT_8,
221 Self::INT_16,
222 Self::INT_32,
223 Self::INT_64,
224 Self::JSON,
225 Self::BSON,
226 Self::INTERVAL,
227 ];
228 #[allow(clippy::trivially_copy_pass_by_ref)]
229 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
230 o_prot.write_i32(self.0)
231 }
232 #[allow(clippy::trivially_copy_pass_by_ref)]
233 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
234 o_prot.write_i32(self.0).await
235 }
236 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ConvertedType> {
237 let enum_value = i_prot.read_i32()?;
238 Ok(ConvertedType::from(enum_value))
239 }
240 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<ConvertedType> {
241 let enum_value = i_prot.read_i32().await?;
242 Ok(ConvertedType::from(enum_value))
243 }
244}
245
246impl From<i32> for ConvertedType {
247 fn from(i: i32) -> Self {
248 match i {
249 0 => ConvertedType::UTF8,
250 1 => ConvertedType::MAP,
251 2 => ConvertedType::MAP_KEY_VALUE,
252 3 => ConvertedType::LIST,
253 4 => ConvertedType::ENUM,
254 5 => ConvertedType::DECIMAL,
255 6 => ConvertedType::DATE,
256 7 => ConvertedType::TIME_MILLIS,
257 8 => ConvertedType::TIME_MICROS,
258 9 => ConvertedType::TIMESTAMP_MILLIS,
259 10 => ConvertedType::TIMESTAMP_MICROS,
260 11 => ConvertedType::UINT_8,
261 12 => ConvertedType::UINT_16,
262 13 => ConvertedType::UINT_32,
263 14 => ConvertedType::UINT_64,
264 15 => ConvertedType::INT_8,
265 16 => ConvertedType::INT_16,
266 17 => ConvertedType::INT_32,
267 18 => ConvertedType::INT_64,
268 19 => ConvertedType::JSON,
269 20 => ConvertedType::BSON,
270 21 => ConvertedType::INTERVAL,
271 _ => ConvertedType(i)
272 }
273 }
274}
275
276impl From<&i32> for ConvertedType {
277 fn from(i: &i32) -> Self {
278 ConvertedType::from(*i)
279 }
280}
281
282impl From<ConvertedType> for i32 {
283 fn from(e: ConvertedType) -> i32 {
284 e.0
285 }
286}
287
288impl From<&ConvertedType> for i32 {
289 fn from(e: &ConvertedType) -> i32 {
290 e.0
291 }
292}
293
294#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
296pub struct FieldRepetitionType(pub i32);
297
298impl FieldRepetitionType {
299 pub const REQUIRED: FieldRepetitionType = FieldRepetitionType(0);
301 pub const OPTIONAL: FieldRepetitionType = FieldRepetitionType(1);
303 pub const REPEATED: FieldRepetitionType = FieldRepetitionType(2);
305 pub const ENUM_VALUES: &'static [Self] = &[
306 Self::REQUIRED,
307 Self::OPTIONAL,
308 Self::REPEATED,
309 ];
310 #[allow(clippy::trivially_copy_pass_by_ref)]
311 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
312 o_prot.write_i32(self.0)
313 }
314 #[allow(clippy::trivially_copy_pass_by_ref)]
315 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
316 o_prot.write_i32(self.0).await
317 }
318 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<FieldRepetitionType> {
319 let enum_value = i_prot.read_i32()?;
320 Ok(FieldRepetitionType::from(enum_value))
321 }
322 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<FieldRepetitionType> {
323 let enum_value = i_prot.read_i32().await?;
324 Ok(FieldRepetitionType::from(enum_value))
325 }
326}
327
328impl From<i32> for FieldRepetitionType {
329 fn from(i: i32) -> Self {
330 match i {
331 0 => FieldRepetitionType::REQUIRED,
332 1 => FieldRepetitionType::OPTIONAL,
333 2 => FieldRepetitionType::REPEATED,
334 _ => FieldRepetitionType(i)
335 }
336 }
337}
338
339impl From<&i32> for FieldRepetitionType {
340 fn from(i: &i32) -> Self {
341 FieldRepetitionType::from(*i)
342 }
343}
344
345impl From<FieldRepetitionType> for i32 {
346 fn from(e: FieldRepetitionType) -> i32 {
347 e.0
348 }
349}
350
351impl From<&FieldRepetitionType> for i32 {
352 fn from(e: &FieldRepetitionType) -> i32 {
353 e.0
354 }
355}
356
357#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
361pub struct Encoding(pub i32);
362
363impl Encoding {
364 pub const PLAIN: Encoding = Encoding(0);
373 pub const PLAIN_DICTIONARY: Encoding = Encoding(2);
378 pub const RLE: Encoding = Encoding(3);
381 pub const BIT_PACKED: Encoding = Encoding(4);
384 pub const DELTA_BINARY_PACKED: Encoding = Encoding(5);
387 pub const DELTA_LENGTH_BYTE_ARRAY: Encoding = Encoding(6);
390 pub const DELTA_BYTE_ARRAY: Encoding = Encoding(7);
393 pub const RLE_DICTIONARY: Encoding = Encoding(8);
395 pub const BYTE_STREAM_SPLIT: Encoding = Encoding(9);
402 pub const ENUM_VALUES: &'static [Self] = &[
403 Self::PLAIN,
404 Self::PLAIN_DICTIONARY,
405 Self::RLE,
406 Self::BIT_PACKED,
407 Self::DELTA_BINARY_PACKED,
408 Self::DELTA_LENGTH_BYTE_ARRAY,
409 Self::DELTA_BYTE_ARRAY,
410 Self::RLE_DICTIONARY,
411 Self::BYTE_STREAM_SPLIT,
412 ];
413 #[allow(clippy::trivially_copy_pass_by_ref)]
414 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
415 o_prot.write_i32(self.0)
416 }
417 #[allow(clippy::trivially_copy_pass_by_ref)]
418 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
419 o_prot.write_i32(self.0).await
420 }
421 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<Encoding> {
422 let enum_value = i_prot.read_i32()?;
423 Ok(Encoding::from(enum_value))
424 }
425 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<Encoding> {
426 let enum_value = i_prot.read_i32().await?;
427 Ok(Encoding::from(enum_value))
428 }
429}
430
431impl From<i32> for Encoding {
432 fn from(i: i32) -> Self {
433 match i {
434 0 => Encoding::PLAIN,
435 2 => Encoding::PLAIN_DICTIONARY,
436 3 => Encoding::RLE,
437 4 => Encoding::BIT_PACKED,
438 5 => Encoding::DELTA_BINARY_PACKED,
439 6 => Encoding::DELTA_LENGTH_BYTE_ARRAY,
440 7 => Encoding::DELTA_BYTE_ARRAY,
441 8 => Encoding::RLE_DICTIONARY,
442 9 => Encoding::BYTE_STREAM_SPLIT,
443 _ => Encoding(i)
444 }
445 }
446}
447
448impl From<&i32> for Encoding {
449 fn from(i: &i32) -> Self {
450 Encoding::from(*i)
451 }
452}
453
454impl From<Encoding> for i32 {
455 fn from(e: Encoding) -> i32 {
456 e.0
457 }
458}
459
460impl From<&Encoding> for i32 {
461 fn from(e: &Encoding) -> i32 {
462 e.0
463 }
464}
465
466#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
474pub struct CompressionCodec(pub i32);
475
476impl CompressionCodec {
477 pub const UNCOMPRESSED: CompressionCodec = CompressionCodec(0);
478 pub const SNAPPY: CompressionCodec = CompressionCodec(1);
479 pub const GZIP: CompressionCodec = CompressionCodec(2);
480 pub const LZO: CompressionCodec = CompressionCodec(3);
481 pub const BROTLI: CompressionCodec = CompressionCodec(4);
482 pub const LZ4: CompressionCodec = CompressionCodec(5);
483 pub const ZSTD: CompressionCodec = CompressionCodec(6);
484 pub const LZ4_RAW: CompressionCodec = CompressionCodec(7);
485 pub const ENUM_VALUES: &'static [Self] = &[
486 Self::UNCOMPRESSED,
487 Self::SNAPPY,
488 Self::GZIP,
489 Self::LZO,
490 Self::BROTLI,
491 Self::LZ4,
492 Self::ZSTD,
493 Self::LZ4_RAW,
494 ];
495 #[allow(clippy::trivially_copy_pass_by_ref)]
496 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
497 o_prot.write_i32(self.0)
498 }
499 #[allow(clippy::trivially_copy_pass_by_ref)]
500 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
501 o_prot.write_i32(self.0).await
502 }
503 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<CompressionCodec> {
504 let enum_value = i_prot.read_i32()?;
505 Ok(CompressionCodec::from(enum_value))
506 }
507 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<CompressionCodec> {
508 let enum_value = i_prot.read_i32().await?;
509 Ok(CompressionCodec::from(enum_value))
510 }
511}
512
513impl From<i32> for CompressionCodec {
514 fn from(i: i32) -> Self {
515 match i {
516 0 => CompressionCodec::UNCOMPRESSED,
517 1 => CompressionCodec::SNAPPY,
518 2 => CompressionCodec::GZIP,
519 3 => CompressionCodec::LZO,
520 4 => CompressionCodec::BROTLI,
521 5 => CompressionCodec::LZ4,
522 6 => CompressionCodec::ZSTD,
523 7 => CompressionCodec::LZ4_RAW,
524 _ => CompressionCodec(i)
525 }
526 }
527}
528
529impl From<&i32> for CompressionCodec {
530 fn from(i: &i32) -> Self {
531 CompressionCodec::from(*i)
532 }
533}
534
535impl From<CompressionCodec> for i32 {
536 fn from(e: CompressionCodec) -> i32 {
537 e.0
538 }
539}
540
541impl From<&CompressionCodec> for i32 {
542 fn from(e: &CompressionCodec) -> i32 {
543 e.0
544 }
545}
546
547#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
548pub struct PageType(pub i32);
549
550impl PageType {
551 pub const DATA_PAGE: PageType = PageType(0);
552 pub const INDEX_PAGE: PageType = PageType(1);
553 pub const DICTIONARY_PAGE: PageType = PageType(2);
554 pub const DATA_PAGE_V2: PageType = PageType(3);
555 pub const ENUM_VALUES: &'static [Self] = &[
556 Self::DATA_PAGE,
557 Self::INDEX_PAGE,
558 Self::DICTIONARY_PAGE,
559 Self::DATA_PAGE_V2,
560 ];
561 #[allow(clippy::trivially_copy_pass_by_ref)]
562 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
563 o_prot.write_i32(self.0)
564 }
565 #[allow(clippy::trivially_copy_pass_by_ref)]
566 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
567 o_prot.write_i32(self.0).await
568 }
569 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<PageType> {
570 let enum_value = i_prot.read_i32()?;
571 Ok(PageType::from(enum_value))
572 }
573 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<PageType> {
574 let enum_value = i_prot.read_i32().await?;
575 Ok(PageType::from(enum_value))
576 }
577}
578
579impl From<i32> for PageType {
580 fn from(i: i32) -> Self {
581 match i {
582 0 => PageType::DATA_PAGE,
583 1 => PageType::INDEX_PAGE,
584 2 => PageType::DICTIONARY_PAGE,
585 3 => PageType::DATA_PAGE_V2,
586 _ => PageType(i)
587 }
588 }
589}
590
591impl From<&i32> for PageType {
592 fn from(i: &i32) -> Self {
593 PageType::from(*i)
594 }
595}
596
597impl From<PageType> for i32 {
598 fn from(e: PageType) -> i32 {
599 e.0
600 }
601}
602
603impl From<&PageType> for i32 {
604 fn from(e: &PageType) -> i32 {
605 e.0
606 }
607}
608
609#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
612pub struct BoundaryOrder(pub i32);
613
614impl BoundaryOrder {
615 pub const UNORDERED: BoundaryOrder = BoundaryOrder(0);
616 pub const ASCENDING: BoundaryOrder = BoundaryOrder(1);
617 pub const DESCENDING: BoundaryOrder = BoundaryOrder(2);
618 pub const ENUM_VALUES: &'static [Self] = &[
619 Self::UNORDERED,
620 Self::ASCENDING,
621 Self::DESCENDING,
622 ];
623 #[allow(clippy::trivially_copy_pass_by_ref)]
624 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
625 o_prot.write_i32(self.0)
626 }
627 #[allow(clippy::trivially_copy_pass_by_ref)]
628 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
629 o_prot.write_i32(self.0).await
630 }
631 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BoundaryOrder> {
632 let enum_value = i_prot.read_i32()?;
633 Ok(BoundaryOrder::from(enum_value))
634 }
635 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<BoundaryOrder> {
636 let enum_value = i_prot.read_i32().await?;
637 Ok(BoundaryOrder::from(enum_value))
638 }
639}
640
641impl From<i32> for BoundaryOrder {
642 fn from(i: i32) -> Self {
643 match i {
644 0 => BoundaryOrder::UNORDERED,
645 1 => BoundaryOrder::ASCENDING,
646 2 => BoundaryOrder::DESCENDING,
647 _ => BoundaryOrder(i)
648 }
649 }
650}
651
652impl From<&i32> for BoundaryOrder {
653 fn from(i: &i32) -> Self {
654 BoundaryOrder::from(*i)
655 }
656}
657
658impl From<BoundaryOrder> for i32 {
659 fn from(e: BoundaryOrder) -> i32 {
660 e.0
661 }
662}
663
664impl From<&BoundaryOrder> for i32 {
665 fn from(e: &BoundaryOrder) -> i32 {
666 e.0
667 }
668}
669
670#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
677pub struct Statistics {
678 pub max: Option<Vec<u8>>,
690 pub min: Option<Vec<u8>>,
691 pub null_count: Option<i64>,
693 pub distinct_count: Option<i64>,
695 pub max_value: Option<Vec<u8>>,
700 pub min_value: Option<Vec<u8>>,
701}
702
703impl Statistics {
704 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>>> {
705 Statistics {
706 max: max.into(),
707 min: min.into(),
708 null_count: null_count.into(),
709 distinct_count: distinct_count.into(),
710 max_value: max_value.into(),
711 min_value: min_value.into(),
712 }
713 }
714 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<Statistics> {
715 i_prot.read_struct_begin()?;
716 let mut f_1: Option<Vec<u8>> = None;
717 let mut f_2: Option<Vec<u8>> = None;
718 let mut f_3: Option<i64> = None;
719 let mut f_4: Option<i64> = None;
720 let mut f_5: Option<Vec<u8>> = None;
721 let mut f_6: Option<Vec<u8>> = None;
722 loop {
723 let field_ident = i_prot.read_field_begin()?;
724 if field_ident.field_type == TType::Stop {
725 break;
726 }
727 let field_id = field_id(&field_ident)?;
728 match field_id {
729 1 => {
730 let val = i_prot.read_bytes()?;
731 f_1 = Some(val);
732 },
733 2 => {
734 let val = i_prot.read_bytes()?;
735 f_2 = Some(val);
736 },
737 3 => {
738 let val = i_prot.read_i64()?;
739 f_3 = Some(val);
740 },
741 4 => {
742 let val = i_prot.read_i64()?;
743 f_4 = Some(val);
744 },
745 5 => {
746 let val = i_prot.read_bytes()?;
747 f_5 = Some(val);
748 },
749 6 => {
750 let val = i_prot.read_bytes()?;
751 f_6 = Some(val);
752 },
753 _ => {
754 i_prot.skip(field_ident.field_type)?;
755 },
756 };
757 i_prot.read_field_end()?;
758 }
759 i_prot.read_struct_end()?;
760 let ret = Statistics {
761 max: f_1,
762 min: f_2,
763 null_count: f_3,
764 distinct_count: f_4,
765 max_value: f_5,
766 min_value: f_6,
767 };
768 Ok(ret)
769 }
770 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<Statistics> {
771 i_prot.read_struct_begin().await?;
772 let mut f_1: Option<Vec<u8>> = None;
773 let mut f_2: Option<Vec<u8>> = None;
774 let mut f_3: Option<i64> = None;
775 let mut f_4: Option<i64> = None;
776 let mut f_5: Option<Vec<u8>> = None;
777 let mut f_6: Option<Vec<u8>> = None;
778 loop {
779 let field_ident = i_prot.read_field_begin().await?;
780 if field_ident.field_type == TType::Stop {
781 break;
782 }
783 let field_id = field_id(&field_ident)?;
784 match field_id {
785 1 => {
786 let val = i_prot.read_bytes().await?;
787 f_1 = Some(val);
788 },
789 2 => {
790 let val = i_prot.read_bytes().await?;
791 f_2 = Some(val);
792 },
793 3 => {
794 let val = i_prot.read_i64().await?;
795 f_3 = Some(val);
796 },
797 4 => {
798 let val = i_prot.read_i64().await?;
799 f_4 = Some(val);
800 },
801 5 => {
802 let val = i_prot.read_bytes().await?;
803 f_5 = Some(val);
804 },
805 6 => {
806 let val = i_prot.read_bytes().await?;
807 f_6 = Some(val);
808 },
809 _ => {
810 i_prot.skip(field_ident.field_type).await?;
811 },
812 };
813 i_prot.read_field_end().await?;
814 }
815 i_prot.read_struct_end().await?;
816 let ret = Statistics {
817 max: f_1,
818 min: f_2,
819 null_count: f_3,
820 distinct_count: f_4,
821 max_value: f_5,
822 min_value: f_6,
823 };
824 Ok(ret)
825 }
826 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
827 let mut written = 0;
828 let struct_ident = TStructIdentifier::new("Statistics");
829 written += o_prot.write_struct_begin(&struct_ident)?;
830 if let Some(ref fld_var) = self.max {
831 written += o_prot.write_field_begin(&TFieldIdentifier::new("max", TType::String, 1))?;
832 written += o_prot.write_bytes(fld_var)?;
833 written += o_prot.write_field_end()?;
834 }
835 if let Some(ref fld_var) = self.min {
836 written += o_prot.write_field_begin(&TFieldIdentifier::new("min", TType::String, 2))?;
837 written += o_prot.write_bytes(fld_var)?;
838 written += o_prot.write_field_end()?;
839 }
840 if let Some(fld_var) = self.null_count {
841 written += o_prot.write_field_begin(&TFieldIdentifier::new("null_count", TType::I64, 3))?;
842 written += o_prot.write_i64(fld_var)?;
843 written += o_prot.write_field_end()?;
844 }
845 if let Some(fld_var) = self.distinct_count {
846 written += o_prot.write_field_begin(&TFieldIdentifier::new("distinct_count", TType::I64, 4))?;
847 written += o_prot.write_i64(fld_var)?;
848 written += o_prot.write_field_end()?;
849 }
850 if let Some(ref fld_var) = self.max_value {
851 written += o_prot.write_field_begin(&TFieldIdentifier::new("max_value", TType::String, 5))?;
852 written += o_prot.write_bytes(fld_var)?;
853 written += o_prot.write_field_end()?;
854 }
855 if let Some(ref fld_var) = self.min_value {
856 written += o_prot.write_field_begin(&TFieldIdentifier::new("min_value", TType::String, 6))?;
857 written += o_prot.write_bytes(fld_var)?;
858 written += o_prot.write_field_end()?;
859 }
860 written += o_prot.write_field_stop()?;
861 written += o_prot.write_struct_end()?;
862 Ok(written)
863 }
864 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
865 let mut written = 0;
866 let struct_ident = TStructIdentifier::new("Statistics");
867 written += o_prot.write_struct_begin(&struct_ident).await?;
868 if let Some(ref fld_var) = self.max {
869 written += o_prot.write_field_begin(&TFieldIdentifier::new("max", TType::String, 1)).await?;
870 written += o_prot.write_bytes(fld_var).await?;
871 written += o_prot.write_field_end()?;
872 }
873 if let Some(ref fld_var) = self.min {
874 written += o_prot.write_field_begin(&TFieldIdentifier::new("min", TType::String, 2)).await?;
875 written += o_prot.write_bytes(fld_var).await?;
876 written += o_prot.write_field_end()?;
877 }
878 if let Some(fld_var) = self.null_count {
879 written += o_prot.write_field_begin(&TFieldIdentifier::new("null_count", TType::I64, 3)).await?;
880 written += o_prot.write_i64(fld_var).await?;
881 written += o_prot.write_field_end()?;
882 }
883 if let Some(fld_var) = self.distinct_count {
884 written += o_prot.write_field_begin(&TFieldIdentifier::new("distinct_count", TType::I64, 4)).await?;
885 written += o_prot.write_i64(fld_var).await?;
886 written += o_prot.write_field_end()?;
887 }
888 if let Some(ref fld_var) = self.max_value {
889 written += o_prot.write_field_begin(&TFieldIdentifier::new("max_value", TType::String, 5)).await?;
890 written += o_prot.write_bytes(fld_var).await?;
891 written += o_prot.write_field_end()?;
892 }
893 if let Some(ref fld_var) = self.min_value {
894 written += o_prot.write_field_begin(&TFieldIdentifier::new("min_value", TType::String, 6)).await?;
895 written += o_prot.write_bytes(fld_var).await?;
896 written += o_prot.write_field_end()?;
897 }
898 written += o_prot.write_field_stop().await?;
899 written += o_prot.write_struct_end()?;
900 Ok(written)
901 }
902}
903
904impl Default for Statistics {
905 fn default() -> Self {
906 Statistics{
907 max: Some(Vec::new()),
908 min: Some(Vec::new()),
909 null_count: Some(0),
910 distinct_count: Some(0),
911 max_value: Some(Vec::new()),
912 min_value: Some(Vec::new()),
913 }
914 }
915}
916
917#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
923pub struct StringType {
924}
925
926impl StringType {
927 pub fn new() -> StringType {
928 StringType {}
929 }
930 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<StringType> {
931 i_prot.read_struct_begin()?;
932 loop {
933 let field_ident = i_prot.read_field_begin()?;
934 if field_ident.field_type == TType::Stop {
935 break;
936 }
937 let field_id = field_id(&field_ident)?;
938 match field_id {
939 _ => {
940 i_prot.skip(field_ident.field_type)?;
941 },
942 };
943 i_prot.read_field_end()?;
944 }
945 i_prot.read_struct_end()?;
946 let ret = StringType {};
947 Ok(ret)
948 }
949 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<StringType> {
950 i_prot.read_struct_begin().await?;
951 loop {
952 let field_ident = i_prot.read_field_begin().await?;
953 if field_ident.field_type == TType::Stop {
954 break;
955 }
956 let field_id = field_id(&field_ident)?;
957 match field_id {
958 _ => {
959 i_prot.skip(field_ident.field_type).await?;
960 },
961 };
962 i_prot.read_field_end().await?;
963 }
964 i_prot.read_struct_end().await?;
965 let ret = StringType {};
966 Ok(ret)
967 }
968 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
969 let mut written = 0;
970 let struct_ident = TStructIdentifier::new("StringType");
971 written += o_prot.write_struct_begin(&struct_ident)?;
972 written += o_prot.write_field_stop()?;
973 written += o_prot.write_struct_end()?;
974 Ok(written)
975 }
976 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
977 let mut written = 0;
978 let struct_ident = TStructIdentifier::new("StringType");
979 written += o_prot.write_struct_begin(&struct_ident).await?;
980 written += o_prot.write_field_stop().await?;
981 written += o_prot.write_struct_end()?;
982 Ok(written)
983 }
984}
985
986impl Default for StringType {
987 fn default() -> Self {
988 StringType{}
989 }
990}
991
992#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
997pub struct UUIDType {
998}
999
1000impl UUIDType {
1001 pub fn new() -> UUIDType {
1002 UUIDType {}
1003 }
1004 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<UUIDType> {
1005 i_prot.read_struct_begin()?;
1006 loop {
1007 let field_ident = i_prot.read_field_begin()?;
1008 if field_ident.field_type == TType::Stop {
1009 break;
1010 }
1011 let field_id = field_id(&field_ident)?;
1012 match field_id {
1013 _ => {
1014 i_prot.skip(field_ident.field_type)?;
1015 },
1016 };
1017 i_prot.read_field_end()?;
1018 }
1019 i_prot.read_struct_end()?;
1020 let ret = UUIDType {};
1021 Ok(ret)
1022 }
1023 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<UUIDType> {
1024 i_prot.read_struct_begin().await?;
1025 loop {
1026 let field_ident = i_prot.read_field_begin().await?;
1027 if field_ident.field_type == TType::Stop {
1028 break;
1029 }
1030 let field_id = field_id(&field_ident)?;
1031 match field_id {
1032 _ => {
1033 i_prot.skip(field_ident.field_type).await?;
1034 },
1035 };
1036 i_prot.read_field_end().await?;
1037 }
1038 i_prot.read_struct_end().await?;
1039 let ret = UUIDType {};
1040 Ok(ret)
1041 }
1042 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1043 let mut written = 0;
1044 let struct_ident = TStructIdentifier::new("UUIDType");
1045 written += o_prot.write_struct_begin(&struct_ident)?;
1046 written += o_prot.write_field_stop()?;
1047 written += o_prot.write_struct_end()?;
1048 Ok(written)
1049 }
1050 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1051 let mut written = 0;
1052 let struct_ident = TStructIdentifier::new("UUIDType");
1053 written += o_prot.write_struct_begin(&struct_ident).await?;
1054 written += o_prot.write_field_stop().await?;
1055 written += o_prot.write_struct_end()?;
1056 Ok(written)
1057 }
1058}
1059
1060impl Default for UUIDType {
1061 fn default() -> Self {
1062 UUIDType{}
1063 }
1064}
1065
1066#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1071pub struct MapType {
1072}
1073
1074impl MapType {
1075 pub fn new() -> MapType {
1076 MapType {}
1077 }
1078 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<MapType> {
1079 i_prot.read_struct_begin()?;
1080 loop {
1081 let field_ident = i_prot.read_field_begin()?;
1082 if field_ident.field_type == TType::Stop {
1083 break;
1084 }
1085 let field_id = field_id(&field_ident)?;
1086 match field_id {
1087 _ => {
1088 i_prot.skip(field_ident.field_type)?;
1089 },
1090 };
1091 i_prot.read_field_end()?;
1092 }
1093 i_prot.read_struct_end()?;
1094 let ret = MapType {};
1095 Ok(ret)
1096 }
1097 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<MapType> {
1098 i_prot.read_struct_begin().await?;
1099 loop {
1100 let field_ident = i_prot.read_field_begin().await?;
1101 if field_ident.field_type == TType::Stop {
1102 break;
1103 }
1104 let field_id = field_id(&field_ident)?;
1105 match field_id {
1106 _ => {
1107 i_prot.skip(field_ident.field_type).await?;
1108 },
1109 };
1110 i_prot.read_field_end().await?;
1111 }
1112 i_prot.read_struct_end().await?;
1113 let ret = MapType {};
1114 Ok(ret)
1115 }
1116 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1117 let mut written = 0;
1118 let struct_ident = TStructIdentifier::new("MapType");
1119 written += o_prot.write_struct_begin(&struct_ident)?;
1120 written += o_prot.write_field_stop()?;
1121 written += o_prot.write_struct_end()?;
1122 Ok(written)
1123 }
1124 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1125 let mut written = 0;
1126 let struct_ident = TStructIdentifier::new("MapType");
1127 written += o_prot.write_struct_begin(&struct_ident).await?;
1128 written += o_prot.write_field_stop().await?;
1129 written += o_prot.write_struct_end()?;
1130 Ok(written)
1131 }
1132}
1133
1134impl Default for MapType {
1135 fn default() -> Self {
1136 MapType{}
1137 }
1138}
1139
1140#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1145pub struct ListType {
1146}
1147
1148impl ListType {
1149 pub fn new() -> ListType {
1150 ListType {}
1151 }
1152 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ListType> {
1153 i_prot.read_struct_begin()?;
1154 loop {
1155 let field_ident = i_prot.read_field_begin()?;
1156 if field_ident.field_type == TType::Stop {
1157 break;
1158 }
1159 let field_id = field_id(&field_ident)?;
1160 match field_id {
1161 _ => {
1162 i_prot.skip(field_ident.field_type)?;
1163 },
1164 };
1165 i_prot.read_field_end()?;
1166 }
1167 i_prot.read_struct_end()?;
1168 let ret = ListType {};
1169 Ok(ret)
1170 }
1171 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<ListType> {
1172 i_prot.read_struct_begin().await?;
1173 loop {
1174 let field_ident = i_prot.read_field_begin().await?;
1175 if field_ident.field_type == TType::Stop {
1176 break;
1177 }
1178 let field_id = field_id(&field_ident)?;
1179 match field_id {
1180 _ => {
1181 i_prot.skip(field_ident.field_type).await?;
1182 },
1183 };
1184 i_prot.read_field_end().await?;
1185 }
1186 i_prot.read_struct_end().await?;
1187 let ret = ListType {};
1188 Ok(ret)
1189 }
1190 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1191 let mut written = 0;
1192 let struct_ident = TStructIdentifier::new("ListType");
1193 written += o_prot.write_struct_begin(&struct_ident)?;
1194 written += o_prot.write_field_stop()?;
1195 written += o_prot.write_struct_end()?;
1196 Ok(written)
1197 }
1198 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1199 let mut written = 0;
1200 let struct_ident = TStructIdentifier::new("ListType");
1201 written += o_prot.write_struct_begin(&struct_ident).await?;
1202 written += o_prot.write_field_stop().await?;
1203 written += o_prot.write_struct_end()?;
1204 Ok(written)
1205 }
1206}
1207
1208impl Default for ListType {
1209 fn default() -> Self {
1210 ListType{}
1211 }
1212}
1213
1214#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1219pub struct EnumType {
1220}
1221
1222impl EnumType {
1223 pub fn new() -> EnumType {
1224 EnumType {}
1225 }
1226 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<EnumType> {
1227 i_prot.read_struct_begin()?;
1228 loop {
1229 let field_ident = i_prot.read_field_begin()?;
1230 if field_ident.field_type == TType::Stop {
1231 break;
1232 }
1233 let field_id = field_id(&field_ident)?;
1234 match field_id {
1235 _ => {
1236 i_prot.skip(field_ident.field_type)?;
1237 },
1238 };
1239 i_prot.read_field_end()?;
1240 }
1241 i_prot.read_struct_end()?;
1242 let ret = EnumType {};
1243 Ok(ret)
1244 }
1245 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<EnumType> {
1246 i_prot.read_struct_begin().await?;
1247 loop {
1248 let field_ident = i_prot.read_field_begin().await?;
1249 if field_ident.field_type == TType::Stop {
1250 break;
1251 }
1252 let field_id = field_id(&field_ident)?;
1253 match field_id {
1254 _ => {
1255 i_prot.skip(field_ident.field_type).await?;
1256 },
1257 };
1258 i_prot.read_field_end().await?;
1259 }
1260 i_prot.read_struct_end().await?;
1261 let ret = EnumType {};
1262 Ok(ret)
1263 }
1264 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1265 let mut written = 0;
1266 let struct_ident = TStructIdentifier::new("EnumType");
1267 written += o_prot.write_struct_begin(&struct_ident)?;
1268 written += o_prot.write_field_stop()?;
1269 written += o_prot.write_struct_end()?;
1270 Ok(written)
1271 }
1272 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1273 let mut written = 0;
1274 let struct_ident = TStructIdentifier::new("EnumType");
1275 written += o_prot.write_struct_begin(&struct_ident).await?;
1276 written += o_prot.write_field_stop().await?;
1277 written += o_prot.write_struct_end()?;
1278 Ok(written)
1279 }
1280}
1281
1282impl Default for EnumType {
1283 fn default() -> Self {
1284 EnumType{}
1285 }
1286}
1287
1288#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1293pub struct DateType {
1294}
1295
1296impl DateType {
1297 pub fn new() -> DateType {
1298 DateType {}
1299 }
1300 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<DateType> {
1301 i_prot.read_struct_begin()?;
1302 loop {
1303 let field_ident = i_prot.read_field_begin()?;
1304 if field_ident.field_type == TType::Stop {
1305 break;
1306 }
1307 let field_id = field_id(&field_ident)?;
1308 match field_id {
1309 _ => {
1310 i_prot.skip(field_ident.field_type)?;
1311 },
1312 };
1313 i_prot.read_field_end()?;
1314 }
1315 i_prot.read_struct_end()?;
1316 let ret = DateType {};
1317 Ok(ret)
1318 }
1319 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<DateType> {
1320 i_prot.read_struct_begin().await?;
1321 loop {
1322 let field_ident = i_prot.read_field_begin().await?;
1323 if field_ident.field_type == TType::Stop {
1324 break;
1325 }
1326 let field_id = field_id(&field_ident)?;
1327 match field_id {
1328 _ => {
1329 i_prot.skip(field_ident.field_type).await?;
1330 },
1331 };
1332 i_prot.read_field_end().await?;
1333 }
1334 i_prot.read_struct_end().await?;
1335 let ret = DateType {};
1336 Ok(ret)
1337 }
1338 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1339 let mut written = 0;
1340 let struct_ident = TStructIdentifier::new("DateType");
1341 written += o_prot.write_struct_begin(&struct_ident)?;
1342 written += o_prot.write_field_stop()?;
1343 written += o_prot.write_struct_end()?;
1344 Ok(written)
1345 }
1346 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1347 let mut written = 0;
1348 let struct_ident = TStructIdentifier::new("DateType");
1349 written += o_prot.write_struct_begin(&struct_ident).await?;
1350 written += o_prot.write_field_stop().await?;
1351 written += o_prot.write_struct_end()?;
1352 Ok(written)
1353 }
1354}
1355
1356impl Default for DateType {
1357 fn default() -> Self {
1358 DateType{}
1359 }
1360}
1361
1362#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1372pub struct NullType {
1373}
1374
1375impl NullType {
1376 pub fn new() -> NullType {
1377 NullType {}
1378 }
1379 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<NullType> {
1380 i_prot.read_struct_begin()?;
1381 loop {
1382 let field_ident = i_prot.read_field_begin()?;
1383 if field_ident.field_type == TType::Stop {
1384 break;
1385 }
1386 let field_id = field_id(&field_ident)?;
1387 match field_id {
1388 _ => {
1389 i_prot.skip(field_ident.field_type)?;
1390 },
1391 };
1392 i_prot.read_field_end()?;
1393 }
1394 i_prot.read_struct_end()?;
1395 let ret = NullType {};
1396 Ok(ret)
1397 }
1398 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<NullType> {
1399 i_prot.read_struct_begin().await?;
1400 loop {
1401 let field_ident = i_prot.read_field_begin().await?;
1402 if field_ident.field_type == TType::Stop {
1403 break;
1404 }
1405 let field_id = field_id(&field_ident)?;
1406 match field_id {
1407 _ => {
1408 i_prot.skip(field_ident.field_type).await?;
1409 },
1410 };
1411 i_prot.read_field_end().await?;
1412 }
1413 i_prot.read_struct_end().await?;
1414 let ret = NullType {};
1415 Ok(ret)
1416 }
1417 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1418 let mut written = 0;
1419 let struct_ident = TStructIdentifier::new("NullType");
1420 written += o_prot.write_struct_begin(&struct_ident)?;
1421 written += o_prot.write_field_stop()?;
1422 written += o_prot.write_struct_end()?;
1423 Ok(written)
1424 }
1425 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1426 let mut written = 0;
1427 let struct_ident = TStructIdentifier::new("NullType");
1428 written += o_prot.write_struct_begin(&struct_ident).await?;
1429 written += o_prot.write_field_stop().await?;
1430 written += o_prot.write_struct_end()?;
1431 Ok(written)
1432 }
1433}
1434
1435impl Default for NullType {
1436 fn default() -> Self {
1437 NullType{}
1438 }
1439}
1440
1441#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1452pub struct DecimalType {
1453 pub scale: i32,
1454 pub precision: i32,
1455}
1456
1457impl DecimalType {
1458 pub fn new(scale: i32, precision: i32) -> DecimalType {
1459 DecimalType {
1460 scale,
1461 precision,
1462 }
1463 }
1464 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<DecimalType> {
1465 i_prot.read_struct_begin()?;
1466 let mut f_1: Option<i32> = None;
1467 let mut f_2: Option<i32> = None;
1468 loop {
1469 let field_ident = i_prot.read_field_begin()?;
1470 if field_ident.field_type == TType::Stop {
1471 break;
1472 }
1473 let field_id = field_id(&field_ident)?;
1474 match field_id {
1475 1 => {
1476 let val = i_prot.read_i32()?;
1477 f_1 = Some(val);
1478 },
1479 2 => {
1480 let val = i_prot.read_i32()?;
1481 f_2 = Some(val);
1482 },
1483 _ => {
1484 i_prot.skip(field_ident.field_type)?;
1485 },
1486 };
1487 i_prot.read_field_end()?;
1488 }
1489 i_prot.read_struct_end()?;
1490 verify_required_field_exists("DecimalType.scale", &f_1)?;
1491 verify_required_field_exists("DecimalType.precision", &f_2)?;
1492 let ret = DecimalType {
1493 scale: f_1.expect("auto-generated code should have checked for presence of required fields"),
1494 precision: f_2.expect("auto-generated code should have checked for presence of required fields"),
1495 };
1496 Ok(ret)
1497 }
1498 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<DecimalType> {
1499 i_prot.read_struct_begin().await?;
1500 let mut f_1: Option<i32> = None;
1501 let mut f_2: Option<i32> = None;
1502 loop {
1503 let field_ident = i_prot.read_field_begin().await?;
1504 if field_ident.field_type == TType::Stop {
1505 break;
1506 }
1507 let field_id = field_id(&field_ident)?;
1508 match field_id {
1509 1 => {
1510 let val = i_prot.read_i32().await?;
1511 f_1 = Some(val);
1512 },
1513 2 => {
1514 let val = i_prot.read_i32().await?;
1515 f_2 = Some(val);
1516 },
1517 _ => {
1518 i_prot.skip(field_ident.field_type).await?;
1519 },
1520 };
1521 i_prot.read_field_end().await?;
1522 }
1523 i_prot.read_struct_end().await?;
1524 verify_required_field_exists("DecimalType.scale", &f_1)?;
1525 verify_required_field_exists("DecimalType.precision", &f_2)?;
1526 let ret = DecimalType {
1527 scale: f_1.expect("auto-generated code should have checked for presence of required fields"),
1528 precision: f_2.expect("auto-generated code should have checked for presence of required fields"),
1529 };
1530 Ok(ret)
1531 }
1532 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1533 let mut written = 0;
1534 let struct_ident = TStructIdentifier::new("DecimalType");
1535 written += o_prot.write_struct_begin(&struct_ident)?;
1536 written += o_prot.write_field_begin(&TFieldIdentifier::new("scale", TType::I32, 1))?;
1537 written += o_prot.write_i32(self.scale)?;
1538 written += o_prot.write_field_end()?;
1539 written += o_prot.write_field_begin(&TFieldIdentifier::new("precision", TType::I32, 2))?;
1540 written += o_prot.write_i32(self.precision)?;
1541 written += o_prot.write_field_end()?;
1542 written += o_prot.write_field_stop()?;
1543 written += o_prot.write_struct_end()?;
1544 Ok(written)
1545 }
1546 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1547 let mut written = 0;
1548 let struct_ident = TStructIdentifier::new("DecimalType");
1549 written += o_prot.write_struct_begin(&struct_ident).await?;
1550 written += o_prot.write_field_begin(&TFieldIdentifier::new("scale", TType::I32, 1)).await?;
1551 written += o_prot.write_i32(self.scale).await?;
1552 written += o_prot.write_field_end()?;
1553 written += o_prot.write_field_begin(&TFieldIdentifier::new("precision", TType::I32, 2)).await?;
1554 written += o_prot.write_i32(self.precision).await?;
1555 written += o_prot.write_field_end()?;
1556 written += o_prot.write_field_stop().await?;
1557 written += o_prot.write_struct_end()?;
1558 Ok(written)
1559 }
1560}
1561
1562#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1568pub struct MilliSeconds {
1569}
1570
1571impl MilliSeconds {
1572 pub fn new() -> MilliSeconds {
1573 MilliSeconds {}
1574 }
1575 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<MilliSeconds> {
1576 i_prot.read_struct_begin()?;
1577 loop {
1578 let field_ident = i_prot.read_field_begin()?;
1579 if field_ident.field_type == TType::Stop {
1580 break;
1581 }
1582 let field_id = field_id(&field_ident)?;
1583 match field_id {
1584 _ => {
1585 i_prot.skip(field_ident.field_type)?;
1586 },
1587 };
1588 i_prot.read_field_end()?;
1589 }
1590 i_prot.read_struct_end()?;
1591 let ret = MilliSeconds {};
1592 Ok(ret)
1593 }
1594 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<MilliSeconds> {
1595 i_prot.read_struct_begin().await?;
1596 loop {
1597 let field_ident = i_prot.read_field_begin().await?;
1598 if field_ident.field_type == TType::Stop {
1599 break;
1600 }
1601 let field_id = field_id(&field_ident)?;
1602 match field_id {
1603 _ => {
1604 i_prot.skip(field_ident.field_type).await?;
1605 },
1606 };
1607 i_prot.read_field_end().await?;
1608 }
1609 i_prot.read_struct_end().await?;
1610 let ret = MilliSeconds {};
1611 Ok(ret)
1612 }
1613 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1614 let mut written = 0;
1615 let struct_ident = TStructIdentifier::new("MilliSeconds");
1616 written += o_prot.write_struct_begin(&struct_ident)?;
1617 written += o_prot.write_field_stop()?;
1618 written += o_prot.write_struct_end()?;
1619 Ok(written)
1620 }
1621 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1622 let mut written = 0;
1623 let struct_ident = TStructIdentifier::new("MilliSeconds");
1624 written += o_prot.write_struct_begin(&struct_ident).await?;
1625 written += o_prot.write_field_stop().await?;
1626 written += o_prot.write_struct_end()?;
1627 Ok(written)
1628 }
1629}
1630
1631impl Default for MilliSeconds {
1632 fn default() -> Self {
1633 MilliSeconds{}
1634 }
1635}
1636
1637#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1642pub struct MicroSeconds {
1643}
1644
1645impl MicroSeconds {
1646 pub fn new() -> MicroSeconds {
1647 MicroSeconds {}
1648 }
1649 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<MicroSeconds> {
1650 i_prot.read_struct_begin()?;
1651 loop {
1652 let field_ident = i_prot.read_field_begin()?;
1653 if field_ident.field_type == TType::Stop {
1654 break;
1655 }
1656 let field_id = field_id(&field_ident)?;
1657 match field_id {
1658 _ => {
1659 i_prot.skip(field_ident.field_type)?;
1660 },
1661 };
1662 i_prot.read_field_end()?;
1663 }
1664 i_prot.read_struct_end()?;
1665 let ret = MicroSeconds {};
1666 Ok(ret)
1667 }
1668 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<MicroSeconds> {
1669 i_prot.read_struct_begin().await?;
1670 loop {
1671 let field_ident = i_prot.read_field_begin().await?;
1672 if field_ident.field_type == TType::Stop {
1673 break;
1674 }
1675 let field_id = field_id(&field_ident)?;
1676 match field_id {
1677 _ => {
1678 i_prot.skip(field_ident.field_type).await?;
1679 },
1680 };
1681 i_prot.read_field_end().await?;
1682 }
1683 i_prot.read_struct_end().await?;
1684 let ret = MicroSeconds {};
1685 Ok(ret)
1686 }
1687 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1688 let mut written = 0;
1689 let struct_ident = TStructIdentifier::new("MicroSeconds");
1690 written += o_prot.write_struct_begin(&struct_ident)?;
1691 written += o_prot.write_field_stop()?;
1692 written += o_prot.write_struct_end()?;
1693 Ok(written)
1694 }
1695 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1696 let mut written = 0;
1697 let struct_ident = TStructIdentifier::new("MicroSeconds");
1698 written += o_prot.write_struct_begin(&struct_ident).await?;
1699 written += o_prot.write_field_stop().await?;
1700 written += o_prot.write_struct_end()?;
1701 Ok(written)
1702 }
1703}
1704
1705impl Default for MicroSeconds {
1706 fn default() -> Self {
1707 MicroSeconds{}
1708 }
1709}
1710
1711#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1716pub struct NanoSeconds {
1717}
1718
1719impl NanoSeconds {
1720 pub fn new() -> NanoSeconds {
1721 NanoSeconds {}
1722 }
1723 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<NanoSeconds> {
1724 i_prot.read_struct_begin()?;
1725 loop {
1726 let field_ident = i_prot.read_field_begin()?;
1727 if field_ident.field_type == TType::Stop {
1728 break;
1729 }
1730 let field_id = field_id(&field_ident)?;
1731 match field_id {
1732 _ => {
1733 i_prot.skip(field_ident.field_type)?;
1734 },
1735 };
1736 i_prot.read_field_end()?;
1737 }
1738 i_prot.read_struct_end()?;
1739 let ret = NanoSeconds {};
1740 Ok(ret)
1741 }
1742 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<NanoSeconds> {
1743 i_prot.read_struct_begin().await?;
1744 loop {
1745 let field_ident = i_prot.read_field_begin().await?;
1746 if field_ident.field_type == TType::Stop {
1747 break;
1748 }
1749 let field_id = field_id(&field_ident)?;
1750 match field_id {
1751 _ => {
1752 i_prot.skip(field_ident.field_type).await?;
1753 },
1754 };
1755 i_prot.read_field_end().await?;
1756 }
1757 i_prot.read_struct_end().await?;
1758 let ret = NanoSeconds {};
1759 Ok(ret)
1760 }
1761 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1762 let mut written = 0;
1763 let struct_ident = TStructIdentifier::new("NanoSeconds");
1764 written += o_prot.write_struct_begin(&struct_ident)?;
1765 written += o_prot.write_field_stop()?;
1766 written += o_prot.write_struct_end()?;
1767 Ok(written)
1768 }
1769 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1770 let mut written = 0;
1771 let struct_ident = TStructIdentifier::new("NanoSeconds");
1772 written += o_prot.write_struct_begin(&struct_ident).await?;
1773 written += o_prot.write_field_stop().await?;
1774 written += o_prot.write_struct_end()?;
1775 Ok(written)
1776 }
1777}
1778
1779impl Default for NanoSeconds {
1780 fn default() -> Self {
1781 NanoSeconds{}
1782 }
1783}
1784
1785#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1790pub enum TimeUnit {
1791 MILLIS(MilliSeconds),
1792 MICROS(MicroSeconds),
1793 NANOS(NanoSeconds),
1794}
1795
1796impl TimeUnit {
1797 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<TimeUnit> {
1798 let mut ret: Option<TimeUnit> = None;
1799 let mut received_field_count = 0;
1800 i_prot.read_struct_begin()?;
1801 loop {
1802 let field_ident = i_prot.read_field_begin()?;
1803 if field_ident.field_type == TType::Stop {
1804 break;
1805 }
1806 let field_id = field_id(&field_ident)?;
1807 match field_id {
1808 1 => {
1809 let val = MilliSeconds::read_from_in_protocol(i_prot)?;
1810 if ret.is_none() {
1811 ret = Some(TimeUnit::MILLIS(val));
1812 }
1813 received_field_count += 1;
1814 },
1815 2 => {
1816 let val = MicroSeconds::read_from_in_protocol(i_prot)?;
1817 if ret.is_none() {
1818 ret = Some(TimeUnit::MICROS(val));
1819 }
1820 received_field_count += 1;
1821 },
1822 3 => {
1823 let val = NanoSeconds::read_from_in_protocol(i_prot)?;
1824 if ret.is_none() {
1825 ret = Some(TimeUnit::NANOS(val));
1826 }
1827 received_field_count += 1;
1828 },
1829 _ => {
1830 i_prot.skip(field_ident.field_type)?;
1831 received_field_count += 1;
1832 },
1833 };
1834 i_prot.read_field_end()?;
1835 }
1836 i_prot.read_struct_end()?;
1837 if received_field_count == 0 {
1838 Err(
1839 thrift::Error::Protocol(
1840 ProtocolError::new(
1841 ProtocolErrorKind::InvalidData,
1842 "received empty union from remote TimeUnit"
1843 )
1844 )
1845 )
1846 } else if received_field_count > 1 {
1847 Err(
1848 thrift::Error::Protocol(
1849 ProtocolError::new(
1850 ProtocolErrorKind::InvalidData,
1851 "received multiple fields for union from remote TimeUnit"
1852 )
1853 )
1854 )
1855 } else {
1856 ret.ok_or_else(|| thrift::Error::Protocol(
1857 ProtocolError::new(
1858 ProtocolErrorKind::InvalidData,
1859 "received no field for union from remoteTimeUnit"
1860 )
1861 ))
1862 }
1863 }
1864 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<TimeUnit> {
1865 let mut ret: Option<TimeUnit> = None;
1866 let mut received_field_count = 0;
1867 i_prot.read_struct_begin().await?;
1868 loop {
1869 let field_ident = i_prot.read_field_begin().await?;
1870 if field_ident.field_type == TType::Stop {
1871 break;
1872 }
1873 let field_id = field_id(&field_ident)?;
1874 match field_id {
1875 1 => {
1876 let val = MilliSeconds::stream_from_in_protocol(i_prot).await?;
1877 if ret.is_none() {
1878 ret = Some(TimeUnit::MILLIS(val));
1879 }
1880 received_field_count += 1;
1881 },
1882 2 => {
1883 let val = MicroSeconds::stream_from_in_protocol(i_prot).await?;
1884 if ret.is_none() {
1885 ret = Some(TimeUnit::MICROS(val));
1886 }
1887 received_field_count += 1;
1888 },
1889 3 => {
1890 let val = NanoSeconds::stream_from_in_protocol(i_prot).await?;
1891 if ret.is_none() {
1892 ret = Some(TimeUnit::NANOS(val));
1893 }
1894 received_field_count += 1;
1895 },
1896 _ => {
1897 i_prot.skip(field_ident.field_type).await?;
1898 received_field_count += 1;
1899 },
1900 };
1901 i_prot.read_field_end().await?;
1902 }
1903 i_prot.read_struct_end().await?;
1904 if received_field_count == 0 {
1905 Err(
1906 thrift::Error::Protocol(
1907 ProtocolError::new(
1908 ProtocolErrorKind::InvalidData,
1909 "received empty union from remote TimeUnit"
1910 )
1911 )
1912 )
1913 } else if received_field_count > 1 {
1914 Err(
1915 thrift::Error::Protocol(
1916 ProtocolError::new(
1917 ProtocolErrorKind::InvalidData,
1918 "received multiple fields for union from remote TimeUnit"
1919 )
1920 )
1921 )
1922 } else {
1923 ret.ok_or_else(|| thrift::Error::Protocol(
1924 ProtocolError::new(
1925 ProtocolErrorKind::InvalidData,
1926 "received no field for union from remoteTimeUnit"
1927 )
1928 ))
1929 }
1930 }
1931 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1932 let struct_ident = TStructIdentifier::new("TimeUnit");
1933 let mut written = o_prot.write_struct_begin(&struct_ident)?;
1934 match *self {
1935 TimeUnit::MILLIS(ref f) => {
1936 written += o_prot.write_field_begin(&TFieldIdentifier::new("MILLIS", TType::Struct, 1))?;
1937 written += f.write_to_out_protocol(o_prot)?;
1938 written += o_prot.write_field_end()?;
1939 },
1940 TimeUnit::MICROS(ref f) => {
1941 written += o_prot.write_field_begin(&TFieldIdentifier::new("MICROS", TType::Struct, 2))?;
1942 written += f.write_to_out_protocol(o_prot)?;
1943 written += o_prot.write_field_end()?;
1944 },
1945 TimeUnit::NANOS(ref f) => {
1946 written += o_prot.write_field_begin(&TFieldIdentifier::new("NANOS", TType::Struct, 3))?;
1947 written += f.write_to_out_protocol(o_prot)?;
1948 written += o_prot.write_field_end()?;
1949 },
1950 }
1951 written += o_prot.write_field_stop()?;
1952 written += o_prot.write_struct_end()?;
1953 Ok(written)
1954 }
1955 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
1956 let struct_ident = TStructIdentifier::new("TimeUnit");
1957 let mut written = o_prot.write_struct_begin(&struct_ident).await?;
1958 match *self {
1959 TimeUnit::MILLIS(ref f) => {
1960 written += o_prot.write_field_begin(&TFieldIdentifier::new("MILLIS", TType::Struct, 1)).await?;
1961 written += f.write_to_out_stream_protocol(o_prot).await?;
1962 written += o_prot.write_field_end()?;
1963 },
1964 TimeUnit::MICROS(ref f) => {
1965 written += o_prot.write_field_begin(&TFieldIdentifier::new("MICROS", TType::Struct, 2)).await?;
1966 written += f.write_to_out_stream_protocol(o_prot).await?;
1967 written += o_prot.write_field_end()?;
1968 },
1969 TimeUnit::NANOS(ref f) => {
1970 written += o_prot.write_field_begin(&TFieldIdentifier::new("NANOS", TType::Struct, 3)).await?;
1971 written += f.write_to_out_stream_protocol(o_prot).await?;
1972 written += o_prot.write_field_end()?;
1973 },
1974 }
1975 written += o_prot.write_field_stop().await?;
1976 written += o_prot.write_struct_end()?;
1977 Ok(written)
1978 }
1979}
1980
1981#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1989pub struct TimestampType {
1990 pub is_adjusted_to_u_t_c: bool,
1991 pub unit: TimeUnit,
1992}
1993
1994impl TimestampType {
1995 pub fn new(is_adjusted_to_u_t_c: bool, unit: TimeUnit) -> TimestampType {
1996 TimestampType {
1997 is_adjusted_to_u_t_c,
1998 unit,
1999 }
2000 }
2001 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<TimestampType> {
2002 i_prot.read_struct_begin()?;
2003 let mut f_1: Option<bool> = None;
2004 let mut f_2: Option<TimeUnit> = None;
2005 loop {
2006 let field_ident = i_prot.read_field_begin()?;
2007 if field_ident.field_type == TType::Stop {
2008 break;
2009 }
2010 let field_id = field_id(&field_ident)?;
2011 match field_id {
2012 1 => {
2013 let val = i_prot.read_bool()?;
2014 f_1 = Some(val);
2015 },
2016 2 => {
2017 let val = TimeUnit::read_from_in_protocol(i_prot)?;
2018 f_2 = Some(val);
2019 },
2020 _ => {
2021 i_prot.skip(field_ident.field_type)?;
2022 },
2023 };
2024 i_prot.read_field_end()?;
2025 }
2026 i_prot.read_struct_end()?;
2027 verify_required_field_exists("TimestampType.is_adjusted_to_u_t_c", &f_1)?;
2028 verify_required_field_exists("TimestampType.unit", &f_2)?;
2029 let ret = TimestampType {
2030 is_adjusted_to_u_t_c: f_1.expect("auto-generated code should have checked for presence of required fields"),
2031 unit: f_2.expect("auto-generated code should have checked for presence of required fields"),
2032 };
2033 Ok(ret)
2034 }
2035 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<TimestampType> {
2036 i_prot.read_struct_begin().await?;
2037 let mut f_1: Option<bool> = None;
2038 let mut f_2: Option<TimeUnit> = None;
2039 loop {
2040 let field_ident = i_prot.read_field_begin().await?;
2041 if field_ident.field_type == TType::Stop {
2042 break;
2043 }
2044 let field_id = field_id(&field_ident)?;
2045 match field_id {
2046 1 => {
2047 let val = i_prot.read_bool().await?;
2048 f_1 = Some(val);
2049 },
2050 2 => {
2051 let val = TimeUnit::stream_from_in_protocol(i_prot).await?;
2052 f_2 = Some(val);
2053 },
2054 _ => {
2055 i_prot.skip(field_ident.field_type).await?;
2056 },
2057 };
2058 i_prot.read_field_end().await?;
2059 }
2060 i_prot.read_struct_end().await?;
2061 verify_required_field_exists("TimestampType.is_adjusted_to_u_t_c", &f_1)?;
2062 verify_required_field_exists("TimestampType.unit", &f_2)?;
2063 let ret = TimestampType {
2064 is_adjusted_to_u_t_c: f_1.expect("auto-generated code should have checked for presence of required fields"),
2065 unit: f_2.expect("auto-generated code should have checked for presence of required fields"),
2066 };
2067 Ok(ret)
2068 }
2069 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2070 let mut written = 0;
2071 let struct_ident = TStructIdentifier::new("TimestampType");
2072 written += o_prot.write_struct_begin(&struct_ident)?;
2073 written += o_prot.write_field_begin(&TFieldIdentifier::new("isAdjustedToUTC", TType::Bool, 1))?;
2074 written += o_prot.write_bool(self.is_adjusted_to_u_t_c)?;
2075 written += o_prot.write_field_end()?;
2076 written += o_prot.write_field_begin(&TFieldIdentifier::new("unit", TType::Struct, 2))?;
2077 written += self.unit.write_to_out_protocol(o_prot)?;
2078 written += o_prot.write_field_end()?;
2079 written += o_prot.write_field_stop()?;
2080 written += o_prot.write_struct_end()?;
2081 Ok(written)
2082 }
2083 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2084 let mut written = 0;
2085 let struct_ident = TStructIdentifier::new("TimestampType");
2086 written += o_prot.write_struct_begin(&struct_ident).await?;
2087 written += o_prot.write_field_begin(&TFieldIdentifier::new("isAdjustedToUTC", TType::Bool, 1)).await?;
2088 written += o_prot.write_bool(self.is_adjusted_to_u_t_c).await?;
2089 written += o_prot.write_field_end()?;
2090 written += o_prot.write_field_begin(&TFieldIdentifier::new("unit", TType::Struct, 2)).await?;
2091 written += self.unit.write_to_out_stream_protocol(o_prot).await?;
2092 written += o_prot.write_field_end()?;
2093 written += o_prot.write_field_stop().await?;
2094 written += o_prot.write_struct_end()?;
2095 Ok(written)
2096 }
2097}
2098
2099#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2107pub struct TimeType {
2108 pub is_adjusted_to_u_t_c: bool,
2109 pub unit: TimeUnit,
2110}
2111
2112impl TimeType {
2113 pub fn new(is_adjusted_to_u_t_c: bool, unit: TimeUnit) -> TimeType {
2114 TimeType {
2115 is_adjusted_to_u_t_c,
2116 unit,
2117 }
2118 }
2119 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<TimeType> {
2120 i_prot.read_struct_begin()?;
2121 let mut f_1: Option<bool> = None;
2122 let mut f_2: Option<TimeUnit> = None;
2123 loop {
2124 let field_ident = i_prot.read_field_begin()?;
2125 if field_ident.field_type == TType::Stop {
2126 break;
2127 }
2128 let field_id = field_id(&field_ident)?;
2129 match field_id {
2130 1 => {
2131 let val = i_prot.read_bool()?;
2132 f_1 = Some(val);
2133 },
2134 2 => {
2135 let val = TimeUnit::read_from_in_protocol(i_prot)?;
2136 f_2 = Some(val);
2137 },
2138 _ => {
2139 i_prot.skip(field_ident.field_type)?;
2140 },
2141 };
2142 i_prot.read_field_end()?;
2143 }
2144 i_prot.read_struct_end()?;
2145 verify_required_field_exists("TimeType.is_adjusted_to_u_t_c", &f_1)?;
2146 verify_required_field_exists("TimeType.unit", &f_2)?;
2147 let ret = TimeType {
2148 is_adjusted_to_u_t_c: f_1.expect("auto-generated code should have checked for presence of required fields"),
2149 unit: f_2.expect("auto-generated code should have checked for presence of required fields"),
2150 };
2151 Ok(ret)
2152 }
2153 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<TimeType> {
2154 i_prot.read_struct_begin().await?;
2155 let mut f_1: Option<bool> = None;
2156 let mut f_2: Option<TimeUnit> = None;
2157 loop {
2158 let field_ident = i_prot.read_field_begin().await?;
2159 if field_ident.field_type == TType::Stop {
2160 break;
2161 }
2162 let field_id = field_id(&field_ident)?;
2163 match field_id {
2164 1 => {
2165 let val = i_prot.read_bool().await?;
2166 f_1 = Some(val);
2167 },
2168 2 => {
2169 let val = TimeUnit::stream_from_in_protocol(i_prot).await?;
2170 f_2 = Some(val);
2171 },
2172 _ => {
2173 i_prot.skip(field_ident.field_type).await?;
2174 },
2175 };
2176 i_prot.read_field_end().await?;
2177 }
2178 i_prot.read_struct_end().await?;
2179 verify_required_field_exists("TimeType.is_adjusted_to_u_t_c", &f_1)?;
2180 verify_required_field_exists("TimeType.unit", &f_2)?;
2181 let ret = TimeType {
2182 is_adjusted_to_u_t_c: f_1.expect("auto-generated code should have checked for presence of required fields"),
2183 unit: f_2.expect("auto-generated code should have checked for presence of required fields"),
2184 };
2185 Ok(ret)
2186 }
2187 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2188 let mut written = 0;
2189 let struct_ident = TStructIdentifier::new("TimeType");
2190 written += o_prot.write_struct_begin(&struct_ident)?;
2191 written += o_prot.write_field_begin(&TFieldIdentifier::new("isAdjustedToUTC", TType::Bool, 1))?;
2192 written += o_prot.write_bool(self.is_adjusted_to_u_t_c)?;
2193 written += o_prot.write_field_end()?;
2194 written += o_prot.write_field_begin(&TFieldIdentifier::new("unit", TType::Struct, 2))?;
2195 written += self.unit.write_to_out_protocol(o_prot)?;
2196 written += o_prot.write_field_end()?;
2197 written += o_prot.write_field_stop()?;
2198 written += o_prot.write_struct_end()?;
2199 Ok(written)
2200 }
2201 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2202 let mut written = 0;
2203 let struct_ident = TStructIdentifier::new("TimeType");
2204 written += o_prot.write_struct_begin(&struct_ident).await?;
2205 written += o_prot.write_field_begin(&TFieldIdentifier::new("isAdjustedToUTC", TType::Bool, 1)).await?;
2206 written += o_prot.write_bool(self.is_adjusted_to_u_t_c).await?;
2207 written += o_prot.write_field_end()?;
2208 written += o_prot.write_field_begin(&TFieldIdentifier::new("unit", TType::Struct, 2)).await?;
2209 written += self.unit.write_to_out_stream_protocol(o_prot).await?;
2210 written += o_prot.write_field_end()?;
2211 written += o_prot.write_field_stop().await?;
2212 written += o_prot.write_struct_end()?;
2213 Ok(written)
2214 }
2215}
2216
2217#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2227pub struct IntType {
2228 pub bit_width: i8,
2229 pub is_signed: bool,
2230}
2231
2232impl IntType {
2233 pub fn new(bit_width: i8, is_signed: bool) -> IntType {
2234 IntType {
2235 bit_width,
2236 is_signed,
2237 }
2238 }
2239 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<IntType> {
2240 i_prot.read_struct_begin()?;
2241 let mut f_1: Option<i8> = None;
2242 let mut f_2: Option<bool> = None;
2243 loop {
2244 let field_ident = i_prot.read_field_begin()?;
2245 if field_ident.field_type == TType::Stop {
2246 break;
2247 }
2248 let field_id = field_id(&field_ident)?;
2249 match field_id {
2250 1 => {
2251 let val = i_prot.read_i8()?;
2252 f_1 = Some(val);
2253 },
2254 2 => {
2255 let val = i_prot.read_bool()?;
2256 f_2 = Some(val);
2257 },
2258 _ => {
2259 i_prot.skip(field_ident.field_type)?;
2260 },
2261 };
2262 i_prot.read_field_end()?;
2263 }
2264 i_prot.read_struct_end()?;
2265 verify_required_field_exists("IntType.bit_width", &f_1)?;
2266 verify_required_field_exists("IntType.is_signed", &f_2)?;
2267 let ret = IntType {
2268 bit_width: f_1.expect("auto-generated code should have checked for presence of required fields"),
2269 is_signed: f_2.expect("auto-generated code should have checked for presence of required fields"),
2270 };
2271 Ok(ret)
2272 }
2273 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<IntType> {
2274 i_prot.read_struct_begin().await?;
2275 let mut f_1: Option<i8> = None;
2276 let mut f_2: Option<bool> = None;
2277 loop {
2278 let field_ident = i_prot.read_field_begin().await?;
2279 if field_ident.field_type == TType::Stop {
2280 break;
2281 }
2282 let field_id = field_id(&field_ident)?;
2283 match field_id {
2284 1 => {
2285 let val = i_prot.read_i8().await?;
2286 f_1 = Some(val);
2287 },
2288 2 => {
2289 let val = i_prot.read_bool().await?;
2290 f_2 = Some(val);
2291 },
2292 _ => {
2293 i_prot.skip(field_ident.field_type).await?;
2294 },
2295 };
2296 i_prot.read_field_end().await?;
2297 }
2298 i_prot.read_struct_end().await?;
2299 verify_required_field_exists("IntType.bit_width", &f_1)?;
2300 verify_required_field_exists("IntType.is_signed", &f_2)?;
2301 let ret = IntType {
2302 bit_width: f_1.expect("auto-generated code should have checked for presence of required fields"),
2303 is_signed: f_2.expect("auto-generated code should have checked for presence of required fields"),
2304 };
2305 Ok(ret)
2306 }
2307 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2308 let mut written = 0;
2309 let struct_ident = TStructIdentifier::new("IntType");
2310 written += o_prot.write_struct_begin(&struct_ident)?;
2311 written += o_prot.write_field_begin(&TFieldIdentifier::new("bitWidth", TType::I08, 1))?;
2312 written += o_prot.write_i8(self.bit_width)?;
2313 written += o_prot.write_field_end()?;
2314 written += o_prot.write_field_begin(&TFieldIdentifier::new("isSigned", TType::Bool, 2))?;
2315 written += o_prot.write_bool(self.is_signed)?;
2316 written += o_prot.write_field_end()?;
2317 written += o_prot.write_field_stop()?;
2318 written += o_prot.write_struct_end()?;
2319 Ok(written)
2320 }
2321 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2322 let mut written = 0;
2323 let struct_ident = TStructIdentifier::new("IntType");
2324 written += o_prot.write_struct_begin(&struct_ident).await?;
2325 written += o_prot.write_field_begin(&TFieldIdentifier::new("bitWidth", TType::I08, 1)).await?;
2326 written += o_prot.write_i8(self.bit_width).await?;
2327 written += o_prot.write_field_end()?;
2328 written += o_prot.write_field_begin(&TFieldIdentifier::new("isSigned", TType::Bool, 2)).await?;
2329 written += o_prot.write_bool(self.is_signed).await?;
2330 written += o_prot.write_field_end()?;
2331 written += o_prot.write_field_stop().await?;
2332 written += o_prot.write_struct_end()?;
2333 Ok(written)
2334 }
2335}
2336
2337#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2345pub struct JsonType {
2346}
2347
2348impl JsonType {
2349 pub fn new() -> JsonType {
2350 JsonType {}
2351 }
2352 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<JsonType> {
2353 i_prot.read_struct_begin()?;
2354 loop {
2355 let field_ident = i_prot.read_field_begin()?;
2356 if field_ident.field_type == TType::Stop {
2357 break;
2358 }
2359 let field_id = field_id(&field_ident)?;
2360 match field_id {
2361 _ => {
2362 i_prot.skip(field_ident.field_type)?;
2363 },
2364 };
2365 i_prot.read_field_end()?;
2366 }
2367 i_prot.read_struct_end()?;
2368 let ret = JsonType {};
2369 Ok(ret)
2370 }
2371 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<JsonType> {
2372 i_prot.read_struct_begin().await?;
2373 loop {
2374 let field_ident = i_prot.read_field_begin().await?;
2375 if field_ident.field_type == TType::Stop {
2376 break;
2377 }
2378 let field_id = field_id(&field_ident)?;
2379 match field_id {
2380 _ => {
2381 i_prot.skip(field_ident.field_type).await?;
2382 },
2383 };
2384 i_prot.read_field_end().await?;
2385 }
2386 i_prot.read_struct_end().await?;
2387 let ret = JsonType {};
2388 Ok(ret)
2389 }
2390 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2391 let mut written = 0;
2392 let struct_ident = TStructIdentifier::new("JsonType");
2393 written += o_prot.write_struct_begin(&struct_ident)?;
2394 written += o_prot.write_field_stop()?;
2395 written += o_prot.write_struct_end()?;
2396 Ok(written)
2397 }
2398 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2399 let mut written = 0;
2400 let struct_ident = TStructIdentifier::new("JsonType");
2401 written += o_prot.write_struct_begin(&struct_ident).await?;
2402 written += o_prot.write_field_stop().await?;
2403 written += o_prot.write_struct_end()?;
2404 Ok(written)
2405 }
2406}
2407
2408impl Default for JsonType {
2409 fn default() -> Self {
2410 JsonType{}
2411 }
2412}
2413
2414#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2422pub struct BsonType {
2423}
2424
2425impl BsonType {
2426 pub fn new() -> BsonType {
2427 BsonType {}
2428 }
2429 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BsonType> {
2430 i_prot.read_struct_begin()?;
2431 loop {
2432 let field_ident = i_prot.read_field_begin()?;
2433 if field_ident.field_type == TType::Stop {
2434 break;
2435 }
2436 let field_id = field_id(&field_ident)?;
2437 match field_id {
2438 _ => {
2439 i_prot.skip(field_ident.field_type)?;
2440 },
2441 };
2442 i_prot.read_field_end()?;
2443 }
2444 i_prot.read_struct_end()?;
2445 let ret = BsonType {};
2446 Ok(ret)
2447 }
2448 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<BsonType> {
2449 i_prot.read_struct_begin().await?;
2450 loop {
2451 let field_ident = i_prot.read_field_begin().await?;
2452 if field_ident.field_type == TType::Stop {
2453 break;
2454 }
2455 let field_id = field_id(&field_ident)?;
2456 match field_id {
2457 _ => {
2458 i_prot.skip(field_ident.field_type).await?;
2459 },
2460 };
2461 i_prot.read_field_end().await?;
2462 }
2463 i_prot.read_struct_end().await?;
2464 let ret = BsonType {};
2465 Ok(ret)
2466 }
2467 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2468 let mut written = 0;
2469 let struct_ident = TStructIdentifier::new("BsonType");
2470 written += o_prot.write_struct_begin(&struct_ident)?;
2471 written += o_prot.write_field_stop()?;
2472 written += o_prot.write_struct_end()?;
2473 Ok(written)
2474 }
2475 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2476 let mut written = 0;
2477 let struct_ident = TStructIdentifier::new("BsonType");
2478 written += o_prot.write_struct_begin(&struct_ident).await?;
2479 written += o_prot.write_field_stop().await?;
2480 written += o_prot.write_struct_end()?;
2481 Ok(written)
2482 }
2483}
2484
2485impl Default for BsonType {
2486 fn default() -> Self {
2487 BsonType{}
2488 }
2489}
2490
2491#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2496pub enum LogicalType {
2497 STRING(StringType),
2498 MAP(MapType),
2499 LIST(ListType),
2500 ENUM(EnumType),
2501 DECIMAL(DecimalType),
2502 DATE(DateType),
2503 TIME(TimeType),
2504 TIMESTAMP(TimestampType),
2505 INTEGER(IntType),
2506 UNKNOWN(NullType),
2507 JSON(JsonType),
2508 BSON(BsonType),
2509 UUID(UUIDType),
2510}
2511
2512impl LogicalType {
2513 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<LogicalType> {
2514 let mut ret: Option<LogicalType> = None;
2515 let mut received_field_count = 0;
2516 i_prot.read_struct_begin()?;
2517 loop {
2518 let field_ident = i_prot.read_field_begin()?;
2519 if field_ident.field_type == TType::Stop {
2520 break;
2521 }
2522 let field_id = field_id(&field_ident)?;
2523 match field_id {
2524 1 => {
2525 let val = StringType::read_from_in_protocol(i_prot)?;
2526 if ret.is_none() {
2527 ret = Some(LogicalType::STRING(val));
2528 }
2529 received_field_count += 1;
2530 },
2531 2 => {
2532 let val = MapType::read_from_in_protocol(i_prot)?;
2533 if ret.is_none() {
2534 ret = Some(LogicalType::MAP(val));
2535 }
2536 received_field_count += 1;
2537 },
2538 3 => {
2539 let val = ListType::read_from_in_protocol(i_prot)?;
2540 if ret.is_none() {
2541 ret = Some(LogicalType::LIST(val));
2542 }
2543 received_field_count += 1;
2544 },
2545 4 => {
2546 let val = EnumType::read_from_in_protocol(i_prot)?;
2547 if ret.is_none() {
2548 ret = Some(LogicalType::ENUM(val));
2549 }
2550 received_field_count += 1;
2551 },
2552 5 => {
2553 let val = DecimalType::read_from_in_protocol(i_prot)?;
2554 if ret.is_none() {
2555 ret = Some(LogicalType::DECIMAL(val));
2556 }
2557 received_field_count += 1;
2558 },
2559 6 => {
2560 let val = DateType::read_from_in_protocol(i_prot)?;
2561 if ret.is_none() {
2562 ret = Some(LogicalType::DATE(val));
2563 }
2564 received_field_count += 1;
2565 },
2566 7 => {
2567 let val = TimeType::read_from_in_protocol(i_prot)?;
2568 if ret.is_none() {
2569 ret = Some(LogicalType::TIME(val));
2570 }
2571 received_field_count += 1;
2572 },
2573 8 => {
2574 let val = TimestampType::read_from_in_protocol(i_prot)?;
2575 if ret.is_none() {
2576 ret = Some(LogicalType::TIMESTAMP(val));
2577 }
2578 received_field_count += 1;
2579 },
2580 10 => {
2581 let val = IntType::read_from_in_protocol(i_prot)?;
2582 if ret.is_none() {
2583 ret = Some(LogicalType::INTEGER(val));
2584 }
2585 received_field_count += 1;
2586 },
2587 11 => {
2588 let val = NullType::read_from_in_protocol(i_prot)?;
2589 if ret.is_none() {
2590 ret = Some(LogicalType::UNKNOWN(val));
2591 }
2592 received_field_count += 1;
2593 },
2594 12 => {
2595 let val = JsonType::read_from_in_protocol(i_prot)?;
2596 if ret.is_none() {
2597 ret = Some(LogicalType::JSON(val));
2598 }
2599 received_field_count += 1;
2600 },
2601 13 => {
2602 let val = BsonType::read_from_in_protocol(i_prot)?;
2603 if ret.is_none() {
2604 ret = Some(LogicalType::BSON(val));
2605 }
2606 received_field_count += 1;
2607 },
2608 14 => {
2609 let val = UUIDType::read_from_in_protocol(i_prot)?;
2610 if ret.is_none() {
2611 ret = Some(LogicalType::UUID(val));
2612 }
2613 received_field_count += 1;
2614 },
2615 _ => {
2616 i_prot.skip(field_ident.field_type)?;
2617 received_field_count += 1;
2618 },
2619 };
2620 i_prot.read_field_end()?;
2621 }
2622 i_prot.read_struct_end()?;
2623 if received_field_count == 0 {
2624 Err(
2625 thrift::Error::Protocol(
2626 ProtocolError::new(
2627 ProtocolErrorKind::InvalidData,
2628 "received empty union from remote LogicalType"
2629 )
2630 )
2631 )
2632 } else if received_field_count > 1 {
2633 Err(
2634 thrift::Error::Protocol(
2635 ProtocolError::new(
2636 ProtocolErrorKind::InvalidData,
2637 "received multiple fields for union from remote LogicalType"
2638 )
2639 )
2640 )
2641 } else {
2642 ret.ok_or_else(|| thrift::Error::Protocol(
2643 ProtocolError::new(
2644 ProtocolErrorKind::InvalidData,
2645 "received no field for union from remoteLogicalType"
2646 )
2647 ))
2648 }
2649 }
2650 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<LogicalType> {
2651 let mut ret: Option<LogicalType> = None;
2652 let mut received_field_count = 0;
2653 i_prot.read_struct_begin().await?;
2654 loop {
2655 let field_ident = i_prot.read_field_begin().await?;
2656 if field_ident.field_type == TType::Stop {
2657 break;
2658 }
2659 let field_id = field_id(&field_ident)?;
2660 match field_id {
2661 1 => {
2662 let val = StringType::stream_from_in_protocol(i_prot).await?;
2663 if ret.is_none() {
2664 ret = Some(LogicalType::STRING(val));
2665 }
2666 received_field_count += 1;
2667 },
2668 2 => {
2669 let val = MapType::stream_from_in_protocol(i_prot).await?;
2670 if ret.is_none() {
2671 ret = Some(LogicalType::MAP(val));
2672 }
2673 received_field_count += 1;
2674 },
2675 3 => {
2676 let val = ListType::stream_from_in_protocol(i_prot).await?;
2677 if ret.is_none() {
2678 ret = Some(LogicalType::LIST(val));
2679 }
2680 received_field_count += 1;
2681 },
2682 4 => {
2683 let val = EnumType::stream_from_in_protocol(i_prot).await?;
2684 if ret.is_none() {
2685 ret = Some(LogicalType::ENUM(val));
2686 }
2687 received_field_count += 1;
2688 },
2689 5 => {
2690 let val = DecimalType::stream_from_in_protocol(i_prot).await?;
2691 if ret.is_none() {
2692 ret = Some(LogicalType::DECIMAL(val));
2693 }
2694 received_field_count += 1;
2695 },
2696 6 => {
2697 let val = DateType::stream_from_in_protocol(i_prot).await?;
2698 if ret.is_none() {
2699 ret = Some(LogicalType::DATE(val));
2700 }
2701 received_field_count += 1;
2702 },
2703 7 => {
2704 let val = TimeType::stream_from_in_protocol(i_prot).await?;
2705 if ret.is_none() {
2706 ret = Some(LogicalType::TIME(val));
2707 }
2708 received_field_count += 1;
2709 },
2710 8 => {
2711 let val = TimestampType::stream_from_in_protocol(i_prot).await?;
2712 if ret.is_none() {
2713 ret = Some(LogicalType::TIMESTAMP(val));
2714 }
2715 received_field_count += 1;
2716 },
2717 10 => {
2718 let val = IntType::stream_from_in_protocol(i_prot).await?;
2719 if ret.is_none() {
2720 ret = Some(LogicalType::INTEGER(val));
2721 }
2722 received_field_count += 1;
2723 },
2724 11 => {
2725 let val = NullType::stream_from_in_protocol(i_prot).await?;
2726 if ret.is_none() {
2727 ret = Some(LogicalType::UNKNOWN(val));
2728 }
2729 received_field_count += 1;
2730 },
2731 12 => {
2732 let val = JsonType::stream_from_in_protocol(i_prot).await?;
2733 if ret.is_none() {
2734 ret = Some(LogicalType::JSON(val));
2735 }
2736 received_field_count += 1;
2737 },
2738 13 => {
2739 let val = BsonType::stream_from_in_protocol(i_prot).await?;
2740 if ret.is_none() {
2741 ret = Some(LogicalType::BSON(val));
2742 }
2743 received_field_count += 1;
2744 },
2745 14 => {
2746 let val = UUIDType::stream_from_in_protocol(i_prot).await?;
2747 if ret.is_none() {
2748 ret = Some(LogicalType::UUID(val));
2749 }
2750 received_field_count += 1;
2751 },
2752 _ => {
2753 i_prot.skip(field_ident.field_type).await?;
2754 received_field_count += 1;
2755 },
2756 };
2757 i_prot.read_field_end().await?;
2758 }
2759 i_prot.read_struct_end().await?;
2760 if received_field_count == 0 {
2761 Err(
2762 thrift::Error::Protocol(
2763 ProtocolError::new(
2764 ProtocolErrorKind::InvalidData,
2765 "received empty union from remote LogicalType"
2766 )
2767 )
2768 )
2769 } else if received_field_count > 1 {
2770 Err(
2771 thrift::Error::Protocol(
2772 ProtocolError::new(
2773 ProtocolErrorKind::InvalidData,
2774 "received multiple fields for union from remote LogicalType"
2775 )
2776 )
2777 )
2778 } else {
2779 ret.ok_or_else(|| thrift::Error::Protocol(
2780 ProtocolError::new(
2781 ProtocolErrorKind::InvalidData,
2782 "received no field for union from remoteLogicalType"
2783 )
2784 ))
2785 }
2786 }
2787 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2788 let struct_ident = TStructIdentifier::new("LogicalType");
2789 let mut written = o_prot.write_struct_begin(&struct_ident)?;
2790 match *self {
2791 LogicalType::STRING(ref f) => {
2792 written += o_prot.write_field_begin(&TFieldIdentifier::new("STRING", TType::Struct, 1))?;
2793 written += f.write_to_out_protocol(o_prot)?;
2794 written += o_prot.write_field_end()?;
2795 },
2796 LogicalType::MAP(ref f) => {
2797 written += o_prot.write_field_begin(&TFieldIdentifier::new("MAP", TType::Struct, 2))?;
2798 written += f.write_to_out_protocol(o_prot)?;
2799 written += o_prot.write_field_end()?;
2800 },
2801 LogicalType::LIST(ref f) => {
2802 written += o_prot.write_field_begin(&TFieldIdentifier::new("LIST", TType::Struct, 3))?;
2803 written += f.write_to_out_protocol(o_prot)?;
2804 written += o_prot.write_field_end()?;
2805 },
2806 LogicalType::ENUM(ref f) => {
2807 written += o_prot.write_field_begin(&TFieldIdentifier::new("ENUM", TType::Struct, 4))?;
2808 written += f.write_to_out_protocol(o_prot)?;
2809 written += o_prot.write_field_end()?;
2810 },
2811 LogicalType::DECIMAL(ref f) => {
2812 written += o_prot.write_field_begin(&TFieldIdentifier::new("DECIMAL", TType::Struct, 5))?;
2813 written += f.write_to_out_protocol(o_prot)?;
2814 written += o_prot.write_field_end()?;
2815 },
2816 LogicalType::DATE(ref f) => {
2817 written += o_prot.write_field_begin(&TFieldIdentifier::new("DATE", TType::Struct, 6))?;
2818 written += f.write_to_out_protocol(o_prot)?;
2819 written += o_prot.write_field_end()?;
2820 },
2821 LogicalType::TIME(ref f) => {
2822 written += o_prot.write_field_begin(&TFieldIdentifier::new("TIME", TType::Struct, 7))?;
2823 written += f.write_to_out_protocol(o_prot)?;
2824 written += o_prot.write_field_end()?;
2825 },
2826 LogicalType::TIMESTAMP(ref f) => {
2827 written += o_prot.write_field_begin(&TFieldIdentifier::new("TIMESTAMP", TType::Struct, 8))?;
2828 written += f.write_to_out_protocol(o_prot)?;
2829 written += o_prot.write_field_end()?;
2830 },
2831 LogicalType::INTEGER(ref f) => {
2832 written += o_prot.write_field_begin(&TFieldIdentifier::new("INTEGER", TType::Struct, 10))?;
2833 written += f.write_to_out_protocol(o_prot)?;
2834 written += o_prot.write_field_end()?;
2835 },
2836 LogicalType::UNKNOWN(ref f) => {
2837 written += o_prot.write_field_begin(&TFieldIdentifier::new("UNKNOWN", TType::Struct, 11))?;
2838 written += f.write_to_out_protocol(o_prot)?;
2839 written += o_prot.write_field_end()?;
2840 },
2841 LogicalType::JSON(ref f) => {
2842 written += o_prot.write_field_begin(&TFieldIdentifier::new("JSON", TType::Struct, 12))?;
2843 written += f.write_to_out_protocol(o_prot)?;
2844 written += o_prot.write_field_end()?;
2845 },
2846 LogicalType::BSON(ref f) => {
2847 written += o_prot.write_field_begin(&TFieldIdentifier::new("BSON", TType::Struct, 13))?;
2848 written += f.write_to_out_protocol(o_prot)?;
2849 written += o_prot.write_field_end()?;
2850 },
2851 LogicalType::UUID(ref f) => {
2852 written += o_prot.write_field_begin(&TFieldIdentifier::new("UUID", TType::Struct, 14))?;
2853 written += f.write_to_out_protocol(o_prot)?;
2854 written += o_prot.write_field_end()?;
2855 },
2856 }
2857 written += o_prot.write_field_stop()?;
2858 written += o_prot.write_struct_end()?;
2859 Ok(written)
2860 }
2861 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
2862 let struct_ident = TStructIdentifier::new("LogicalType");
2863 let mut written = o_prot.write_struct_begin(&struct_ident).await?;
2864 match *self {
2865 LogicalType::STRING(ref f) => {
2866 written += o_prot.write_field_begin(&TFieldIdentifier::new("STRING", TType::Struct, 1)).await?;
2867 written += f.write_to_out_stream_protocol(o_prot).await?;
2868 written += o_prot.write_field_end()?;
2869 },
2870 LogicalType::MAP(ref f) => {
2871 written += o_prot.write_field_begin(&TFieldIdentifier::new("MAP", TType::Struct, 2)).await?;
2872 written += f.write_to_out_stream_protocol(o_prot).await?;
2873 written += o_prot.write_field_end()?;
2874 },
2875 LogicalType::LIST(ref f) => {
2876 written += o_prot.write_field_begin(&TFieldIdentifier::new("LIST", TType::Struct, 3)).await?;
2877 written += f.write_to_out_stream_protocol(o_prot).await?;
2878 written += o_prot.write_field_end()?;
2879 },
2880 LogicalType::ENUM(ref f) => {
2881 written += o_prot.write_field_begin(&TFieldIdentifier::new("ENUM", TType::Struct, 4)).await?;
2882 written += f.write_to_out_stream_protocol(o_prot).await?;
2883 written += o_prot.write_field_end()?;
2884 },
2885 LogicalType::DECIMAL(ref f) => {
2886 written += o_prot.write_field_begin(&TFieldIdentifier::new("DECIMAL", TType::Struct, 5)).await?;
2887 written += f.write_to_out_stream_protocol(o_prot).await?;
2888 written += o_prot.write_field_end()?;
2889 },
2890 LogicalType::DATE(ref f) => {
2891 written += o_prot.write_field_begin(&TFieldIdentifier::new("DATE", TType::Struct, 6)).await?;
2892 written += f.write_to_out_stream_protocol(o_prot).await?;
2893 written += o_prot.write_field_end()?;
2894 },
2895 LogicalType::TIME(ref f) => {
2896 written += o_prot.write_field_begin(&TFieldIdentifier::new("TIME", TType::Struct, 7)).await?;
2897 written += f.write_to_out_stream_protocol(o_prot).await?;
2898 written += o_prot.write_field_end()?;
2899 },
2900 LogicalType::TIMESTAMP(ref f) => {
2901 written += o_prot.write_field_begin(&TFieldIdentifier::new("TIMESTAMP", TType::Struct, 8)).await?;
2902 written += f.write_to_out_stream_protocol(o_prot).await?;
2903 written += o_prot.write_field_end()?;
2904 },
2905 LogicalType::INTEGER(ref f) => {
2906 written += o_prot.write_field_begin(&TFieldIdentifier::new("INTEGER", TType::Struct, 10)).await?;
2907 written += f.write_to_out_stream_protocol(o_prot).await?;
2908 written += o_prot.write_field_end()?;
2909 },
2910 LogicalType::UNKNOWN(ref f) => {
2911 written += o_prot.write_field_begin(&TFieldIdentifier::new("UNKNOWN", TType::Struct, 11)).await?;
2912 written += f.write_to_out_stream_protocol(o_prot).await?;
2913 written += o_prot.write_field_end()?;
2914 },
2915 LogicalType::JSON(ref f) => {
2916 written += o_prot.write_field_begin(&TFieldIdentifier::new("JSON", TType::Struct, 12)).await?;
2917 written += f.write_to_out_stream_protocol(o_prot).await?;
2918 written += o_prot.write_field_end()?;
2919 },
2920 LogicalType::BSON(ref f) => {
2921 written += o_prot.write_field_begin(&TFieldIdentifier::new("BSON", TType::Struct, 13)).await?;
2922 written += f.write_to_out_stream_protocol(o_prot).await?;
2923 written += o_prot.write_field_end()?;
2924 },
2925 LogicalType::UUID(ref f) => {
2926 written += o_prot.write_field_begin(&TFieldIdentifier::new("UUID", TType::Struct, 14)).await?;
2927 written += f.write_to_out_stream_protocol(o_prot).await?;
2928 written += o_prot.write_field_end()?;
2929 },
2930 }
2931 written += o_prot.write_field_stop().await?;
2932 written += o_prot.write_struct_end()?;
2933 Ok(written)
2934 }
2935}
2936
2937#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2946pub struct SchemaElement {
2947 pub type_: Option<Type>,
2949 pub type_length: Option<i32>,
2954 pub repetition_type: Option<FieldRepetitionType>,
2957 pub name: String,
2959 pub num_children: Option<i32>,
2964 pub converted_type: Option<ConvertedType>,
2969 pub scale: Option<i32>,
2974 pub precision: Option<i32>,
2975 pub field_id: Option<i32>,
2978 pub logical_type: Option<LogicalType>,
2983}
2984
2985impl SchemaElement {
2986 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>> {
2987 SchemaElement {
2988 type_: type_.into(),
2989 type_length: type_length.into(),
2990 repetition_type: repetition_type.into(),
2991 name,
2992 num_children: num_children.into(),
2993 converted_type: converted_type.into(),
2994 scale: scale.into(),
2995 precision: precision.into(),
2996 field_id: field_id.into(),
2997 logical_type: logical_type.into(),
2998 }
2999 }
3000 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<SchemaElement> {
3001 i_prot.read_struct_begin()?;
3002 let mut f_1: Option<Type> = None;
3003 let mut f_2: Option<i32> = None;
3004 let mut f_3: Option<FieldRepetitionType> = None;
3005 let mut f_4: Option<String> = None;
3006 let mut f_5: Option<i32> = None;
3007 let mut f_6: Option<ConvertedType> = None;
3008 let mut f_7: Option<i32> = None;
3009 let mut f_8: Option<i32> = None;
3010 let mut f_9: Option<i32> = None;
3011 let mut f_10: Option<LogicalType> = None;
3012 loop {
3013 let field_ident = i_prot.read_field_begin()?;
3014 if field_ident.field_type == TType::Stop {
3015 break;
3016 }
3017 let field_id = field_id(&field_ident)?;
3018 match field_id {
3019 1 => {
3020 let val = Type::read_from_in_protocol(i_prot)?;
3021 f_1 = Some(val);
3022 },
3023 2 => {
3024 let val = i_prot.read_i32()?;
3025 f_2 = Some(val);
3026 },
3027 3 => {
3028 let val = FieldRepetitionType::read_from_in_protocol(i_prot)?;
3029 f_3 = Some(val);
3030 },
3031 4 => {
3032 let val = i_prot.read_string()?;
3033 f_4 = Some(val);
3034 },
3035 5 => {
3036 let val = i_prot.read_i32()?;
3037 f_5 = Some(val);
3038 },
3039 6 => {
3040 let val = ConvertedType::read_from_in_protocol(i_prot)?;
3041 f_6 = Some(val);
3042 },
3043 7 => {
3044 let val = i_prot.read_i32()?;
3045 f_7 = Some(val);
3046 },
3047 8 => {
3048 let val = i_prot.read_i32()?;
3049 f_8 = Some(val);
3050 },
3051 9 => {
3052 let val = i_prot.read_i32()?;
3053 f_9 = Some(val);
3054 },
3055 10 => {
3056 let val = LogicalType::read_from_in_protocol(i_prot)?;
3057 f_10 = Some(val);
3058 },
3059 _ => {
3060 i_prot.skip(field_ident.field_type)?;
3061 },
3062 };
3063 i_prot.read_field_end()?;
3064 }
3065 i_prot.read_struct_end()?;
3066 verify_required_field_exists("SchemaElement.name", &f_4)?;
3067 let ret = SchemaElement {
3068 type_: f_1,
3069 type_length: f_2,
3070 repetition_type: f_3,
3071 name: f_4.expect("auto-generated code should have checked for presence of required fields"),
3072 num_children: f_5,
3073 converted_type: f_6,
3074 scale: f_7,
3075 precision: f_8,
3076 field_id: f_9,
3077 logical_type: f_10,
3078 };
3079 Ok(ret)
3080 }
3081 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<SchemaElement> {
3082 i_prot.read_struct_begin().await?;
3083 let mut f_1: Option<Type> = None;
3084 let mut f_2: Option<i32> = None;
3085 let mut f_3: Option<FieldRepetitionType> = None;
3086 let mut f_4: Option<String> = None;
3087 let mut f_5: Option<i32> = None;
3088 let mut f_6: Option<ConvertedType> = None;
3089 let mut f_7: Option<i32> = None;
3090 let mut f_8: Option<i32> = None;
3091 let mut f_9: Option<i32> = None;
3092 let mut f_10: Option<LogicalType> = None;
3093 loop {
3094 let field_ident = i_prot.read_field_begin().await?;
3095 if field_ident.field_type == TType::Stop {
3096 break;
3097 }
3098 let field_id = field_id(&field_ident)?;
3099 match field_id {
3100 1 => {
3101 let val = Type::stream_from_in_protocol(i_prot).await?;
3102 f_1 = Some(val);
3103 },
3104 2 => {
3105 let val = i_prot.read_i32().await?;
3106 f_2 = Some(val);
3107 },
3108 3 => {
3109 let val = FieldRepetitionType::stream_from_in_protocol(i_prot).await?;
3110 f_3 = Some(val);
3111 },
3112 4 => {
3113 let val = i_prot.read_string().await?;
3114 f_4 = Some(val);
3115 },
3116 5 => {
3117 let val = i_prot.read_i32().await?;
3118 f_5 = Some(val);
3119 },
3120 6 => {
3121 let val = ConvertedType::stream_from_in_protocol(i_prot).await?;
3122 f_6 = Some(val);
3123 },
3124 7 => {
3125 let val = i_prot.read_i32().await?;
3126 f_7 = Some(val);
3127 },
3128 8 => {
3129 let val = i_prot.read_i32().await?;
3130 f_8 = Some(val);
3131 },
3132 9 => {
3133 let val = i_prot.read_i32().await?;
3134 f_9 = Some(val);
3135 },
3136 10 => {
3137 let val = LogicalType::stream_from_in_protocol(i_prot).await?;
3138 f_10 = Some(val);
3139 },
3140 _ => {
3141 i_prot.skip(field_ident.field_type).await?;
3142 },
3143 };
3144 i_prot.read_field_end().await?;
3145 }
3146 i_prot.read_struct_end().await?;
3147 verify_required_field_exists("SchemaElement.name", &f_4)?;
3148 let ret = SchemaElement {
3149 type_: f_1,
3150 type_length: f_2,
3151 repetition_type: f_3,
3152 name: f_4.expect("auto-generated code should have checked for presence of required fields"),
3153 num_children: f_5,
3154 converted_type: f_6,
3155 scale: f_7,
3156 precision: f_8,
3157 field_id: f_9,
3158 logical_type: f_10,
3159 };
3160 Ok(ret)
3161 }
3162 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
3163 let mut written = 0;
3164 let struct_ident = TStructIdentifier::new("SchemaElement");
3165 written += o_prot.write_struct_begin(&struct_ident)?;
3166 if let Some(ref fld_var) = self.type_ {
3167 written += o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1))?;
3168 written += fld_var.write_to_out_protocol(o_prot)?;
3169 written += o_prot.write_field_end()?;
3170 }
3171 if let Some(fld_var) = self.type_length {
3172 written += o_prot.write_field_begin(&TFieldIdentifier::new("type_length", TType::I32, 2))?;
3173 written += o_prot.write_i32(fld_var)?;
3174 written += o_prot.write_field_end()?;
3175 }
3176 if let Some(ref fld_var) = self.repetition_type {
3177 written += o_prot.write_field_begin(&TFieldIdentifier::new("repetition_type", TType::I32, 3))?;
3178 written += fld_var.write_to_out_protocol(o_prot)?;
3179 written += o_prot.write_field_end()?;
3180 }
3181 written += o_prot.write_field_begin(&TFieldIdentifier::new("name", TType::String, 4))?;
3182 written += o_prot.write_string(&self.name)?;
3183 written += o_prot.write_field_end()?;
3184 if let Some(fld_var) = self.num_children {
3185 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_children", TType::I32, 5))?;
3186 written += o_prot.write_i32(fld_var)?;
3187 written += o_prot.write_field_end()?;
3188 }
3189 if let Some(ref fld_var) = self.converted_type {
3190 written += o_prot.write_field_begin(&TFieldIdentifier::new("converted_type", TType::I32, 6))?;
3191 written += fld_var.write_to_out_protocol(o_prot)?;
3192 written += o_prot.write_field_end()?;
3193 }
3194 if let Some(fld_var) = self.scale {
3195 written += o_prot.write_field_begin(&TFieldIdentifier::new("scale", TType::I32, 7))?;
3196 written += o_prot.write_i32(fld_var)?;
3197 written += o_prot.write_field_end()?;
3198 }
3199 if let Some(fld_var) = self.precision {
3200 written += o_prot.write_field_begin(&TFieldIdentifier::new("precision", TType::I32, 8))?;
3201 written += o_prot.write_i32(fld_var)?;
3202 written += o_prot.write_field_end()?;
3203 }
3204 if let Some(fld_var) = self.field_id {
3205 written += o_prot.write_field_begin(&TFieldIdentifier::new("field_id", TType::I32, 9))?;
3206 written += o_prot.write_i32(fld_var)?;
3207 written += o_prot.write_field_end()?;
3208 }
3209 if let Some(ref fld_var) = self.logical_type {
3210 written += o_prot.write_field_begin(&TFieldIdentifier::new("logicalType", TType::Struct, 10))?;
3211 written += fld_var.write_to_out_protocol(o_prot)?;
3212 written += o_prot.write_field_end()?;
3213 }
3214 written += o_prot.write_field_stop()?;
3215 written += o_prot.write_struct_end()?;
3216 Ok(written)
3217 }
3218 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
3219 let mut written = 0;
3220 let struct_ident = TStructIdentifier::new("SchemaElement");
3221 written += o_prot.write_struct_begin(&struct_ident).await?;
3222 if let Some(ref fld_var) = self.type_ {
3223 written += o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1)).await?;
3224 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
3225 written += o_prot.write_field_end()?;
3226 }
3227 if let Some(fld_var) = self.type_length {
3228 written += o_prot.write_field_begin(&TFieldIdentifier::new("type_length", TType::I32, 2)).await?;
3229 written += o_prot.write_i32(fld_var).await?;
3230 written += o_prot.write_field_end()?;
3231 }
3232 if let Some(ref fld_var) = self.repetition_type {
3233 written += o_prot.write_field_begin(&TFieldIdentifier::new("repetition_type", TType::I32, 3)).await?;
3234 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
3235 written += o_prot.write_field_end()?;
3236 }
3237 written += o_prot.write_field_begin(&TFieldIdentifier::new("name", TType::String, 4)).await?;
3238 written += o_prot.write_string(&self.name).await?;
3239 written += o_prot.write_field_end()?;
3240 if let Some(fld_var) = self.num_children {
3241 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_children", TType::I32, 5)).await?;
3242 written += o_prot.write_i32(fld_var).await?;
3243 written += o_prot.write_field_end()?;
3244 }
3245 if let Some(ref fld_var) = self.converted_type {
3246 written += o_prot.write_field_begin(&TFieldIdentifier::new("converted_type", TType::I32, 6)).await?;
3247 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
3248 written += o_prot.write_field_end()?;
3249 }
3250 if let Some(fld_var) = self.scale {
3251 written += o_prot.write_field_begin(&TFieldIdentifier::new("scale", TType::I32, 7)).await?;
3252 written += o_prot.write_i32(fld_var).await?;
3253 written += o_prot.write_field_end()?;
3254 }
3255 if let Some(fld_var) = self.precision {
3256 written += o_prot.write_field_begin(&TFieldIdentifier::new("precision", TType::I32, 8)).await?;
3257 written += o_prot.write_i32(fld_var).await?;
3258 written += o_prot.write_field_end()?;
3259 }
3260 if let Some(fld_var) = self.field_id {
3261 written += o_prot.write_field_begin(&TFieldIdentifier::new("field_id", TType::I32, 9)).await?;
3262 written += o_prot.write_i32(fld_var).await?;
3263 written += o_prot.write_field_end()?;
3264 }
3265 if let Some(ref fld_var) = self.logical_type {
3266 written += o_prot.write_field_begin(&TFieldIdentifier::new("logicalType", TType::Struct, 10)).await?;
3267 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
3268 written += o_prot.write_field_end()?;
3269 }
3270 written += o_prot.write_field_stop().await?;
3271 written += o_prot.write_struct_end()?;
3272 Ok(written)
3273 }
3274}
3275
3276#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3282pub struct DataPageHeader {
3283 pub num_values: i32,
3285 pub encoding: Encoding,
3287 pub definition_level_encoding: Encoding,
3289 pub repetition_level_encoding: Encoding,
3291 pub statistics: Option<Statistics>,
3293}
3294
3295impl DataPageHeader {
3296 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>> {
3297 DataPageHeader {
3298 num_values,
3299 encoding,
3300 definition_level_encoding,
3301 repetition_level_encoding,
3302 statistics: statistics.into(),
3303 }
3304 }
3305 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<DataPageHeader> {
3306 i_prot.read_struct_begin()?;
3307 let mut f_1: Option<i32> = None;
3308 let mut f_2: Option<Encoding> = None;
3309 let mut f_3: Option<Encoding> = None;
3310 let mut f_4: Option<Encoding> = None;
3311 let mut f_5: Option<Statistics> = None;
3312 loop {
3313 let field_ident = i_prot.read_field_begin()?;
3314 if field_ident.field_type == TType::Stop {
3315 break;
3316 }
3317 let field_id = field_id(&field_ident)?;
3318 match field_id {
3319 1 => {
3320 let val = i_prot.read_i32()?;
3321 f_1 = Some(val);
3322 },
3323 2 => {
3324 let val = Encoding::read_from_in_protocol(i_prot)?;
3325 f_2 = Some(val);
3326 },
3327 3 => {
3328 let val = Encoding::read_from_in_protocol(i_prot)?;
3329 f_3 = Some(val);
3330 },
3331 4 => {
3332 let val = Encoding::read_from_in_protocol(i_prot)?;
3333 f_4 = Some(val);
3334 },
3335 5 => {
3336 let val = Statistics::read_from_in_protocol(i_prot)?;
3337 f_5 = Some(val);
3338 },
3339 _ => {
3340 i_prot.skip(field_ident.field_type)?;
3341 },
3342 };
3343 i_prot.read_field_end()?;
3344 }
3345 i_prot.read_struct_end()?;
3346 verify_required_field_exists("DataPageHeader.num_values", &f_1)?;
3347 verify_required_field_exists("DataPageHeader.encoding", &f_2)?;
3348 verify_required_field_exists("DataPageHeader.definition_level_encoding", &f_3)?;
3349 verify_required_field_exists("DataPageHeader.repetition_level_encoding", &f_4)?;
3350 let ret = DataPageHeader {
3351 num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
3352 encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
3353 definition_level_encoding: f_3.expect("auto-generated code should have checked for presence of required fields"),
3354 repetition_level_encoding: f_4.expect("auto-generated code should have checked for presence of required fields"),
3355 statistics: f_5,
3356 };
3357 Ok(ret)
3358 }
3359 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<DataPageHeader> {
3360 i_prot.read_struct_begin().await?;
3361 let mut f_1: Option<i32> = None;
3362 let mut f_2: Option<Encoding> = None;
3363 let mut f_3: Option<Encoding> = None;
3364 let mut f_4: Option<Encoding> = None;
3365 let mut f_5: Option<Statistics> = None;
3366 loop {
3367 let field_ident = i_prot.read_field_begin().await?;
3368 if field_ident.field_type == TType::Stop {
3369 break;
3370 }
3371 let field_id = field_id(&field_ident)?;
3372 match field_id {
3373 1 => {
3374 let val = i_prot.read_i32().await?;
3375 f_1 = Some(val);
3376 },
3377 2 => {
3378 let val = Encoding::stream_from_in_protocol(i_prot).await?;
3379 f_2 = Some(val);
3380 },
3381 3 => {
3382 let val = Encoding::stream_from_in_protocol(i_prot).await?;
3383 f_3 = Some(val);
3384 },
3385 4 => {
3386 let val = Encoding::stream_from_in_protocol(i_prot).await?;
3387 f_4 = Some(val);
3388 },
3389 5 => {
3390 let val = Statistics::stream_from_in_protocol(i_prot).await?;
3391 f_5 = Some(val);
3392 },
3393 _ => {
3394 i_prot.skip(field_ident.field_type).await?;
3395 },
3396 };
3397 i_prot.read_field_end().await?;
3398 }
3399 i_prot.read_struct_end().await?;
3400 verify_required_field_exists("DataPageHeader.num_values", &f_1)?;
3401 verify_required_field_exists("DataPageHeader.encoding", &f_2)?;
3402 verify_required_field_exists("DataPageHeader.definition_level_encoding", &f_3)?;
3403 verify_required_field_exists("DataPageHeader.repetition_level_encoding", &f_4)?;
3404 let ret = DataPageHeader {
3405 num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
3406 encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
3407 definition_level_encoding: f_3.expect("auto-generated code should have checked for presence of required fields"),
3408 repetition_level_encoding: f_4.expect("auto-generated code should have checked for presence of required fields"),
3409 statistics: f_5,
3410 };
3411 Ok(ret)
3412 }
3413 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
3414 let mut written = 0;
3415 let struct_ident = TStructIdentifier::new("DataPageHeader");
3416 written += o_prot.write_struct_begin(&struct_ident)?;
3417 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1))?;
3418 written += o_prot.write_i32(self.num_values)?;
3419 written += o_prot.write_field_end()?;
3420 written += o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2))?;
3421 written += self.encoding.write_to_out_protocol(o_prot)?;
3422 written += o_prot.write_field_end()?;
3423 written += o_prot.write_field_begin(&TFieldIdentifier::new("definition_level_encoding", TType::I32, 3))?;
3424 written += self.definition_level_encoding.write_to_out_protocol(o_prot)?;
3425 written += o_prot.write_field_end()?;
3426 written += o_prot.write_field_begin(&TFieldIdentifier::new("repetition_level_encoding", TType::I32, 4))?;
3427 written += self.repetition_level_encoding.write_to_out_protocol(o_prot)?;
3428 written += o_prot.write_field_end()?;
3429 if let Some(ref fld_var) = self.statistics {
3430 written += o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 5))?;
3431 written += fld_var.write_to_out_protocol(o_prot)?;
3432 written += o_prot.write_field_end()?;
3433 }
3434 written += o_prot.write_field_stop()?;
3435 written += o_prot.write_struct_end()?;
3436 Ok(written)
3437 }
3438 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
3439 let mut written = 0;
3440 let struct_ident = TStructIdentifier::new("DataPageHeader");
3441 written += o_prot.write_struct_begin(&struct_ident).await?;
3442 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1)).await?;
3443 written += o_prot.write_i32(self.num_values).await?;
3444 written += o_prot.write_field_end()?;
3445 written += o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2)).await?;
3446 written += self.encoding.write_to_out_stream_protocol(o_prot).await?;
3447 written += o_prot.write_field_end()?;
3448 written += o_prot.write_field_begin(&TFieldIdentifier::new("definition_level_encoding", TType::I32, 3)).await?;
3449 written += self.definition_level_encoding.write_to_out_stream_protocol(o_prot).await?;
3450 written += o_prot.write_field_end()?;
3451 written += o_prot.write_field_begin(&TFieldIdentifier::new("repetition_level_encoding", TType::I32, 4)).await?;
3452 written += self.repetition_level_encoding.write_to_out_stream_protocol(o_prot).await?;
3453 written += o_prot.write_field_end()?;
3454 if let Some(ref fld_var) = self.statistics {
3455 written += o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 5)).await?;
3456 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
3457 written += o_prot.write_field_end()?;
3458 }
3459 written += o_prot.write_field_stop().await?;
3460 written += o_prot.write_struct_end()?;
3461 Ok(written)
3462 }
3463}
3464
3465#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3470pub struct IndexPageHeader {
3471}
3472
3473impl IndexPageHeader {
3474 pub fn new() -> IndexPageHeader {
3475 IndexPageHeader {}
3476 }
3477 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<IndexPageHeader> {
3478 i_prot.read_struct_begin()?;
3479 loop {
3480 let field_ident = i_prot.read_field_begin()?;
3481 if field_ident.field_type == TType::Stop {
3482 break;
3483 }
3484 let field_id = field_id(&field_ident)?;
3485 match field_id {
3486 _ => {
3487 i_prot.skip(field_ident.field_type)?;
3488 },
3489 };
3490 i_prot.read_field_end()?;
3491 }
3492 i_prot.read_struct_end()?;
3493 let ret = IndexPageHeader {};
3494 Ok(ret)
3495 }
3496 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<IndexPageHeader> {
3497 i_prot.read_struct_begin().await?;
3498 loop {
3499 let field_ident = i_prot.read_field_begin().await?;
3500 if field_ident.field_type == TType::Stop {
3501 break;
3502 }
3503 let field_id = field_id(&field_ident)?;
3504 match field_id {
3505 _ => {
3506 i_prot.skip(field_ident.field_type).await?;
3507 },
3508 };
3509 i_prot.read_field_end().await?;
3510 }
3511 i_prot.read_struct_end().await?;
3512 let ret = IndexPageHeader {};
3513 Ok(ret)
3514 }
3515 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
3516 let mut written = 0;
3517 let struct_ident = TStructIdentifier::new("IndexPageHeader");
3518 written += o_prot.write_struct_begin(&struct_ident)?;
3519 written += o_prot.write_field_stop()?;
3520 written += o_prot.write_struct_end()?;
3521 Ok(written)
3522 }
3523 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
3524 let mut written = 0;
3525 let struct_ident = TStructIdentifier::new("IndexPageHeader");
3526 written += o_prot.write_struct_begin(&struct_ident).await?;
3527 written += o_prot.write_field_stop().await?;
3528 written += o_prot.write_struct_end()?;
3529 Ok(written)
3530 }
3531}
3532
3533impl Default for IndexPageHeader {
3534 fn default() -> Self {
3535 IndexPageHeader{}
3536 }
3537}
3538
3539#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3548pub struct DictionaryPageHeader {
3549 pub num_values: i32,
3551 pub encoding: Encoding,
3553 pub is_sorted: Option<bool>,
3555}
3556
3557impl DictionaryPageHeader {
3558 pub fn new<F3>(num_values: i32, encoding: Encoding, is_sorted: F3) -> DictionaryPageHeader where F3: Into<Option<bool>> {
3559 DictionaryPageHeader {
3560 num_values,
3561 encoding,
3562 is_sorted: is_sorted.into(),
3563 }
3564 }
3565 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<DictionaryPageHeader> {
3566 i_prot.read_struct_begin()?;
3567 let mut f_1: Option<i32> = None;
3568 let mut f_2: Option<Encoding> = None;
3569 let mut f_3: Option<bool> = None;
3570 loop {
3571 let field_ident = i_prot.read_field_begin()?;
3572 if field_ident.field_type == TType::Stop {
3573 break;
3574 }
3575 let field_id = field_id(&field_ident)?;
3576 match field_id {
3577 1 => {
3578 let val = i_prot.read_i32()?;
3579 f_1 = Some(val);
3580 },
3581 2 => {
3582 let val = Encoding::read_from_in_protocol(i_prot)?;
3583 f_2 = Some(val);
3584 },
3585 3 => {
3586 let val = i_prot.read_bool()?;
3587 f_3 = Some(val);
3588 },
3589 _ => {
3590 i_prot.skip(field_ident.field_type)?;
3591 },
3592 };
3593 i_prot.read_field_end()?;
3594 }
3595 i_prot.read_struct_end()?;
3596 verify_required_field_exists("DictionaryPageHeader.num_values", &f_1)?;
3597 verify_required_field_exists("DictionaryPageHeader.encoding", &f_2)?;
3598 let ret = DictionaryPageHeader {
3599 num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
3600 encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
3601 is_sorted: f_3,
3602 };
3603 Ok(ret)
3604 }
3605 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<DictionaryPageHeader> {
3606 i_prot.read_struct_begin().await?;
3607 let mut f_1: Option<i32> = None;
3608 let mut f_2: Option<Encoding> = None;
3609 let mut f_3: Option<bool> = None;
3610 loop {
3611 let field_ident = i_prot.read_field_begin().await?;
3612 if field_ident.field_type == TType::Stop {
3613 break;
3614 }
3615 let field_id = field_id(&field_ident)?;
3616 match field_id {
3617 1 => {
3618 let val = i_prot.read_i32().await?;
3619 f_1 = Some(val);
3620 },
3621 2 => {
3622 let val = Encoding::stream_from_in_protocol(i_prot).await?;
3623 f_2 = Some(val);
3624 },
3625 3 => {
3626 let val = i_prot.read_bool().await?;
3627 f_3 = Some(val);
3628 },
3629 _ => {
3630 i_prot.skip(field_ident.field_type).await?;
3631 },
3632 };
3633 i_prot.read_field_end().await?;
3634 }
3635 i_prot.read_struct_end().await?;
3636 verify_required_field_exists("DictionaryPageHeader.num_values", &f_1)?;
3637 verify_required_field_exists("DictionaryPageHeader.encoding", &f_2)?;
3638 let ret = DictionaryPageHeader {
3639 num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
3640 encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
3641 is_sorted: f_3,
3642 };
3643 Ok(ret)
3644 }
3645 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
3646 let mut written = 0;
3647 let struct_ident = TStructIdentifier::new("DictionaryPageHeader");
3648 written += o_prot.write_struct_begin(&struct_ident)?;
3649 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1))?;
3650 written += o_prot.write_i32(self.num_values)?;
3651 written += o_prot.write_field_end()?;
3652 written += o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2))?;
3653 written += self.encoding.write_to_out_protocol(o_prot)?;
3654 written += o_prot.write_field_end()?;
3655 if let Some(fld_var) = self.is_sorted {
3656 written += o_prot.write_field_begin(&TFieldIdentifier::new("is_sorted", TType::Bool, 3))?;
3657 written += o_prot.write_bool(fld_var)?;
3658 written += o_prot.write_field_end()?;
3659 }
3660 written += o_prot.write_field_stop()?;
3661 written += o_prot.write_struct_end()?;
3662 Ok(written)
3663 }
3664 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
3665 let mut written = 0;
3666 let struct_ident = TStructIdentifier::new("DictionaryPageHeader");
3667 written += o_prot.write_struct_begin(&struct_ident).await?;
3668 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1)).await?;
3669 written += o_prot.write_i32(self.num_values).await?;
3670 written += o_prot.write_field_end()?;
3671 written += o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2)).await?;
3672 written += self.encoding.write_to_out_stream_protocol(o_prot).await?;
3673 written += o_prot.write_field_end()?;
3674 if let Some(fld_var) = self.is_sorted {
3675 written += o_prot.write_field_begin(&TFieldIdentifier::new("is_sorted", TType::Bool, 3)).await?;
3676 written += o_prot.write_bool(fld_var).await?;
3677 written += o_prot.write_field_end()?;
3678 }
3679 written += o_prot.write_field_stop().await?;
3680 written += o_prot.write_struct_end()?;
3681 Ok(written)
3682 }
3683}
3684
3685#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3694pub struct DataPageHeaderV2 {
3695 pub num_values: i32,
3697 pub num_nulls: i32,
3700 pub num_rows: i32,
3702 pub encoding: Encoding,
3704 pub definition_levels_byte_length: i32,
3706 pub repetition_levels_byte_length: i32,
3708 pub is_compressed: Option<bool>,
3714 pub statistics: Option<Statistics>,
3716}
3717
3718impl DataPageHeaderV2 {
3719 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>> {
3720 DataPageHeaderV2 {
3721 num_values,
3722 num_nulls,
3723 num_rows,
3724 encoding,
3725 definition_levels_byte_length,
3726 repetition_levels_byte_length,
3727 is_compressed: is_compressed.into(),
3728 statistics: statistics.into(),
3729 }
3730 }
3731 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<DataPageHeaderV2> {
3732 i_prot.read_struct_begin()?;
3733 let mut f_1: Option<i32> = None;
3734 let mut f_2: Option<i32> = None;
3735 let mut f_3: Option<i32> = None;
3736 let mut f_4: Option<Encoding> = None;
3737 let mut f_5: Option<i32> = None;
3738 let mut f_6: Option<i32> = None;
3739 let mut f_7: Option<bool> = None;
3740 let mut f_8: Option<Statistics> = None;
3741 loop {
3742 let field_ident = i_prot.read_field_begin()?;
3743 if field_ident.field_type == TType::Stop {
3744 break;
3745 }
3746 let field_id = field_id(&field_ident)?;
3747 match field_id {
3748 1 => {
3749 let val = i_prot.read_i32()?;
3750 f_1 = Some(val);
3751 },
3752 2 => {
3753 let val = i_prot.read_i32()?;
3754 f_2 = Some(val);
3755 },
3756 3 => {
3757 let val = i_prot.read_i32()?;
3758 f_3 = Some(val);
3759 },
3760 4 => {
3761 let val = Encoding::read_from_in_protocol(i_prot)?;
3762 f_4 = Some(val);
3763 },
3764 5 => {
3765 let val = i_prot.read_i32()?;
3766 f_5 = Some(val);
3767 },
3768 6 => {
3769 let val = i_prot.read_i32()?;
3770 f_6 = Some(val);
3771 },
3772 7 => {
3773 let val = i_prot.read_bool()?;
3774 f_7 = Some(val);
3775 },
3776 8 => {
3777 let val = Statistics::read_from_in_protocol(i_prot)?;
3778 f_8 = Some(val);
3779 },
3780 _ => {
3781 i_prot.skip(field_ident.field_type)?;
3782 },
3783 };
3784 i_prot.read_field_end()?;
3785 }
3786 i_prot.read_struct_end()?;
3787 verify_required_field_exists("DataPageHeaderV2.num_values", &f_1)?;
3788 verify_required_field_exists("DataPageHeaderV2.num_nulls", &f_2)?;
3789 verify_required_field_exists("DataPageHeaderV2.num_rows", &f_3)?;
3790 verify_required_field_exists("DataPageHeaderV2.encoding", &f_4)?;
3791 verify_required_field_exists("DataPageHeaderV2.definition_levels_byte_length", &f_5)?;
3792 verify_required_field_exists("DataPageHeaderV2.repetition_levels_byte_length", &f_6)?;
3793 let ret = DataPageHeaderV2 {
3794 num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
3795 num_nulls: f_2.expect("auto-generated code should have checked for presence of required fields"),
3796 num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
3797 encoding: f_4.expect("auto-generated code should have checked for presence of required fields"),
3798 definition_levels_byte_length: f_5.expect("auto-generated code should have checked for presence of required fields"),
3799 repetition_levels_byte_length: f_6.expect("auto-generated code should have checked for presence of required fields"),
3800 is_compressed: f_7,
3801 statistics: f_8,
3802 };
3803 Ok(ret)
3804 }
3805 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<DataPageHeaderV2> {
3806 i_prot.read_struct_begin().await?;
3807 let mut f_1: Option<i32> = None;
3808 let mut f_2: Option<i32> = None;
3809 let mut f_3: Option<i32> = None;
3810 let mut f_4: Option<Encoding> = None;
3811 let mut f_5: Option<i32> = None;
3812 let mut f_6: Option<i32> = None;
3813 let mut f_7: Option<bool> = None;
3814 let mut f_8: Option<Statistics> = None;
3815 loop {
3816 let field_ident = i_prot.read_field_begin().await?;
3817 if field_ident.field_type == TType::Stop {
3818 break;
3819 }
3820 let field_id = field_id(&field_ident)?;
3821 match field_id {
3822 1 => {
3823 let val = i_prot.read_i32().await?;
3824 f_1 = Some(val);
3825 },
3826 2 => {
3827 let val = i_prot.read_i32().await?;
3828 f_2 = Some(val);
3829 },
3830 3 => {
3831 let val = i_prot.read_i32().await?;
3832 f_3 = Some(val);
3833 },
3834 4 => {
3835 let val = Encoding::stream_from_in_protocol(i_prot).await?;
3836 f_4 = Some(val);
3837 },
3838 5 => {
3839 let val = i_prot.read_i32().await?;
3840 f_5 = Some(val);
3841 },
3842 6 => {
3843 let val = i_prot.read_i32().await?;
3844 f_6 = Some(val);
3845 },
3846 7 => {
3847 let val = i_prot.read_bool().await?;
3848 f_7 = Some(val);
3849 },
3850 8 => {
3851 let val = Statistics::stream_from_in_protocol(i_prot).await?;
3852 f_8 = Some(val);
3853 },
3854 _ => {
3855 i_prot.skip(field_ident.field_type).await?;
3856 },
3857 };
3858 i_prot.read_field_end().await?;
3859 }
3860 i_prot.read_struct_end().await?;
3861 verify_required_field_exists("DataPageHeaderV2.num_values", &f_1)?;
3862 verify_required_field_exists("DataPageHeaderV2.num_nulls", &f_2)?;
3863 verify_required_field_exists("DataPageHeaderV2.num_rows", &f_3)?;
3864 verify_required_field_exists("DataPageHeaderV2.encoding", &f_4)?;
3865 verify_required_field_exists("DataPageHeaderV2.definition_levels_byte_length", &f_5)?;
3866 verify_required_field_exists("DataPageHeaderV2.repetition_levels_byte_length", &f_6)?;
3867 let ret = DataPageHeaderV2 {
3868 num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
3869 num_nulls: f_2.expect("auto-generated code should have checked for presence of required fields"),
3870 num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
3871 encoding: f_4.expect("auto-generated code should have checked for presence of required fields"),
3872 definition_levels_byte_length: f_5.expect("auto-generated code should have checked for presence of required fields"),
3873 repetition_levels_byte_length: f_6.expect("auto-generated code should have checked for presence of required fields"),
3874 is_compressed: f_7,
3875 statistics: f_8,
3876 };
3877 Ok(ret)
3878 }
3879 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
3880 let mut written = 0;
3881 let struct_ident = TStructIdentifier::new("DataPageHeaderV2");
3882 written += o_prot.write_struct_begin(&struct_ident)?;
3883 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1))?;
3884 written += o_prot.write_i32(self.num_values)?;
3885 written += o_prot.write_field_end()?;
3886 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_nulls", TType::I32, 2))?;
3887 written += o_prot.write_i32(self.num_nulls)?;
3888 written += o_prot.write_field_end()?;
3889 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I32, 3))?;
3890 written += o_prot.write_i32(self.num_rows)?;
3891 written += o_prot.write_field_end()?;
3892 written += o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 4))?;
3893 written += self.encoding.write_to_out_protocol(o_prot)?;
3894 written += o_prot.write_field_end()?;
3895 written += o_prot.write_field_begin(&TFieldIdentifier::new("definition_levels_byte_length", TType::I32, 5))?;
3896 written += o_prot.write_i32(self.definition_levels_byte_length)?;
3897 written += o_prot.write_field_end()?;
3898 written += o_prot.write_field_begin(&TFieldIdentifier::new("repetition_levels_byte_length", TType::I32, 6))?;
3899 written += o_prot.write_i32(self.repetition_levels_byte_length)?;
3900 written += o_prot.write_field_end()?;
3901 if let Some(fld_var) = self.is_compressed {
3902 written += o_prot.write_field_begin(&TFieldIdentifier::new("is_compressed", TType::Bool, 7))?;
3903 written += o_prot.write_bool(fld_var)?;
3904 written += o_prot.write_field_end()?;
3905 }
3906 if let Some(ref fld_var) = self.statistics {
3907 written += o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 8))?;
3908 written += fld_var.write_to_out_protocol(o_prot)?;
3909 written += o_prot.write_field_end()?;
3910 }
3911 written += o_prot.write_field_stop()?;
3912 written += o_prot.write_struct_end()?;
3913 Ok(written)
3914 }
3915 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
3916 let mut written = 0;
3917 let struct_ident = TStructIdentifier::new("DataPageHeaderV2");
3918 written += o_prot.write_struct_begin(&struct_ident).await?;
3919 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1)).await?;
3920 written += o_prot.write_i32(self.num_values).await?;
3921 written += o_prot.write_field_end()?;
3922 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_nulls", TType::I32, 2)).await?;
3923 written += o_prot.write_i32(self.num_nulls).await?;
3924 written += o_prot.write_field_end()?;
3925 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I32, 3)).await?;
3926 written += o_prot.write_i32(self.num_rows).await?;
3927 written += o_prot.write_field_end()?;
3928 written += o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 4)).await?;
3929 written += self.encoding.write_to_out_stream_protocol(o_prot).await?;
3930 written += o_prot.write_field_end()?;
3931 written += o_prot.write_field_begin(&TFieldIdentifier::new("definition_levels_byte_length", TType::I32, 5)).await?;
3932 written += o_prot.write_i32(self.definition_levels_byte_length).await?;
3933 written += o_prot.write_field_end()?;
3934 written += o_prot.write_field_begin(&TFieldIdentifier::new("repetition_levels_byte_length", TType::I32, 6)).await?;
3935 written += o_prot.write_i32(self.repetition_levels_byte_length).await?;
3936 written += o_prot.write_field_end()?;
3937 if let Some(fld_var) = self.is_compressed {
3938 written += o_prot.write_field_begin(&TFieldIdentifier::new("is_compressed", TType::Bool, 7)).await?;
3939 written += o_prot.write_bool(fld_var).await?;
3940 written += o_prot.write_field_end()?;
3941 }
3942 if let Some(ref fld_var) = self.statistics {
3943 written += o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 8)).await?;
3944 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
3945 written += o_prot.write_field_end()?;
3946 }
3947 written += o_prot.write_field_stop().await?;
3948 written += o_prot.write_struct_end()?;
3949 Ok(written)
3950 }
3951}
3952
3953#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3959pub struct SplitBlockAlgorithm {
3960}
3961
3962impl SplitBlockAlgorithm {
3963 pub fn new() -> SplitBlockAlgorithm {
3964 SplitBlockAlgorithm {}
3965 }
3966 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<SplitBlockAlgorithm> {
3967 i_prot.read_struct_begin()?;
3968 loop {
3969 let field_ident = i_prot.read_field_begin()?;
3970 if field_ident.field_type == TType::Stop {
3971 break;
3972 }
3973 let field_id = field_id(&field_ident)?;
3974 match field_id {
3975 _ => {
3976 i_prot.skip(field_ident.field_type)?;
3977 },
3978 };
3979 i_prot.read_field_end()?;
3980 }
3981 i_prot.read_struct_end()?;
3982 let ret = SplitBlockAlgorithm {};
3983 Ok(ret)
3984 }
3985 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<SplitBlockAlgorithm> {
3986 i_prot.read_struct_begin().await?;
3987 loop {
3988 let field_ident = i_prot.read_field_begin().await?;
3989 if field_ident.field_type == TType::Stop {
3990 break;
3991 }
3992 let field_id = field_id(&field_ident)?;
3993 match field_id {
3994 _ => {
3995 i_prot.skip(field_ident.field_type).await?;
3996 },
3997 };
3998 i_prot.read_field_end().await?;
3999 }
4000 i_prot.read_struct_end().await?;
4001 let ret = SplitBlockAlgorithm {};
4002 Ok(ret)
4003 }
4004 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4005 let mut written = 0;
4006 let struct_ident = TStructIdentifier::new("SplitBlockAlgorithm");
4007 written += o_prot.write_struct_begin(&struct_ident)?;
4008 written += o_prot.write_field_stop()?;
4009 written += o_prot.write_struct_end()?;
4010 Ok(written)
4011 }
4012 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4013 let mut written = 0;
4014 let struct_ident = TStructIdentifier::new("SplitBlockAlgorithm");
4015 written += o_prot.write_struct_begin(&struct_ident).await?;
4016 written += o_prot.write_field_stop().await?;
4017 written += o_prot.write_struct_end()?;
4018 Ok(written)
4019 }
4020}
4021
4022impl Default for SplitBlockAlgorithm {
4023 fn default() -> Self {
4024 SplitBlockAlgorithm{}
4025 }
4026}
4027
4028#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4033pub enum BloomFilterAlgorithm {
4034 BLOCK(SplitBlockAlgorithm),
4035}
4036
4037impl BloomFilterAlgorithm {
4038 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterAlgorithm> {
4039 let mut ret: Option<BloomFilterAlgorithm> = None;
4040 let mut received_field_count = 0;
4041 i_prot.read_struct_begin()?;
4042 loop {
4043 let field_ident = i_prot.read_field_begin()?;
4044 if field_ident.field_type == TType::Stop {
4045 break;
4046 }
4047 let field_id = field_id(&field_ident)?;
4048 match field_id {
4049 1 => {
4050 let val = SplitBlockAlgorithm::read_from_in_protocol(i_prot)?;
4051 if ret.is_none() {
4052 ret = Some(BloomFilterAlgorithm::BLOCK(val));
4053 }
4054 received_field_count += 1;
4055 },
4056 _ => {
4057 i_prot.skip(field_ident.field_type)?;
4058 received_field_count += 1;
4059 },
4060 };
4061 i_prot.read_field_end()?;
4062 }
4063 i_prot.read_struct_end()?;
4064 if received_field_count == 0 {
4065 Err(
4066 thrift::Error::Protocol(
4067 ProtocolError::new(
4068 ProtocolErrorKind::InvalidData,
4069 "received empty union from remote BloomFilterAlgorithm"
4070 )
4071 )
4072 )
4073 } else if received_field_count > 1 {
4074 Err(
4075 thrift::Error::Protocol(
4076 ProtocolError::new(
4077 ProtocolErrorKind::InvalidData,
4078 "received multiple fields for union from remote BloomFilterAlgorithm"
4079 )
4080 )
4081 )
4082 } else {
4083 ret.ok_or_else(|| thrift::Error::Protocol(
4084 ProtocolError::new(
4085 ProtocolErrorKind::InvalidData,
4086 "received no field for union from remoteBloomFilterAlgorithm"
4087 )
4088 ))
4089 }
4090 }
4091 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterAlgorithm> {
4092 let mut ret: Option<BloomFilterAlgorithm> = None;
4093 let mut received_field_count = 0;
4094 i_prot.read_struct_begin().await?;
4095 loop {
4096 let field_ident = i_prot.read_field_begin().await?;
4097 if field_ident.field_type == TType::Stop {
4098 break;
4099 }
4100 let field_id = field_id(&field_ident)?;
4101 match field_id {
4102 1 => {
4103 let val = SplitBlockAlgorithm::stream_from_in_protocol(i_prot).await?;
4104 if ret.is_none() {
4105 ret = Some(BloomFilterAlgorithm::BLOCK(val));
4106 }
4107 received_field_count += 1;
4108 },
4109 _ => {
4110 i_prot.skip(field_ident.field_type).await?;
4111 received_field_count += 1;
4112 },
4113 };
4114 i_prot.read_field_end().await?;
4115 }
4116 i_prot.read_struct_end().await?;
4117 if received_field_count == 0 {
4118 Err(
4119 thrift::Error::Protocol(
4120 ProtocolError::new(
4121 ProtocolErrorKind::InvalidData,
4122 "received empty union from remote BloomFilterAlgorithm"
4123 )
4124 )
4125 )
4126 } else if received_field_count > 1 {
4127 Err(
4128 thrift::Error::Protocol(
4129 ProtocolError::new(
4130 ProtocolErrorKind::InvalidData,
4131 "received multiple fields for union from remote BloomFilterAlgorithm"
4132 )
4133 )
4134 )
4135 } else {
4136 ret.ok_or_else(|| thrift::Error::Protocol(
4137 ProtocolError::new(
4138 ProtocolErrorKind::InvalidData,
4139 "received no field for union from remoteBloomFilterAlgorithm"
4140 )
4141 ))
4142 }
4143 }
4144 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4145 let struct_ident = TStructIdentifier::new("BloomFilterAlgorithm");
4146 let mut written = o_prot.write_struct_begin(&struct_ident)?;
4147 match *self {
4148 BloomFilterAlgorithm::BLOCK(ref f) => {
4149 written += o_prot.write_field_begin(&TFieldIdentifier::new("BLOCK", TType::Struct, 1))?;
4150 written += f.write_to_out_protocol(o_prot)?;
4151 written += o_prot.write_field_end()?;
4152 },
4153 }
4154 written += o_prot.write_field_stop()?;
4155 written += o_prot.write_struct_end()?;
4156 Ok(written)
4157 }
4158 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4159 let struct_ident = TStructIdentifier::new("BloomFilterAlgorithm");
4160 let mut written = o_prot.write_struct_begin(&struct_ident).await?;
4161 match *self {
4162 BloomFilterAlgorithm::BLOCK(ref f) => {
4163 written += o_prot.write_field_begin(&TFieldIdentifier::new("BLOCK", TType::Struct, 1)).await?;
4164 written += f.write_to_out_stream_protocol(o_prot).await?;
4165 written += o_prot.write_field_end()?;
4166 },
4167 }
4168 written += o_prot.write_field_stop().await?;
4169 written += o_prot.write_struct_end()?;
4170 Ok(written)
4171 }
4172}
4173
4174#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4182pub struct XxHash {
4183}
4184
4185impl XxHash {
4186 pub fn new() -> XxHash {
4187 XxHash {}
4188 }
4189 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<XxHash> {
4190 i_prot.read_struct_begin()?;
4191 loop {
4192 let field_ident = i_prot.read_field_begin()?;
4193 if field_ident.field_type == TType::Stop {
4194 break;
4195 }
4196 let field_id = field_id(&field_ident)?;
4197 match field_id {
4198 _ => {
4199 i_prot.skip(field_ident.field_type)?;
4200 },
4201 };
4202 i_prot.read_field_end()?;
4203 }
4204 i_prot.read_struct_end()?;
4205 let ret = XxHash {};
4206 Ok(ret)
4207 }
4208 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<XxHash> {
4209 i_prot.read_struct_begin().await?;
4210 loop {
4211 let field_ident = i_prot.read_field_begin().await?;
4212 if field_ident.field_type == TType::Stop {
4213 break;
4214 }
4215 let field_id = field_id(&field_ident)?;
4216 match field_id {
4217 _ => {
4218 i_prot.skip(field_ident.field_type).await?;
4219 },
4220 };
4221 i_prot.read_field_end().await?;
4222 }
4223 i_prot.read_struct_end().await?;
4224 let ret = XxHash {};
4225 Ok(ret)
4226 }
4227 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4228 let mut written = 0;
4229 let struct_ident = TStructIdentifier::new("XxHash");
4230 written += o_prot.write_struct_begin(&struct_ident)?;
4231 written += o_prot.write_field_stop()?;
4232 written += o_prot.write_struct_end()?;
4233 Ok(written)
4234 }
4235 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4236 let mut written = 0;
4237 let struct_ident = TStructIdentifier::new("XxHash");
4238 written += o_prot.write_struct_begin(&struct_ident).await?;
4239 written += o_prot.write_field_stop().await?;
4240 written += o_prot.write_struct_end()?;
4241 Ok(written)
4242 }
4243}
4244
4245impl Default for XxHash {
4246 fn default() -> Self {
4247 XxHash{}
4248 }
4249}
4250
4251#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4256pub enum BloomFilterHash {
4257 XXHASH(XxHash),
4258}
4259
4260impl BloomFilterHash {
4261 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterHash> {
4262 let mut ret: Option<BloomFilterHash> = None;
4263 let mut received_field_count = 0;
4264 i_prot.read_struct_begin()?;
4265 loop {
4266 let field_ident = i_prot.read_field_begin()?;
4267 if field_ident.field_type == TType::Stop {
4268 break;
4269 }
4270 let field_id = field_id(&field_ident)?;
4271 match field_id {
4272 1 => {
4273 let val = XxHash::read_from_in_protocol(i_prot)?;
4274 if ret.is_none() {
4275 ret = Some(BloomFilterHash::XXHASH(val));
4276 }
4277 received_field_count += 1;
4278 },
4279 _ => {
4280 i_prot.skip(field_ident.field_type)?;
4281 received_field_count += 1;
4282 },
4283 };
4284 i_prot.read_field_end()?;
4285 }
4286 i_prot.read_struct_end()?;
4287 if received_field_count == 0 {
4288 Err(
4289 thrift::Error::Protocol(
4290 ProtocolError::new(
4291 ProtocolErrorKind::InvalidData,
4292 "received empty union from remote BloomFilterHash"
4293 )
4294 )
4295 )
4296 } else if received_field_count > 1 {
4297 Err(
4298 thrift::Error::Protocol(
4299 ProtocolError::new(
4300 ProtocolErrorKind::InvalidData,
4301 "received multiple fields for union from remote BloomFilterHash"
4302 )
4303 )
4304 )
4305 } else {
4306 ret.ok_or_else(|| thrift::Error::Protocol(
4307 ProtocolError::new(
4308 ProtocolErrorKind::InvalidData,
4309 "received no field for union from remoteBloomFilterHash"
4310 )
4311 ))
4312 }
4313 }
4314 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterHash> {
4315 let mut ret: Option<BloomFilterHash> = None;
4316 let mut received_field_count = 0;
4317 i_prot.read_struct_begin().await?;
4318 loop {
4319 let field_ident = i_prot.read_field_begin().await?;
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 = XxHash::stream_from_in_protocol(i_prot).await?;
4327 if ret.is_none() {
4328 ret = Some(BloomFilterHash::XXHASH(val));
4329 }
4330 received_field_count += 1;
4331 },
4332 _ => {
4333 i_prot.skip(field_ident.field_type).await?;
4334 received_field_count += 1;
4335 },
4336 };
4337 i_prot.read_field_end().await?;
4338 }
4339 i_prot.read_struct_end().await?;
4340 if received_field_count == 0 {
4341 Err(
4342 thrift::Error::Protocol(
4343 ProtocolError::new(
4344 ProtocolErrorKind::InvalidData,
4345 "received empty union from remote BloomFilterHash"
4346 )
4347 )
4348 )
4349 } else if received_field_count > 1 {
4350 Err(
4351 thrift::Error::Protocol(
4352 ProtocolError::new(
4353 ProtocolErrorKind::InvalidData,
4354 "received multiple fields for union from remote BloomFilterHash"
4355 )
4356 )
4357 )
4358 } else {
4359 ret.ok_or_else(|| thrift::Error::Protocol(
4360 ProtocolError::new(
4361 ProtocolErrorKind::InvalidData,
4362 "received no field for union from remoteBloomFilterHash"
4363 )
4364 ))
4365 }
4366 }
4367 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4368 let struct_ident = TStructIdentifier::new("BloomFilterHash");
4369 let mut written = o_prot.write_struct_begin(&struct_ident)?;
4370 match *self {
4371 BloomFilterHash::XXHASH(ref f) => {
4372 written += o_prot.write_field_begin(&TFieldIdentifier::new("XXHASH", TType::Struct, 1))?;
4373 written += f.write_to_out_protocol(o_prot)?;
4374 written += o_prot.write_field_end()?;
4375 },
4376 }
4377 written += o_prot.write_field_stop()?;
4378 written += o_prot.write_struct_end()?;
4379 Ok(written)
4380 }
4381 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4382 let struct_ident = TStructIdentifier::new("BloomFilterHash");
4383 let mut written = o_prot.write_struct_begin(&struct_ident).await?;
4384 match *self {
4385 BloomFilterHash::XXHASH(ref f) => {
4386 written += o_prot.write_field_begin(&TFieldIdentifier::new("XXHASH", TType::Struct, 1)).await?;
4387 written += f.write_to_out_stream_protocol(o_prot).await?;
4388 written += o_prot.write_field_end()?;
4389 },
4390 }
4391 written += o_prot.write_field_stop().await?;
4392 written += o_prot.write_struct_end()?;
4393 Ok(written)
4394 }
4395}
4396
4397#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4404pub struct Uncompressed {
4405}
4406
4407impl Uncompressed {
4408 pub fn new() -> Uncompressed {
4409 Uncompressed {}
4410 }
4411 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<Uncompressed> {
4412 i_prot.read_struct_begin()?;
4413 loop {
4414 let field_ident = i_prot.read_field_begin()?;
4415 if field_ident.field_type == TType::Stop {
4416 break;
4417 }
4418 let field_id = field_id(&field_ident)?;
4419 match field_id {
4420 _ => {
4421 i_prot.skip(field_ident.field_type)?;
4422 },
4423 };
4424 i_prot.read_field_end()?;
4425 }
4426 i_prot.read_struct_end()?;
4427 let ret = Uncompressed {};
4428 Ok(ret)
4429 }
4430 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<Uncompressed> {
4431 i_prot.read_struct_begin().await?;
4432 loop {
4433 let field_ident = i_prot.read_field_begin().await?;
4434 if field_ident.field_type == TType::Stop {
4435 break;
4436 }
4437 let field_id = field_id(&field_ident)?;
4438 match field_id {
4439 _ => {
4440 i_prot.skip(field_ident.field_type).await?;
4441 },
4442 };
4443 i_prot.read_field_end().await?;
4444 }
4445 i_prot.read_struct_end().await?;
4446 let ret = Uncompressed {};
4447 Ok(ret)
4448 }
4449 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4450 let mut written = 0;
4451 let struct_ident = TStructIdentifier::new("Uncompressed");
4452 written += o_prot.write_struct_begin(&struct_ident)?;
4453 written += o_prot.write_field_stop()?;
4454 written += o_prot.write_struct_end()?;
4455 Ok(written)
4456 }
4457 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4458 let mut written = 0;
4459 let struct_ident = TStructIdentifier::new("Uncompressed");
4460 written += o_prot.write_struct_begin(&struct_ident).await?;
4461 written += o_prot.write_field_stop().await?;
4462 written += o_prot.write_struct_end()?;
4463 Ok(written)
4464 }
4465}
4466
4467impl Default for Uncompressed {
4468 fn default() -> Self {
4469 Uncompressed{}
4470 }
4471}
4472
4473#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4478pub enum BloomFilterCompression {
4479 UNCOMPRESSED(Uncompressed),
4480}
4481
4482impl BloomFilterCompression {
4483 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterCompression> {
4484 let mut ret: Option<BloomFilterCompression> = None;
4485 let mut received_field_count = 0;
4486 i_prot.read_struct_begin()?;
4487 loop {
4488 let field_ident = i_prot.read_field_begin()?;
4489 if field_ident.field_type == TType::Stop {
4490 break;
4491 }
4492 let field_id = field_id(&field_ident)?;
4493 match field_id {
4494 1 => {
4495 let val = Uncompressed::read_from_in_protocol(i_prot)?;
4496 if ret.is_none() {
4497 ret = Some(BloomFilterCompression::UNCOMPRESSED(val));
4498 }
4499 received_field_count += 1;
4500 },
4501 _ => {
4502 i_prot.skip(field_ident.field_type)?;
4503 received_field_count += 1;
4504 },
4505 };
4506 i_prot.read_field_end()?;
4507 }
4508 i_prot.read_struct_end()?;
4509 if received_field_count == 0 {
4510 Err(
4511 thrift::Error::Protocol(
4512 ProtocolError::new(
4513 ProtocolErrorKind::InvalidData,
4514 "received empty union from remote BloomFilterCompression"
4515 )
4516 )
4517 )
4518 } else if received_field_count > 1 {
4519 Err(
4520 thrift::Error::Protocol(
4521 ProtocolError::new(
4522 ProtocolErrorKind::InvalidData,
4523 "received multiple fields for union from remote BloomFilterCompression"
4524 )
4525 )
4526 )
4527 } else {
4528 ret.ok_or_else(|| thrift::Error::Protocol(
4529 ProtocolError::new(
4530 ProtocolErrorKind::InvalidData,
4531 "received no field for union from remoteBloomFilterCompression"
4532 )
4533 ))
4534 }
4535 }
4536 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterCompression> {
4537 let mut ret: Option<BloomFilterCompression> = None;
4538 let mut received_field_count = 0;
4539 i_prot.read_struct_begin().await?;
4540 loop {
4541 let field_ident = i_prot.read_field_begin().await?;
4542 if field_ident.field_type == TType::Stop {
4543 break;
4544 }
4545 let field_id = field_id(&field_ident)?;
4546 match field_id {
4547 1 => {
4548 let val = Uncompressed::stream_from_in_protocol(i_prot).await?;
4549 if ret.is_none() {
4550 ret = Some(BloomFilterCompression::UNCOMPRESSED(val));
4551 }
4552 received_field_count += 1;
4553 },
4554 _ => {
4555 i_prot.skip(field_ident.field_type).await?;
4556 received_field_count += 1;
4557 },
4558 };
4559 i_prot.read_field_end().await?;
4560 }
4561 i_prot.read_struct_end().await?;
4562 if received_field_count == 0 {
4563 Err(
4564 thrift::Error::Protocol(
4565 ProtocolError::new(
4566 ProtocolErrorKind::InvalidData,
4567 "received empty union from remote BloomFilterCompression"
4568 )
4569 )
4570 )
4571 } else if received_field_count > 1 {
4572 Err(
4573 thrift::Error::Protocol(
4574 ProtocolError::new(
4575 ProtocolErrorKind::InvalidData,
4576 "received multiple fields for union from remote BloomFilterCompression"
4577 )
4578 )
4579 )
4580 } else {
4581 ret.ok_or_else(|| thrift::Error::Protocol(
4582 ProtocolError::new(
4583 ProtocolErrorKind::InvalidData,
4584 "received no field for union from remoteBloomFilterCompression"
4585 )
4586 ))
4587 }
4588 }
4589 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4590 let struct_ident = TStructIdentifier::new("BloomFilterCompression");
4591 let mut written = o_prot.write_struct_begin(&struct_ident)?;
4592 match *self {
4593 BloomFilterCompression::UNCOMPRESSED(ref f) => {
4594 written += o_prot.write_field_begin(&TFieldIdentifier::new("UNCOMPRESSED", TType::Struct, 1))?;
4595 written += f.write_to_out_protocol(o_prot)?;
4596 written += o_prot.write_field_end()?;
4597 },
4598 }
4599 written += o_prot.write_field_stop()?;
4600 written += o_prot.write_struct_end()?;
4601 Ok(written)
4602 }
4603 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4604 let struct_ident = TStructIdentifier::new("BloomFilterCompression");
4605 let mut written = o_prot.write_struct_begin(&struct_ident).await?;
4606 match *self {
4607 BloomFilterCompression::UNCOMPRESSED(ref f) => {
4608 written += o_prot.write_field_begin(&TFieldIdentifier::new("UNCOMPRESSED", TType::Struct, 1)).await?;
4609 written += f.write_to_out_stream_protocol(o_prot).await?;
4610 written += o_prot.write_field_end()?;
4611 },
4612 }
4613 written += o_prot.write_field_stop().await?;
4614 written += o_prot.write_struct_end()?;
4615 Ok(written)
4616 }
4617}
4618
4619#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4627pub struct BloomFilterHeader {
4628 pub num_bytes: i32,
4630 pub algorithm: BloomFilterAlgorithm,
4632 pub hash: BloomFilterHash,
4634 pub compression: BloomFilterCompression,
4636}
4637
4638impl BloomFilterHeader {
4639 pub fn new(num_bytes: i32, algorithm: BloomFilterAlgorithm, hash: BloomFilterHash, compression: BloomFilterCompression) -> BloomFilterHeader {
4640 BloomFilterHeader {
4641 num_bytes,
4642 algorithm,
4643 hash,
4644 compression,
4645 }
4646 }
4647 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterHeader> {
4648 i_prot.read_struct_begin()?;
4649 let mut f_1: Option<i32> = None;
4650 let mut f_2: Option<BloomFilterAlgorithm> = None;
4651 let mut f_3: Option<BloomFilterHash> = None;
4652 let mut f_4: Option<BloomFilterCompression> = None;
4653 loop {
4654 let field_ident = i_prot.read_field_begin()?;
4655 if field_ident.field_type == TType::Stop {
4656 break;
4657 }
4658 let field_id = field_id(&field_ident)?;
4659 match field_id {
4660 1 => {
4661 let val = i_prot.read_i32()?;
4662 f_1 = Some(val);
4663 },
4664 2 => {
4665 let val = BloomFilterAlgorithm::read_from_in_protocol(i_prot)?;
4666 f_2 = Some(val);
4667 },
4668 3 => {
4669 let val = BloomFilterHash::read_from_in_protocol(i_prot)?;
4670 f_3 = Some(val);
4671 },
4672 4 => {
4673 let val = BloomFilterCompression::read_from_in_protocol(i_prot)?;
4674 f_4 = Some(val);
4675 },
4676 _ => {
4677 i_prot.skip(field_ident.field_type)?;
4678 },
4679 };
4680 i_prot.read_field_end()?;
4681 }
4682 i_prot.read_struct_end()?;
4683 verify_required_field_exists("BloomFilterHeader.num_bytes", &f_1)?;
4684 verify_required_field_exists("BloomFilterHeader.algorithm", &f_2)?;
4685 verify_required_field_exists("BloomFilterHeader.hash", &f_3)?;
4686 verify_required_field_exists("BloomFilterHeader.compression", &f_4)?;
4687 let ret = BloomFilterHeader {
4688 num_bytes: f_1.expect("auto-generated code should have checked for presence of required fields"),
4689 algorithm: f_2.expect("auto-generated code should have checked for presence of required fields"),
4690 hash: f_3.expect("auto-generated code should have checked for presence of required fields"),
4691 compression: f_4.expect("auto-generated code should have checked for presence of required fields"),
4692 };
4693 Ok(ret)
4694 }
4695 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterHeader> {
4696 i_prot.read_struct_begin().await?;
4697 let mut f_1: Option<i32> = None;
4698 let mut f_2: Option<BloomFilterAlgorithm> = None;
4699 let mut f_3: Option<BloomFilterHash> = None;
4700 let mut f_4: Option<BloomFilterCompression> = None;
4701 loop {
4702 let field_ident = i_prot.read_field_begin().await?;
4703 if field_ident.field_type == TType::Stop {
4704 break;
4705 }
4706 let field_id = field_id(&field_ident)?;
4707 match field_id {
4708 1 => {
4709 let val = i_prot.read_i32().await?;
4710 f_1 = Some(val);
4711 },
4712 2 => {
4713 let val = BloomFilterAlgorithm::stream_from_in_protocol(i_prot).await?;
4714 f_2 = Some(val);
4715 },
4716 3 => {
4717 let val = BloomFilterHash::stream_from_in_protocol(i_prot).await?;
4718 f_3 = Some(val);
4719 },
4720 4 => {
4721 let val = BloomFilterCompression::stream_from_in_protocol(i_prot).await?;
4722 f_4 = Some(val);
4723 },
4724 _ => {
4725 i_prot.skip(field_ident.field_type).await?;
4726 },
4727 };
4728 i_prot.read_field_end().await?;
4729 }
4730 i_prot.read_struct_end().await?;
4731 verify_required_field_exists("BloomFilterHeader.num_bytes", &f_1)?;
4732 verify_required_field_exists("BloomFilterHeader.algorithm", &f_2)?;
4733 verify_required_field_exists("BloomFilterHeader.hash", &f_3)?;
4734 verify_required_field_exists("BloomFilterHeader.compression", &f_4)?;
4735 let ret = BloomFilterHeader {
4736 num_bytes: f_1.expect("auto-generated code should have checked for presence of required fields"),
4737 algorithm: f_2.expect("auto-generated code should have checked for presence of required fields"),
4738 hash: f_3.expect("auto-generated code should have checked for presence of required fields"),
4739 compression: f_4.expect("auto-generated code should have checked for presence of required fields"),
4740 };
4741 Ok(ret)
4742 }
4743 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4744 let mut written = 0;
4745 let struct_ident = TStructIdentifier::new("BloomFilterHeader");
4746 written += o_prot.write_struct_begin(&struct_ident)?;
4747 written += o_prot.write_field_begin(&TFieldIdentifier::new("numBytes", TType::I32, 1))?;
4748 written += o_prot.write_i32(self.num_bytes)?;
4749 written += o_prot.write_field_end()?;
4750 written += o_prot.write_field_begin(&TFieldIdentifier::new("algorithm", TType::Struct, 2))?;
4751 written += self.algorithm.write_to_out_protocol(o_prot)?;
4752 written += o_prot.write_field_end()?;
4753 written += o_prot.write_field_begin(&TFieldIdentifier::new("hash", TType::Struct, 3))?;
4754 written += self.hash.write_to_out_protocol(o_prot)?;
4755 written += o_prot.write_field_end()?;
4756 written += o_prot.write_field_begin(&TFieldIdentifier::new("compression", TType::Struct, 4))?;
4757 written += self.compression.write_to_out_protocol(o_prot)?;
4758 written += o_prot.write_field_end()?;
4759 written += o_prot.write_field_stop()?;
4760 written += o_prot.write_struct_end()?;
4761 Ok(written)
4762 }
4763 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4764 let mut written = 0;
4765 let struct_ident = TStructIdentifier::new("BloomFilterHeader");
4766 written += o_prot.write_struct_begin(&struct_ident).await?;
4767 written += o_prot.write_field_begin(&TFieldIdentifier::new("numBytes", TType::I32, 1)).await?;
4768 written += o_prot.write_i32(self.num_bytes).await?;
4769 written += o_prot.write_field_end()?;
4770 written += o_prot.write_field_begin(&TFieldIdentifier::new("algorithm", TType::Struct, 2)).await?;
4771 written += self.algorithm.write_to_out_stream_protocol(o_prot).await?;
4772 written += o_prot.write_field_end()?;
4773 written += o_prot.write_field_begin(&TFieldIdentifier::new("hash", TType::Struct, 3)).await?;
4774 written += self.hash.write_to_out_stream_protocol(o_prot).await?;
4775 written += o_prot.write_field_end()?;
4776 written += o_prot.write_field_begin(&TFieldIdentifier::new("compression", TType::Struct, 4)).await?;
4777 written += self.compression.write_to_out_stream_protocol(o_prot).await?;
4778 written += o_prot.write_field_end()?;
4779 written += o_prot.write_field_stop().await?;
4780 written += o_prot.write_struct_end()?;
4781 Ok(written)
4782 }
4783}
4784
4785#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4790pub struct PageHeader {
4791 pub type_: PageType,
4793 pub uncompressed_page_size: i32,
4795 pub compressed_page_size: i32,
4797 pub crc: Option<i32>,
4824 pub data_page_header: Option<DataPageHeader>,
4825 pub index_page_header: Option<IndexPageHeader>,
4826 pub dictionary_page_header: Option<DictionaryPageHeader>,
4827 pub data_page_header_v2: Option<DataPageHeaderV2>,
4828}
4829
4830impl PageHeader {
4831 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>> {
4832 PageHeader {
4833 type_,
4834 uncompressed_page_size,
4835 compressed_page_size,
4836 crc: crc.into(),
4837 data_page_header: data_page_header.into(),
4838 index_page_header: index_page_header.into(),
4839 dictionary_page_header: dictionary_page_header.into(),
4840 data_page_header_v2: data_page_header_v2.into(),
4841 }
4842 }
4843 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<PageHeader> {
4844 i_prot.read_struct_begin()?;
4845 let mut f_1: Option<PageType> = None;
4846 let mut f_2: Option<i32> = None;
4847 let mut f_3: Option<i32> = None;
4848 let mut f_4: Option<i32> = None;
4849 let mut f_5: Option<DataPageHeader> = None;
4850 let mut f_6: Option<IndexPageHeader> = None;
4851 let mut f_7: Option<DictionaryPageHeader> = None;
4852 let mut f_8: Option<DataPageHeaderV2> = None;
4853 loop {
4854 let field_ident = i_prot.read_field_begin()?;
4855 if field_ident.field_type == TType::Stop {
4856 break;
4857 }
4858 let field_id = field_id(&field_ident)?;
4859 match field_id {
4860 1 => {
4861 let val = PageType::read_from_in_protocol(i_prot)?;
4862 f_1 = Some(val);
4863 },
4864 2 => {
4865 let val = i_prot.read_i32()?;
4866 f_2 = Some(val);
4867 },
4868 3 => {
4869 let val = i_prot.read_i32()?;
4870 f_3 = Some(val);
4871 },
4872 4 => {
4873 let val = i_prot.read_i32()?;
4874 f_4 = Some(val);
4875 },
4876 5 => {
4877 let val = DataPageHeader::read_from_in_protocol(i_prot)?;
4878 f_5 = Some(val);
4879 },
4880 6 => {
4881 let val = IndexPageHeader::read_from_in_protocol(i_prot)?;
4882 f_6 = Some(val);
4883 },
4884 7 => {
4885 let val = DictionaryPageHeader::read_from_in_protocol(i_prot)?;
4886 f_7 = Some(val);
4887 },
4888 8 => {
4889 let val = DataPageHeaderV2::read_from_in_protocol(i_prot)?;
4890 f_8 = Some(val);
4891 },
4892 _ => {
4893 i_prot.skip(field_ident.field_type)?;
4894 },
4895 };
4896 i_prot.read_field_end()?;
4897 }
4898 i_prot.read_struct_end()?;
4899 verify_required_field_exists("PageHeader.type_", &f_1)?;
4900 verify_required_field_exists("PageHeader.uncompressed_page_size", &f_2)?;
4901 verify_required_field_exists("PageHeader.compressed_page_size", &f_3)?;
4902 let ret = PageHeader {
4903 type_: f_1.expect("auto-generated code should have checked for presence of required fields"),
4904 uncompressed_page_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
4905 compressed_page_size: f_3.expect("auto-generated code should have checked for presence of required fields"),
4906 crc: f_4,
4907 data_page_header: f_5,
4908 index_page_header: f_6,
4909 dictionary_page_header: f_7,
4910 data_page_header_v2: f_8,
4911 };
4912 Ok(ret)
4913 }
4914 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<PageHeader> {
4915 i_prot.read_struct_begin().await?;
4916 let mut f_1: Option<PageType> = None;
4917 let mut f_2: Option<i32> = None;
4918 let mut f_3: Option<i32> = None;
4919 let mut f_4: Option<i32> = None;
4920 let mut f_5: Option<DataPageHeader> = None;
4921 let mut f_6: Option<IndexPageHeader> = None;
4922 let mut f_7: Option<DictionaryPageHeader> = None;
4923 let mut f_8: Option<DataPageHeaderV2> = None;
4924 loop {
4925 let field_ident = i_prot.read_field_begin().await?;
4926 if field_ident.field_type == TType::Stop {
4927 break;
4928 }
4929 let field_id = field_id(&field_ident)?;
4930 match field_id {
4931 1 => {
4932 let val = PageType::stream_from_in_protocol(i_prot).await?;
4933 f_1 = Some(val);
4934 },
4935 2 => {
4936 let val = i_prot.read_i32().await?;
4937 f_2 = Some(val);
4938 },
4939 3 => {
4940 let val = i_prot.read_i32().await?;
4941 f_3 = Some(val);
4942 },
4943 4 => {
4944 let val = i_prot.read_i32().await?;
4945 f_4 = Some(val);
4946 },
4947 5 => {
4948 let val = DataPageHeader::stream_from_in_protocol(i_prot).await?;
4949 f_5 = Some(val);
4950 },
4951 6 => {
4952 let val = IndexPageHeader::stream_from_in_protocol(i_prot).await?;
4953 f_6 = Some(val);
4954 },
4955 7 => {
4956 let val = DictionaryPageHeader::stream_from_in_protocol(i_prot).await?;
4957 f_7 = Some(val);
4958 },
4959 8 => {
4960 let val = DataPageHeaderV2::stream_from_in_protocol(i_prot).await?;
4961 f_8 = Some(val);
4962 },
4963 _ => {
4964 i_prot.skip(field_ident.field_type).await?;
4965 },
4966 };
4967 i_prot.read_field_end().await?;
4968 }
4969 i_prot.read_struct_end().await?;
4970 verify_required_field_exists("PageHeader.type_", &f_1)?;
4971 verify_required_field_exists("PageHeader.uncompressed_page_size", &f_2)?;
4972 verify_required_field_exists("PageHeader.compressed_page_size", &f_3)?;
4973 let ret = PageHeader {
4974 type_: f_1.expect("auto-generated code should have checked for presence of required fields"),
4975 uncompressed_page_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
4976 compressed_page_size: f_3.expect("auto-generated code should have checked for presence of required fields"),
4977 crc: f_4,
4978 data_page_header: f_5,
4979 index_page_header: f_6,
4980 dictionary_page_header: f_7,
4981 data_page_header_v2: f_8,
4982 };
4983 Ok(ret)
4984 }
4985 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
4986 let mut written = 0;
4987 let struct_ident = TStructIdentifier::new("PageHeader");
4988 written += o_prot.write_struct_begin(&struct_ident)?;
4989 written += o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1))?;
4990 written += self.type_.write_to_out_protocol(o_prot)?;
4991 written += o_prot.write_field_end()?;
4992 written += o_prot.write_field_begin(&TFieldIdentifier::new("uncompressed_page_size", TType::I32, 2))?;
4993 written += o_prot.write_i32(self.uncompressed_page_size)?;
4994 written += o_prot.write_field_end()?;
4995 written += o_prot.write_field_begin(&TFieldIdentifier::new("compressed_page_size", TType::I32, 3))?;
4996 written += o_prot.write_i32(self.compressed_page_size)?;
4997 written += o_prot.write_field_end()?;
4998 if let Some(fld_var) = self.crc {
4999 written += o_prot.write_field_begin(&TFieldIdentifier::new("crc", TType::I32, 4))?;
5000 written += o_prot.write_i32(fld_var)?;
5001 written += o_prot.write_field_end()?;
5002 }
5003 if let Some(ref fld_var) = self.data_page_header {
5004 written += o_prot.write_field_begin(&TFieldIdentifier::new("data_page_header", TType::Struct, 5))?;
5005 written += fld_var.write_to_out_protocol(o_prot)?;
5006 written += o_prot.write_field_end()?;
5007 }
5008 if let Some(ref fld_var) = self.index_page_header {
5009 written += o_prot.write_field_begin(&TFieldIdentifier::new("index_page_header", TType::Struct, 6))?;
5010 written += fld_var.write_to_out_protocol(o_prot)?;
5011 written += o_prot.write_field_end()?;
5012 }
5013 if let Some(ref fld_var) = self.dictionary_page_header {
5014 written += o_prot.write_field_begin(&TFieldIdentifier::new("dictionary_page_header", TType::Struct, 7))?;
5015 written += fld_var.write_to_out_protocol(o_prot)?;
5016 written += o_prot.write_field_end()?;
5017 }
5018 if let Some(ref fld_var) = self.data_page_header_v2 {
5019 written += o_prot.write_field_begin(&TFieldIdentifier::new("data_page_header_v2", TType::Struct, 8))?;
5020 written += fld_var.write_to_out_protocol(o_prot)?;
5021 written += o_prot.write_field_end()?;
5022 }
5023 written += o_prot.write_field_stop()?;
5024 written += o_prot.write_struct_end()?;
5025 Ok(written)
5026 }
5027 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
5028 let mut written = 0;
5029 let struct_ident = TStructIdentifier::new("PageHeader");
5030 written += o_prot.write_struct_begin(&struct_ident).await?;
5031 written += o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1)).await?;
5032 written += self.type_.write_to_out_stream_protocol(o_prot).await?;
5033 written += o_prot.write_field_end()?;
5034 written += o_prot.write_field_begin(&TFieldIdentifier::new("uncompressed_page_size", TType::I32, 2)).await?;
5035 written += o_prot.write_i32(self.uncompressed_page_size).await?;
5036 written += o_prot.write_field_end()?;
5037 written += o_prot.write_field_begin(&TFieldIdentifier::new("compressed_page_size", TType::I32, 3)).await?;
5038 written += o_prot.write_i32(self.compressed_page_size).await?;
5039 written += o_prot.write_field_end()?;
5040 if let Some(fld_var) = self.crc {
5041 written += o_prot.write_field_begin(&TFieldIdentifier::new("crc", TType::I32, 4)).await?;
5042 written += o_prot.write_i32(fld_var).await?;
5043 written += o_prot.write_field_end()?;
5044 }
5045 if let Some(ref fld_var) = self.data_page_header {
5046 written += o_prot.write_field_begin(&TFieldIdentifier::new("data_page_header", TType::Struct, 5)).await?;
5047 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
5048 written += o_prot.write_field_end()?;
5049 }
5050 if let Some(ref fld_var) = self.index_page_header {
5051 written += o_prot.write_field_begin(&TFieldIdentifier::new("index_page_header", TType::Struct, 6)).await?;
5052 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
5053 written += o_prot.write_field_end()?;
5054 }
5055 if let Some(ref fld_var) = self.dictionary_page_header {
5056 written += o_prot.write_field_begin(&TFieldIdentifier::new("dictionary_page_header", TType::Struct, 7)).await?;
5057 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
5058 written += o_prot.write_field_end()?;
5059 }
5060 if let Some(ref fld_var) = self.data_page_header_v2 {
5061 written += o_prot.write_field_begin(&TFieldIdentifier::new("data_page_header_v2", TType::Struct, 8)).await?;
5062 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
5063 written += o_prot.write_field_end()?;
5064 }
5065 written += o_prot.write_field_stop().await?;
5066 written += o_prot.write_struct_end()?;
5067 Ok(written)
5068 }
5069}
5070
5071#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5077pub struct KeyValue {
5078 pub key: String,
5079 pub value: Option<String>,
5080}
5081
5082impl KeyValue {
5083 pub fn new<F2>(key: String, value: F2) -> KeyValue where F2: Into<Option<String>> {
5084 KeyValue {
5085 key,
5086 value: value.into(),
5087 }
5088 }
5089 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<KeyValue> {
5090 i_prot.read_struct_begin()?;
5091 let mut f_1: Option<String> = None;
5092 let mut f_2: Option<String> = None;
5093 loop {
5094 let field_ident = i_prot.read_field_begin()?;
5095 if field_ident.field_type == TType::Stop {
5096 break;
5097 }
5098 let field_id = field_id(&field_ident)?;
5099 match field_id {
5100 1 => {
5101 let val = i_prot.read_string()?;
5102 f_1 = Some(val);
5103 },
5104 2 => {
5105 let val = i_prot.read_string()?;
5106 f_2 = Some(val);
5107 },
5108 _ => {
5109 i_prot.skip(field_ident.field_type)?;
5110 },
5111 };
5112 i_prot.read_field_end()?;
5113 }
5114 i_prot.read_struct_end()?;
5115 verify_required_field_exists("KeyValue.key", &f_1)?;
5116 let ret = KeyValue {
5117 key: f_1.expect("auto-generated code should have checked for presence of required fields"),
5118 value: f_2,
5119 };
5120 Ok(ret)
5121 }
5122 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<KeyValue> {
5123 i_prot.read_struct_begin().await?;
5124 let mut f_1: Option<String> = None;
5125 let mut f_2: Option<String> = None;
5126 loop {
5127 let field_ident = i_prot.read_field_begin().await?;
5128 if field_ident.field_type == TType::Stop {
5129 break;
5130 }
5131 let field_id = field_id(&field_ident)?;
5132 match field_id {
5133 1 => {
5134 let val = i_prot.read_string().await?;
5135 f_1 = Some(val);
5136 },
5137 2 => {
5138 let val = i_prot.read_string().await?;
5139 f_2 = Some(val);
5140 },
5141 _ => {
5142 i_prot.skip(field_ident.field_type).await?;
5143 },
5144 };
5145 i_prot.read_field_end().await?;
5146 }
5147 i_prot.read_struct_end().await?;
5148 verify_required_field_exists("KeyValue.key", &f_1)?;
5149 let ret = KeyValue {
5150 key: f_1.expect("auto-generated code should have checked for presence of required fields"),
5151 value: f_2,
5152 };
5153 Ok(ret)
5154 }
5155 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
5156 let mut written = 0;
5157 let struct_ident = TStructIdentifier::new("KeyValue");
5158 written += o_prot.write_struct_begin(&struct_ident)?;
5159 written += o_prot.write_field_begin(&TFieldIdentifier::new("key", TType::String, 1))?;
5160 written += o_prot.write_string(&self.key)?;
5161 written += o_prot.write_field_end()?;
5162 if let Some(ref fld_var) = self.value {
5163 written += o_prot.write_field_begin(&TFieldIdentifier::new("value", TType::String, 2))?;
5164 written += o_prot.write_string(fld_var)?;
5165 written += o_prot.write_field_end()?;
5166 }
5167 written += o_prot.write_field_stop()?;
5168 written += o_prot.write_struct_end()?;
5169 Ok(written)
5170 }
5171 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
5172 let mut written = 0;
5173 let struct_ident = TStructIdentifier::new("KeyValue");
5174 written += o_prot.write_struct_begin(&struct_ident).await?;
5175 written += o_prot.write_field_begin(&TFieldIdentifier::new("key", TType::String, 1)).await?;
5176 written += o_prot.write_string(&self.key).await?;
5177 written += o_prot.write_field_end()?;
5178 if let Some(ref fld_var) = self.value {
5179 written += o_prot.write_field_begin(&TFieldIdentifier::new("value", TType::String, 2)).await?;
5180 written += o_prot.write_string(fld_var).await?;
5181 written += o_prot.write_field_end()?;
5182 }
5183 written += o_prot.write_field_stop().await?;
5184 written += o_prot.write_struct_end()?;
5185 Ok(written)
5186 }
5187}
5188
5189#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5195pub struct SortingColumn {
5196 pub column_idx: i32,
5198 pub descending: bool,
5200 pub nulls_first: bool,
5203}
5204
5205impl SortingColumn {
5206 pub fn new(column_idx: i32, descending: bool, nulls_first: bool) -> SortingColumn {
5207 SortingColumn {
5208 column_idx,
5209 descending,
5210 nulls_first,
5211 }
5212 }
5213 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<SortingColumn> {
5214 i_prot.read_struct_begin()?;
5215 let mut f_1: Option<i32> = None;
5216 let mut f_2: Option<bool> = None;
5217 let mut f_3: Option<bool> = None;
5218 loop {
5219 let field_ident = i_prot.read_field_begin()?;
5220 if field_ident.field_type == TType::Stop {
5221 break;
5222 }
5223 let field_id = field_id(&field_ident)?;
5224 match field_id {
5225 1 => {
5226 let val = i_prot.read_i32()?;
5227 f_1 = Some(val);
5228 },
5229 2 => {
5230 let val = i_prot.read_bool()?;
5231 f_2 = Some(val);
5232 },
5233 3 => {
5234 let val = i_prot.read_bool()?;
5235 f_3 = Some(val);
5236 },
5237 _ => {
5238 i_prot.skip(field_ident.field_type)?;
5239 },
5240 };
5241 i_prot.read_field_end()?;
5242 }
5243 i_prot.read_struct_end()?;
5244 verify_required_field_exists("SortingColumn.column_idx", &f_1)?;
5245 verify_required_field_exists("SortingColumn.descending", &f_2)?;
5246 verify_required_field_exists("SortingColumn.nulls_first", &f_3)?;
5247 let ret = SortingColumn {
5248 column_idx: f_1.expect("auto-generated code should have checked for presence of required fields"),
5249 descending: f_2.expect("auto-generated code should have checked for presence of required fields"),
5250 nulls_first: f_3.expect("auto-generated code should have checked for presence of required fields"),
5251 };
5252 Ok(ret)
5253 }
5254 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<SortingColumn> {
5255 i_prot.read_struct_begin().await?;
5256 let mut f_1: Option<i32> = None;
5257 let mut f_2: Option<bool> = None;
5258 let mut f_3: Option<bool> = None;
5259 loop {
5260 let field_ident = i_prot.read_field_begin().await?;
5261 if field_ident.field_type == TType::Stop {
5262 break;
5263 }
5264 let field_id = field_id(&field_ident)?;
5265 match field_id {
5266 1 => {
5267 let val = i_prot.read_i32().await?;
5268 f_1 = Some(val);
5269 },
5270 2 => {
5271 let val = i_prot.read_bool().await?;
5272 f_2 = Some(val);
5273 },
5274 3 => {
5275 let val = i_prot.read_bool().await?;
5276 f_3 = Some(val);
5277 },
5278 _ => {
5279 i_prot.skip(field_ident.field_type).await?;
5280 },
5281 };
5282 i_prot.read_field_end().await?;
5283 }
5284 i_prot.read_struct_end().await?;
5285 verify_required_field_exists("SortingColumn.column_idx", &f_1)?;
5286 verify_required_field_exists("SortingColumn.descending", &f_2)?;
5287 verify_required_field_exists("SortingColumn.nulls_first", &f_3)?;
5288 let ret = SortingColumn {
5289 column_idx: f_1.expect("auto-generated code should have checked for presence of required fields"),
5290 descending: f_2.expect("auto-generated code should have checked for presence of required fields"),
5291 nulls_first: f_3.expect("auto-generated code should have checked for presence of required fields"),
5292 };
5293 Ok(ret)
5294 }
5295 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
5296 let mut written = 0;
5297 let struct_ident = TStructIdentifier::new("SortingColumn");
5298 written += o_prot.write_struct_begin(&struct_ident)?;
5299 written += o_prot.write_field_begin(&TFieldIdentifier::new("column_idx", TType::I32, 1))?;
5300 written += o_prot.write_i32(self.column_idx)?;
5301 written += o_prot.write_field_end()?;
5302 written += o_prot.write_field_begin(&TFieldIdentifier::new("descending", TType::Bool, 2))?;
5303 written += o_prot.write_bool(self.descending)?;
5304 written += o_prot.write_field_end()?;
5305 written += o_prot.write_field_begin(&TFieldIdentifier::new("nulls_first", TType::Bool, 3))?;
5306 written += o_prot.write_bool(self.nulls_first)?;
5307 written += o_prot.write_field_end()?;
5308 written += o_prot.write_field_stop()?;
5309 written += o_prot.write_struct_end()?;
5310 Ok(written)
5311 }
5312 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
5313 let mut written = 0;
5314 let struct_ident = TStructIdentifier::new("SortingColumn");
5315 written += o_prot.write_struct_begin(&struct_ident).await?;
5316 written += o_prot.write_field_begin(&TFieldIdentifier::new("column_idx", TType::I32, 1)).await?;
5317 written += o_prot.write_i32(self.column_idx).await?;
5318 written += o_prot.write_field_end()?;
5319 written += o_prot.write_field_begin(&TFieldIdentifier::new("descending", TType::Bool, 2)).await?;
5320 written += o_prot.write_bool(self.descending).await?;
5321 written += o_prot.write_field_end()?;
5322 written += o_prot.write_field_begin(&TFieldIdentifier::new("nulls_first", TType::Bool, 3)).await?;
5323 written += o_prot.write_bool(self.nulls_first).await?;
5324 written += o_prot.write_field_end()?;
5325 written += o_prot.write_field_stop().await?;
5326 written += o_prot.write_struct_end()?;
5327 Ok(written)
5328 }
5329}
5330
5331#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5337pub struct PageEncodingStats {
5338 pub page_type: PageType,
5340 pub encoding: Encoding,
5342 pub count: i32,
5344}
5345
5346impl PageEncodingStats {
5347 pub fn new(page_type: PageType, encoding: Encoding, count: i32) -> PageEncodingStats {
5348 PageEncodingStats {
5349 page_type,
5350 encoding,
5351 count,
5352 }
5353 }
5354 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<PageEncodingStats> {
5355 i_prot.read_struct_begin()?;
5356 let mut f_1: Option<PageType> = None;
5357 let mut f_2: Option<Encoding> = None;
5358 let mut f_3: Option<i32> = None;
5359 loop {
5360 let field_ident = i_prot.read_field_begin()?;
5361 if field_ident.field_type == TType::Stop {
5362 break;
5363 }
5364 let field_id = field_id(&field_ident)?;
5365 match field_id {
5366 1 => {
5367 let val = PageType::read_from_in_protocol(i_prot)?;
5368 f_1 = Some(val);
5369 },
5370 2 => {
5371 let val = Encoding::read_from_in_protocol(i_prot)?;
5372 f_2 = Some(val);
5373 },
5374 3 => {
5375 let val = i_prot.read_i32()?;
5376 f_3 = Some(val);
5377 },
5378 _ => {
5379 i_prot.skip(field_ident.field_type)?;
5380 },
5381 };
5382 i_prot.read_field_end()?;
5383 }
5384 i_prot.read_struct_end()?;
5385 verify_required_field_exists("PageEncodingStats.page_type", &f_1)?;
5386 verify_required_field_exists("PageEncodingStats.encoding", &f_2)?;
5387 verify_required_field_exists("PageEncodingStats.count", &f_3)?;
5388 let ret = PageEncodingStats {
5389 page_type: f_1.expect("auto-generated code should have checked for presence of required fields"),
5390 encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
5391 count: f_3.expect("auto-generated code should have checked for presence of required fields"),
5392 };
5393 Ok(ret)
5394 }
5395 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<PageEncodingStats> {
5396 i_prot.read_struct_begin().await?;
5397 let mut f_1: Option<PageType> = None;
5398 let mut f_2: Option<Encoding> = None;
5399 let mut f_3: Option<i32> = None;
5400 loop {
5401 let field_ident = i_prot.read_field_begin().await?;
5402 if field_ident.field_type == TType::Stop {
5403 break;
5404 }
5405 let field_id = field_id(&field_ident)?;
5406 match field_id {
5407 1 => {
5408 let val = PageType::stream_from_in_protocol(i_prot).await?;
5409 f_1 = Some(val);
5410 },
5411 2 => {
5412 let val = Encoding::stream_from_in_protocol(i_prot).await?;
5413 f_2 = Some(val);
5414 },
5415 3 => {
5416 let val = i_prot.read_i32().await?;
5417 f_3 = Some(val);
5418 },
5419 _ => {
5420 i_prot.skip(field_ident.field_type).await?;
5421 },
5422 };
5423 i_prot.read_field_end().await?;
5424 }
5425 i_prot.read_struct_end().await?;
5426 verify_required_field_exists("PageEncodingStats.page_type", &f_1)?;
5427 verify_required_field_exists("PageEncodingStats.encoding", &f_2)?;
5428 verify_required_field_exists("PageEncodingStats.count", &f_3)?;
5429 let ret = PageEncodingStats {
5430 page_type: f_1.expect("auto-generated code should have checked for presence of required fields"),
5431 encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
5432 count: f_3.expect("auto-generated code should have checked for presence of required fields"),
5433 };
5434 Ok(ret)
5435 }
5436 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
5437 let mut written = 0;
5438 let struct_ident = TStructIdentifier::new("PageEncodingStats");
5439 written += o_prot.write_struct_begin(&struct_ident)?;
5440 written += o_prot.write_field_begin(&TFieldIdentifier::new("page_type", TType::I32, 1))?;
5441 written += self.page_type.write_to_out_protocol(o_prot)?;
5442 written += o_prot.write_field_end()?;
5443 written += o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2))?;
5444 written += self.encoding.write_to_out_protocol(o_prot)?;
5445 written += o_prot.write_field_end()?;
5446 written += o_prot.write_field_begin(&TFieldIdentifier::new("count", TType::I32, 3))?;
5447 written += o_prot.write_i32(self.count)?;
5448 written += o_prot.write_field_end()?;
5449 written += o_prot.write_field_stop()?;
5450 written += o_prot.write_struct_end()?;
5451 Ok(written)
5452 }
5453 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
5454 let mut written = 0;
5455 let struct_ident = TStructIdentifier::new("PageEncodingStats");
5456 written += o_prot.write_struct_begin(&struct_ident).await?;
5457 written += o_prot.write_field_begin(&TFieldIdentifier::new("page_type", TType::I32, 1)).await?;
5458 written += self.page_type.write_to_out_stream_protocol(o_prot).await?;
5459 written += o_prot.write_field_end()?;
5460 written += o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2)).await?;
5461 written += self.encoding.write_to_out_stream_protocol(o_prot).await?;
5462 written += o_prot.write_field_end()?;
5463 written += o_prot.write_field_begin(&TFieldIdentifier::new("count", TType::I32, 3)).await?;
5464 written += o_prot.write_i32(self.count).await?;
5465 written += o_prot.write_field_end()?;
5466 written += o_prot.write_field_stop().await?;
5467 written += o_prot.write_struct_end()?;
5468 Ok(written)
5469 }
5470}
5471
5472#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5478pub struct ColumnMetaData {
5479 pub type_: Type,
5481 pub encodings: Vec<Encoding>,
5484 pub path_in_schema: Vec<String>,
5486 pub codec: CompressionCodec,
5488 pub num_values: i64,
5490 pub total_uncompressed_size: i64,
5492 pub total_compressed_size: i64,
5495 pub key_value_metadata: Option<Vec<KeyValue>>,
5497 pub data_page_offset: i64,
5499 pub index_page_offset: Option<i64>,
5501 pub dictionary_page_offset: Option<i64>,
5503 pub statistics: Option<Statistics>,
5505 pub encoding_stats: Option<Vec<PageEncodingStats>>,
5509 pub bloom_filter_offset: Option<i64>,
5511}
5512
5513impl ColumnMetaData {
5514 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>> {
5515 ColumnMetaData {
5516 type_,
5517 encodings,
5518 path_in_schema,
5519 codec,
5520 num_values,
5521 total_uncompressed_size,
5522 total_compressed_size,
5523 key_value_metadata: key_value_metadata.into(),
5524 data_page_offset,
5525 index_page_offset: index_page_offset.into(),
5526 dictionary_page_offset: dictionary_page_offset.into(),
5527 statistics: statistics.into(),
5528 encoding_stats: encoding_stats.into(),
5529 bloom_filter_offset: bloom_filter_offset.into(),
5530 }
5531 }
5532 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ColumnMetaData> {
5533 i_prot.read_struct_begin()?;
5534 let mut f_1: Option<Type> = None;
5535 let mut f_2: Option<Vec<Encoding>> = None;
5536 let mut f_3: Option<Vec<String>> = None;
5537 let mut f_4: Option<CompressionCodec> = None;
5538 let mut f_5: Option<i64> = None;
5539 let mut f_6: Option<i64> = None;
5540 let mut f_7: Option<i64> = None;
5541 let mut f_8: Option<Vec<KeyValue>> = None;
5542 let mut f_9: Option<i64> = None;
5543 let mut f_10: Option<i64> = None;
5544 let mut f_11: Option<i64> = None;
5545 let mut f_12: Option<Statistics> = None;
5546 let mut f_13: Option<Vec<PageEncodingStats>> = None;
5547 let mut f_14: Option<i64> = None;
5548 loop {
5549 let field_ident = i_prot.read_field_begin()?;
5550 if field_ident.field_type == TType::Stop {
5551 break;
5552 }
5553 let field_id = field_id(&field_ident)?;
5554 match field_id {
5555 1 => {
5556 let val = Type::read_from_in_protocol(i_prot)?;
5557 f_1 = Some(val);
5558 },
5559 2 => {
5560 let list_ident = i_prot.read_list_begin()?;
5561 let mut val: Vec<Encoding> = Vec::with_capacity(list_ident.size as usize);
5562 for _ in 0..list_ident.size {
5563 let list_elem_0 = Encoding::read_from_in_protocol(i_prot)?;
5564 val.push(list_elem_0);
5565 }
5566 i_prot.read_list_end()?;
5567 f_2 = Some(val);
5568 },
5569 3 => {
5570 let list_ident = i_prot.read_list_begin()?;
5571 let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
5572 for _ in 0..list_ident.size {
5573 let list_elem_1 = i_prot.read_string()?;
5574 val.push(list_elem_1);
5575 }
5576 i_prot.read_list_end()?;
5577 f_3 = Some(val);
5578 },
5579 4 => {
5580 let val = CompressionCodec::read_from_in_protocol(i_prot)?;
5581 f_4 = Some(val);
5582 },
5583 5 => {
5584 let val = i_prot.read_i64()?;
5585 f_5 = Some(val);
5586 },
5587 6 => {
5588 let val = i_prot.read_i64()?;
5589 f_6 = Some(val);
5590 },
5591 7 => {
5592 let val = i_prot.read_i64()?;
5593 f_7 = Some(val);
5594 },
5595 8 => {
5596 let list_ident = i_prot.read_list_begin()?;
5597 let mut val: Vec<KeyValue> = Vec::with_capacity(list_ident.size as usize);
5598 for _ in 0..list_ident.size {
5599 let list_elem_2 = KeyValue::read_from_in_protocol(i_prot)?;
5600 val.push(list_elem_2);
5601 }
5602 i_prot.read_list_end()?;
5603 f_8 = Some(val);
5604 },
5605 9 => {
5606 let val = i_prot.read_i64()?;
5607 f_9 = Some(val);
5608 },
5609 10 => {
5610 let val = i_prot.read_i64()?;
5611 f_10 = Some(val);
5612 },
5613 11 => {
5614 let val = i_prot.read_i64()?;
5615 f_11 = Some(val);
5616 },
5617 12 => {
5618 let val = Statistics::read_from_in_protocol(i_prot)?;
5619 f_12 = Some(val);
5620 },
5621 13 => {
5622 let list_ident = i_prot.read_list_begin()?;
5623 let mut val: Vec<PageEncodingStats> = Vec::with_capacity(list_ident.size as usize);
5624 for _ in 0..list_ident.size {
5625 let list_elem_3 = PageEncodingStats::read_from_in_protocol(i_prot)?;
5626 val.push(list_elem_3);
5627 }
5628 i_prot.read_list_end()?;
5629 f_13 = Some(val);
5630 },
5631 14 => {
5632 let val = i_prot.read_i64()?;
5633 f_14 = Some(val);
5634 },
5635 _ => {
5636 i_prot.skip(field_ident.field_type)?;
5637 },
5638 };
5639 i_prot.read_field_end()?;
5640 }
5641 i_prot.read_struct_end()?;
5642 verify_required_field_exists("ColumnMetaData.type_", &f_1)?;
5643 verify_required_field_exists("ColumnMetaData.encodings", &f_2)?;
5644 verify_required_field_exists("ColumnMetaData.path_in_schema", &f_3)?;
5645 verify_required_field_exists("ColumnMetaData.codec", &f_4)?;
5646 verify_required_field_exists("ColumnMetaData.num_values", &f_5)?;
5647 verify_required_field_exists("ColumnMetaData.total_uncompressed_size", &f_6)?;
5648 verify_required_field_exists("ColumnMetaData.total_compressed_size", &f_7)?;
5649 verify_required_field_exists("ColumnMetaData.data_page_offset", &f_9)?;
5650 let ret = ColumnMetaData {
5651 type_: f_1.expect("auto-generated code should have checked for presence of required fields"),
5652 encodings: f_2.expect("auto-generated code should have checked for presence of required fields"),
5653 path_in_schema: f_3.expect("auto-generated code should have checked for presence of required fields"),
5654 codec: f_4.expect("auto-generated code should have checked for presence of required fields"),
5655 num_values: f_5.expect("auto-generated code should have checked for presence of required fields"),
5656 total_uncompressed_size: f_6.expect("auto-generated code should have checked for presence of required fields"),
5657 total_compressed_size: f_7.expect("auto-generated code should have checked for presence of required fields"),
5658 key_value_metadata: f_8,
5659 data_page_offset: f_9.expect("auto-generated code should have checked for presence of required fields"),
5660 index_page_offset: f_10,
5661 dictionary_page_offset: f_11,
5662 statistics: f_12,
5663 encoding_stats: f_13,
5664 bloom_filter_offset: f_14,
5665 };
5666 Ok(ret)
5667 }
5668 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<ColumnMetaData> {
5669 i_prot.read_struct_begin().await?;
5670 let mut f_1: Option<Type> = None;
5671 let mut f_2: Option<Vec<Encoding>> = None;
5672 let mut f_3: Option<Vec<String>> = None;
5673 let mut f_4: Option<CompressionCodec> = None;
5674 let mut f_5: Option<i64> = None;
5675 let mut f_6: Option<i64> = None;
5676 let mut f_7: Option<i64> = None;
5677 let mut f_8: Option<Vec<KeyValue>> = None;
5678 let mut f_9: Option<i64> = None;
5679 let mut f_10: Option<i64> = None;
5680 let mut f_11: Option<i64> = None;
5681 let mut f_12: Option<Statistics> = None;
5682 let mut f_13: Option<Vec<PageEncodingStats>> = None;
5683 let mut f_14: Option<i64> = None;
5684 loop {
5685 let field_ident = i_prot.read_field_begin().await?;
5686 if field_ident.field_type == TType::Stop {
5687 break;
5688 }
5689 let field_id = field_id(&field_ident)?;
5690 match field_id {
5691 1 => {
5692 let val = Type::stream_from_in_protocol(i_prot).await?;
5693 f_1 = Some(val);
5694 },
5695 2 => {
5696 let list_ident = i_prot.read_list_begin().await?;
5697 let mut val: Vec<Encoding> = Vec::with_capacity(list_ident.size as usize);
5698 for _ in 0..list_ident.size {
5699 let list_elem_4 = Encoding::stream_from_in_protocol(i_prot).await?;
5700 val.push(list_elem_4);
5701 }
5702 i_prot.read_list_end().await?;
5703 f_2 = Some(val);
5704 },
5705 3 => {
5706 let list_ident = i_prot.read_list_begin().await?;
5707 let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
5708 for _ in 0..list_ident.size {
5709 let list_elem_5 = i_prot.read_string().await?;
5710 val.push(list_elem_5);
5711 }
5712 i_prot.read_list_end().await?;
5713 f_3 = Some(val);
5714 },
5715 4 => {
5716 let val = CompressionCodec::stream_from_in_protocol(i_prot).await?;
5717 f_4 = Some(val);
5718 },
5719 5 => {
5720 let val = i_prot.read_i64().await?;
5721 f_5 = Some(val);
5722 },
5723 6 => {
5724 let val = i_prot.read_i64().await?;
5725 f_6 = Some(val);
5726 },
5727 7 => {
5728 let val = i_prot.read_i64().await?;
5729 f_7 = Some(val);
5730 },
5731 8 => {
5732 let list_ident = i_prot.read_list_begin().await?;
5733 let mut val: Vec<KeyValue> = Vec::with_capacity(list_ident.size as usize);
5734 for _ in 0..list_ident.size {
5735 let list_elem_6 = KeyValue::stream_from_in_protocol(i_prot).await?;
5736 val.push(list_elem_6);
5737 }
5738 i_prot.read_list_end().await?;
5739 f_8 = Some(val);
5740 },
5741 9 => {
5742 let val = i_prot.read_i64().await?;
5743 f_9 = Some(val);
5744 },
5745 10 => {
5746 let val = i_prot.read_i64().await?;
5747 f_10 = Some(val);
5748 },
5749 11 => {
5750 let val = i_prot.read_i64().await?;
5751 f_11 = Some(val);
5752 },
5753 12 => {
5754 let val = Statistics::stream_from_in_protocol(i_prot).await?;
5755 f_12 = Some(val);
5756 },
5757 13 => {
5758 let list_ident = i_prot.read_list_begin().await?;
5759 let mut val: Vec<PageEncodingStats> = Vec::with_capacity(list_ident.size as usize);
5760 for _ in 0..list_ident.size {
5761 let list_elem_7 = PageEncodingStats::stream_from_in_protocol(i_prot).await?;
5762 val.push(list_elem_7);
5763 }
5764 i_prot.read_list_end().await?;
5765 f_13 = Some(val);
5766 },
5767 14 => {
5768 let val = i_prot.read_i64().await?;
5769 f_14 = Some(val);
5770 },
5771 _ => {
5772 i_prot.skip(field_ident.field_type).await?;
5773 },
5774 };
5775 i_prot.read_field_end().await?;
5776 }
5777 i_prot.read_struct_end().await?;
5778 verify_required_field_exists("ColumnMetaData.type_", &f_1)?;
5779 verify_required_field_exists("ColumnMetaData.encodings", &f_2)?;
5780 verify_required_field_exists("ColumnMetaData.path_in_schema", &f_3)?;
5781 verify_required_field_exists("ColumnMetaData.codec", &f_4)?;
5782 verify_required_field_exists("ColumnMetaData.num_values", &f_5)?;
5783 verify_required_field_exists("ColumnMetaData.total_uncompressed_size", &f_6)?;
5784 verify_required_field_exists("ColumnMetaData.total_compressed_size", &f_7)?;
5785 verify_required_field_exists("ColumnMetaData.data_page_offset", &f_9)?;
5786 let ret = ColumnMetaData {
5787 type_: f_1.expect("auto-generated code should have checked for presence of required fields"),
5788 encodings: f_2.expect("auto-generated code should have checked for presence of required fields"),
5789 path_in_schema: f_3.expect("auto-generated code should have checked for presence of required fields"),
5790 codec: f_4.expect("auto-generated code should have checked for presence of required fields"),
5791 num_values: f_5.expect("auto-generated code should have checked for presence of required fields"),
5792 total_uncompressed_size: f_6.expect("auto-generated code should have checked for presence of required fields"),
5793 total_compressed_size: f_7.expect("auto-generated code should have checked for presence of required fields"),
5794 key_value_metadata: f_8,
5795 data_page_offset: f_9.expect("auto-generated code should have checked for presence of required fields"),
5796 index_page_offset: f_10,
5797 dictionary_page_offset: f_11,
5798 statistics: f_12,
5799 encoding_stats: f_13,
5800 bloom_filter_offset: f_14,
5801 };
5802 Ok(ret)
5803 }
5804 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
5805 let mut written = 0;
5806 let struct_ident = TStructIdentifier::new("ColumnMetaData");
5807 written += o_prot.write_struct_begin(&struct_ident)?;
5808 written += o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1))?;
5809 written += self.type_.write_to_out_protocol(o_prot)?;
5810 written += o_prot.write_field_end()?;
5811 written += o_prot.write_field_begin(&TFieldIdentifier::new("encodings", TType::List, 2))?;
5812 written += o_prot.write_list_begin(&TListIdentifier::new(TType::I32, self.encodings.len() as i32))?;
5813 for e in &self.encodings {
5814 written += e.write_to_out_protocol(o_prot)?;
5815 }
5816 written += o_prot.write_list_end()?;
5817 written += o_prot.write_field_end()?;
5818 written += o_prot.write_field_begin(&TFieldIdentifier::new("path_in_schema", TType::List, 3))?;
5819 written += o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.path_in_schema.len() as i32))?;
5820 for e in &self.path_in_schema {
5821 written += o_prot.write_string(e)?;
5822 }
5823 written += o_prot.write_list_end()?;
5824 written += o_prot.write_field_end()?;
5825 written += o_prot.write_field_begin(&TFieldIdentifier::new("codec", TType::I32, 4))?;
5826 written += self.codec.write_to_out_protocol(o_prot)?;
5827 written += o_prot.write_field_end()?;
5828 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I64, 5))?;
5829 written += o_prot.write_i64(self.num_values)?;
5830 written += o_prot.write_field_end()?;
5831 written += o_prot.write_field_begin(&TFieldIdentifier::new("total_uncompressed_size", TType::I64, 6))?;
5832 written += o_prot.write_i64(self.total_uncompressed_size)?;
5833 written += o_prot.write_field_end()?;
5834 written += o_prot.write_field_begin(&TFieldIdentifier::new("total_compressed_size", TType::I64, 7))?;
5835 written += o_prot.write_i64(self.total_compressed_size)?;
5836 written += o_prot.write_field_end()?;
5837 if let Some(ref fld_var) = self.key_value_metadata {
5838 written += o_prot.write_field_begin(&TFieldIdentifier::new("key_value_metadata", TType::List, 8))?;
5839 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
5840 for e in fld_var {
5841 written += e.write_to_out_protocol(o_prot)?;
5842 }
5843 written += o_prot.write_list_end()?;
5844 written += o_prot.write_field_end()?;
5845 }
5846 written += o_prot.write_field_begin(&TFieldIdentifier::new("data_page_offset", TType::I64, 9))?;
5847 written += o_prot.write_i64(self.data_page_offset)?;
5848 written += o_prot.write_field_end()?;
5849 if let Some(fld_var) = self.index_page_offset {
5850 written += o_prot.write_field_begin(&TFieldIdentifier::new("index_page_offset", TType::I64, 10))?;
5851 written += o_prot.write_i64(fld_var)?;
5852 written += o_prot.write_field_end()?;
5853 }
5854 if let Some(fld_var) = self.dictionary_page_offset {
5855 written += o_prot.write_field_begin(&TFieldIdentifier::new("dictionary_page_offset", TType::I64, 11))?;
5856 written += o_prot.write_i64(fld_var)?;
5857 written += o_prot.write_field_end()?;
5858 }
5859 if let Some(ref fld_var) = self.statistics {
5860 written += o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 12))?;
5861 written += fld_var.write_to_out_protocol(o_prot)?;
5862 written += o_prot.write_field_end()?;
5863 }
5864 if let Some(ref fld_var) = self.encoding_stats {
5865 written += o_prot.write_field_begin(&TFieldIdentifier::new("encoding_stats", TType::List, 13))?;
5866 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
5867 for e in fld_var {
5868 written += e.write_to_out_protocol(o_prot)?;
5869 }
5870 written += o_prot.write_list_end()?;
5871 written += o_prot.write_field_end()?;
5872 }
5873 if let Some(fld_var) = self.bloom_filter_offset {
5874 written += o_prot.write_field_begin(&TFieldIdentifier::new("bloom_filter_offset", TType::I64, 14))?;
5875 written += o_prot.write_i64(fld_var)?;
5876 written += o_prot.write_field_end()?;
5877 }
5878 written += o_prot.write_field_stop()?;
5879 written += o_prot.write_struct_end()?;
5880 Ok(written)
5881 }
5882 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
5883 let mut written = 0;
5884 let struct_ident = TStructIdentifier::new("ColumnMetaData");
5885 written += o_prot.write_struct_begin(&struct_ident).await?;
5886 written += o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1)).await?;
5887 written += self.type_.write_to_out_stream_protocol(o_prot).await?;
5888 written += o_prot.write_field_end()?;
5889 written += o_prot.write_field_begin(&TFieldIdentifier::new("encodings", TType::List, 2)).await?;
5890 written += o_prot.write_list_begin(&TListIdentifier::new(TType::I32, self.encodings.len() as i32)).await?;
5891 for e in &self.encodings {
5892 written += e.write_to_out_stream_protocol(o_prot).await?;
5893 }
5894 written += o_prot.write_list_end().await?;
5895 written += o_prot.write_field_end()?;
5896 written += o_prot.write_field_begin(&TFieldIdentifier::new("path_in_schema", TType::List, 3)).await?;
5897 written += o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.path_in_schema.len() as i32)).await?;
5898 for e in &self.path_in_schema {
5899 written += o_prot.write_string(e).await?;
5900 }
5901 written += o_prot.write_list_end().await?;
5902 written += o_prot.write_field_end()?;
5903 written += o_prot.write_field_begin(&TFieldIdentifier::new("codec", TType::I32, 4)).await?;
5904 written += self.codec.write_to_out_stream_protocol(o_prot).await?;
5905 written += o_prot.write_field_end()?;
5906 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I64, 5)).await?;
5907 written += o_prot.write_i64(self.num_values).await?;
5908 written += o_prot.write_field_end()?;
5909 written += o_prot.write_field_begin(&TFieldIdentifier::new("total_uncompressed_size", TType::I64, 6)).await?;
5910 written += o_prot.write_i64(self.total_uncompressed_size).await?;
5911 written += o_prot.write_field_end()?;
5912 written += o_prot.write_field_begin(&TFieldIdentifier::new("total_compressed_size", TType::I64, 7)).await?;
5913 written += o_prot.write_i64(self.total_compressed_size).await?;
5914 written += o_prot.write_field_end()?;
5915 if let Some(ref fld_var) = self.key_value_metadata {
5916 written += o_prot.write_field_begin(&TFieldIdentifier::new("key_value_metadata", TType::List, 8)).await?;
5917 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32)).await?;
5918 for e in fld_var {
5919 written += e.write_to_out_stream_protocol(o_prot).await?;
5920 }
5921 written += o_prot.write_list_end().await?;
5922 written += o_prot.write_field_end()?;
5923 }
5924 written += o_prot.write_field_begin(&TFieldIdentifier::new("data_page_offset", TType::I64, 9)).await?;
5925 written += o_prot.write_i64(self.data_page_offset).await?;
5926 written += o_prot.write_field_end()?;
5927 if let Some(fld_var) = self.index_page_offset {
5928 written += o_prot.write_field_begin(&TFieldIdentifier::new("index_page_offset", TType::I64, 10)).await?;
5929 written += o_prot.write_i64(fld_var).await?;
5930 written += o_prot.write_field_end()?;
5931 }
5932 if let Some(fld_var) = self.dictionary_page_offset {
5933 written += o_prot.write_field_begin(&TFieldIdentifier::new("dictionary_page_offset", TType::I64, 11)).await?;
5934 written += o_prot.write_i64(fld_var).await?;
5935 written += o_prot.write_field_end()?;
5936 }
5937 if let Some(ref fld_var) = self.statistics {
5938 written += o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 12)).await?;
5939 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
5940 written += o_prot.write_field_end()?;
5941 }
5942 if let Some(ref fld_var) = self.encoding_stats {
5943 written += o_prot.write_field_begin(&TFieldIdentifier::new("encoding_stats", TType::List, 13)).await?;
5944 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32)).await?;
5945 for e in fld_var {
5946 written += e.write_to_out_stream_protocol(o_prot).await?;
5947 }
5948 written += o_prot.write_list_end().await?;
5949 written += o_prot.write_field_end()?;
5950 }
5951 if let Some(fld_var) = self.bloom_filter_offset {
5952 written += o_prot.write_field_begin(&TFieldIdentifier::new("bloom_filter_offset", TType::I64, 14)).await?;
5953 written += o_prot.write_i64(fld_var).await?;
5954 written += o_prot.write_field_end()?;
5955 }
5956 written += o_prot.write_field_stop().await?;
5957 written += o_prot.write_struct_end()?;
5958 Ok(written)
5959 }
5960}
5961
5962#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5967pub struct EncryptionWithFooterKey {
5968}
5969
5970impl EncryptionWithFooterKey {
5971 pub fn new() -> EncryptionWithFooterKey {
5972 EncryptionWithFooterKey {}
5973 }
5974 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<EncryptionWithFooterKey> {
5975 i_prot.read_struct_begin()?;
5976 loop {
5977 let field_ident = i_prot.read_field_begin()?;
5978 if field_ident.field_type == TType::Stop {
5979 break;
5980 }
5981 let field_id = field_id(&field_ident)?;
5982 match field_id {
5983 _ => {
5984 i_prot.skip(field_ident.field_type)?;
5985 },
5986 };
5987 i_prot.read_field_end()?;
5988 }
5989 i_prot.read_struct_end()?;
5990 let ret = EncryptionWithFooterKey {};
5991 Ok(ret)
5992 }
5993 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<EncryptionWithFooterKey> {
5994 i_prot.read_struct_begin().await?;
5995 loop {
5996 let field_ident = i_prot.read_field_begin().await?;
5997 if field_ident.field_type == TType::Stop {
5998 break;
5999 }
6000 let field_id = field_id(&field_ident)?;
6001 match field_id {
6002 _ => {
6003 i_prot.skip(field_ident.field_type).await?;
6004 },
6005 };
6006 i_prot.read_field_end().await?;
6007 }
6008 i_prot.read_struct_end().await?;
6009 let ret = EncryptionWithFooterKey {};
6010 Ok(ret)
6011 }
6012 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6013 let mut written = 0;
6014 let struct_ident = TStructIdentifier::new("EncryptionWithFooterKey");
6015 written += o_prot.write_struct_begin(&struct_ident)?;
6016 written += o_prot.write_field_stop()?;
6017 written += o_prot.write_struct_end()?;
6018 Ok(written)
6019 }
6020 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6021 let mut written = 0;
6022 let struct_ident = TStructIdentifier::new("EncryptionWithFooterKey");
6023 written += o_prot.write_struct_begin(&struct_ident).await?;
6024 written += o_prot.write_field_stop().await?;
6025 written += o_prot.write_struct_end()?;
6026 Ok(written)
6027 }
6028}
6029
6030impl Default for EncryptionWithFooterKey {
6031 fn default() -> Self {
6032 EncryptionWithFooterKey{}
6033 }
6034}
6035
6036#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
6041pub struct EncryptionWithColumnKey {
6042 pub path_in_schema: Vec<String>,
6044 pub key_metadata: Option<Vec<u8>>,
6046}
6047
6048impl EncryptionWithColumnKey {
6049 pub fn new<F2>(path_in_schema: Vec<String>, key_metadata: F2) -> EncryptionWithColumnKey where F2: Into<Option<Vec<u8>>> {
6050 EncryptionWithColumnKey {
6051 path_in_schema,
6052 key_metadata: key_metadata.into(),
6053 }
6054 }
6055 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<EncryptionWithColumnKey> {
6056 i_prot.read_struct_begin()?;
6057 let mut f_1: Option<Vec<String>> = None;
6058 let mut f_2: Option<Vec<u8>> = None;
6059 loop {
6060 let field_ident = i_prot.read_field_begin()?;
6061 if field_ident.field_type == TType::Stop {
6062 break;
6063 }
6064 let field_id = field_id(&field_ident)?;
6065 match field_id {
6066 1 => {
6067 let list_ident = i_prot.read_list_begin()?;
6068 let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
6069 for _ in 0..list_ident.size {
6070 let list_elem_8 = i_prot.read_string()?;
6071 val.push(list_elem_8);
6072 }
6073 i_prot.read_list_end()?;
6074 f_1 = Some(val);
6075 },
6076 2 => {
6077 let val = i_prot.read_bytes()?;
6078 f_2 = Some(val);
6079 },
6080 _ => {
6081 i_prot.skip(field_ident.field_type)?;
6082 },
6083 };
6084 i_prot.read_field_end()?;
6085 }
6086 i_prot.read_struct_end()?;
6087 verify_required_field_exists("EncryptionWithColumnKey.path_in_schema", &f_1)?;
6088 let ret = EncryptionWithColumnKey {
6089 path_in_schema: f_1.expect("auto-generated code should have checked for presence of required fields"),
6090 key_metadata: f_2,
6091 };
6092 Ok(ret)
6093 }
6094 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<EncryptionWithColumnKey> {
6095 i_prot.read_struct_begin().await?;
6096 let mut f_1: Option<Vec<String>> = None;
6097 let mut f_2: Option<Vec<u8>> = None;
6098 loop {
6099 let field_ident = i_prot.read_field_begin().await?;
6100 if field_ident.field_type == TType::Stop {
6101 break;
6102 }
6103 let field_id = field_id(&field_ident)?;
6104 match field_id {
6105 1 => {
6106 let list_ident = i_prot.read_list_begin().await?;
6107 let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
6108 for _ in 0..list_ident.size {
6109 let list_elem_9 = i_prot.read_string().await?;
6110 val.push(list_elem_9);
6111 }
6112 i_prot.read_list_end().await?;
6113 f_1 = Some(val);
6114 },
6115 2 => {
6116 let val = i_prot.read_bytes().await?;
6117 f_2 = Some(val);
6118 },
6119 _ => {
6120 i_prot.skip(field_ident.field_type).await?;
6121 },
6122 };
6123 i_prot.read_field_end().await?;
6124 }
6125 i_prot.read_struct_end().await?;
6126 verify_required_field_exists("EncryptionWithColumnKey.path_in_schema", &f_1)?;
6127 let ret = EncryptionWithColumnKey {
6128 path_in_schema: f_1.expect("auto-generated code should have checked for presence of required fields"),
6129 key_metadata: f_2,
6130 };
6131 Ok(ret)
6132 }
6133 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6134 let mut written = 0;
6135 let struct_ident = TStructIdentifier::new("EncryptionWithColumnKey");
6136 written += o_prot.write_struct_begin(&struct_ident)?;
6137 written += o_prot.write_field_begin(&TFieldIdentifier::new("path_in_schema", TType::List, 1))?;
6138 written += o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.path_in_schema.len() as i32))?;
6139 for e in &self.path_in_schema {
6140 written += o_prot.write_string(e)?;
6141 }
6142 written += o_prot.write_list_end()?;
6143 written += o_prot.write_field_end()?;
6144 if let Some(ref fld_var) = self.key_metadata {
6145 written += o_prot.write_field_begin(&TFieldIdentifier::new("key_metadata", TType::String, 2))?;
6146 written += o_prot.write_bytes(fld_var)?;
6147 written += o_prot.write_field_end()?;
6148 }
6149 written += o_prot.write_field_stop()?;
6150 written += o_prot.write_struct_end()?;
6151 Ok(written)
6152 }
6153 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6154 let mut written = 0;
6155 let struct_ident = TStructIdentifier::new("EncryptionWithColumnKey");
6156 written += o_prot.write_struct_begin(&struct_ident).await?;
6157 written += o_prot.write_field_begin(&TFieldIdentifier::new("path_in_schema", TType::List, 1)).await?;
6158 written += o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.path_in_schema.len() as i32)).await?;
6159 for e in &self.path_in_schema {
6160 written += o_prot.write_string(e).await?;
6161 }
6162 written += o_prot.write_list_end().await?;
6163 written += o_prot.write_field_end()?;
6164 if let Some(ref fld_var) = self.key_metadata {
6165 written += o_prot.write_field_begin(&TFieldIdentifier::new("key_metadata", TType::String, 2)).await?;
6166 written += o_prot.write_bytes(fld_var).await?;
6167 written += o_prot.write_field_end()?;
6168 }
6169 written += o_prot.write_field_stop().await?;
6170 written += o_prot.write_struct_end()?;
6171 Ok(written)
6172 }
6173}
6174
6175#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
6180pub enum ColumnCryptoMetaData {
6181 ENCRYPTIONWITHFOOTERKEY(EncryptionWithFooterKey),
6182 ENCRYPTIONWITHCOLUMNKEY(EncryptionWithColumnKey),
6183}
6184
6185impl ColumnCryptoMetaData {
6186 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ColumnCryptoMetaData> {
6187 let mut ret: Option<ColumnCryptoMetaData> = None;
6188 let mut received_field_count = 0;
6189 i_prot.read_struct_begin()?;
6190 loop {
6191 let field_ident = i_prot.read_field_begin()?;
6192 if field_ident.field_type == TType::Stop {
6193 break;
6194 }
6195 let field_id = field_id(&field_ident)?;
6196 match field_id {
6197 1 => {
6198 let val = EncryptionWithFooterKey::read_from_in_protocol(i_prot)?;
6199 if ret.is_none() {
6200 ret = Some(ColumnCryptoMetaData::ENCRYPTIONWITHFOOTERKEY(val));
6201 }
6202 received_field_count += 1;
6203 },
6204 2 => {
6205 let val = EncryptionWithColumnKey::read_from_in_protocol(i_prot)?;
6206 if ret.is_none() {
6207 ret = Some(ColumnCryptoMetaData::ENCRYPTIONWITHCOLUMNKEY(val));
6208 }
6209 received_field_count += 1;
6210 },
6211 _ => {
6212 i_prot.skip(field_ident.field_type)?;
6213 received_field_count += 1;
6214 },
6215 };
6216 i_prot.read_field_end()?;
6217 }
6218 i_prot.read_struct_end()?;
6219 if received_field_count == 0 {
6220 Err(
6221 thrift::Error::Protocol(
6222 ProtocolError::new(
6223 ProtocolErrorKind::InvalidData,
6224 "received empty union from remote ColumnCryptoMetaData"
6225 )
6226 )
6227 )
6228 } else if received_field_count > 1 {
6229 Err(
6230 thrift::Error::Protocol(
6231 ProtocolError::new(
6232 ProtocolErrorKind::InvalidData,
6233 "received multiple fields for union from remote ColumnCryptoMetaData"
6234 )
6235 )
6236 )
6237 } else {
6238 ret.ok_or_else(|| thrift::Error::Protocol(
6239 ProtocolError::new(
6240 ProtocolErrorKind::InvalidData,
6241 "received no field for union from remoteColumnCryptoMetaData"
6242 )
6243 ))
6244 }
6245 }
6246 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<ColumnCryptoMetaData> {
6247 let mut ret: Option<ColumnCryptoMetaData> = None;
6248 let mut received_field_count = 0;
6249 i_prot.read_struct_begin().await?;
6250 loop {
6251 let field_ident = i_prot.read_field_begin().await?;
6252 if field_ident.field_type == TType::Stop {
6253 break;
6254 }
6255 let field_id = field_id(&field_ident)?;
6256 match field_id {
6257 1 => {
6258 let val = EncryptionWithFooterKey::stream_from_in_protocol(i_prot).await?;
6259 if ret.is_none() {
6260 ret = Some(ColumnCryptoMetaData::ENCRYPTIONWITHFOOTERKEY(val));
6261 }
6262 received_field_count += 1;
6263 },
6264 2 => {
6265 let val = EncryptionWithColumnKey::stream_from_in_protocol(i_prot).await?;
6266 if ret.is_none() {
6267 ret = Some(ColumnCryptoMetaData::ENCRYPTIONWITHCOLUMNKEY(val));
6268 }
6269 received_field_count += 1;
6270 },
6271 _ => {
6272 i_prot.skip(field_ident.field_type).await?;
6273 received_field_count += 1;
6274 },
6275 };
6276 i_prot.read_field_end().await?;
6277 }
6278 i_prot.read_struct_end().await?;
6279 if received_field_count == 0 {
6280 Err(
6281 thrift::Error::Protocol(
6282 ProtocolError::new(
6283 ProtocolErrorKind::InvalidData,
6284 "received empty union from remote ColumnCryptoMetaData"
6285 )
6286 )
6287 )
6288 } else if received_field_count > 1 {
6289 Err(
6290 thrift::Error::Protocol(
6291 ProtocolError::new(
6292 ProtocolErrorKind::InvalidData,
6293 "received multiple fields for union from remote ColumnCryptoMetaData"
6294 )
6295 )
6296 )
6297 } else {
6298 ret.ok_or_else(|| thrift::Error::Protocol(
6299 ProtocolError::new(
6300 ProtocolErrorKind::InvalidData,
6301 "received no field for union from remoteColumnCryptoMetaData"
6302 )
6303 ))
6304 }
6305 }
6306 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6307 let struct_ident = TStructIdentifier::new("ColumnCryptoMetaData");
6308 let mut written = o_prot.write_struct_begin(&struct_ident)?;
6309 match *self {
6310 ColumnCryptoMetaData::ENCRYPTIONWITHFOOTERKEY(ref f) => {
6311 written += o_prot.write_field_begin(&TFieldIdentifier::new("ENCRYPTION_WITH_FOOTER_KEY", TType::Struct, 1))?;
6312 written += f.write_to_out_protocol(o_prot)?;
6313 written += o_prot.write_field_end()?;
6314 },
6315 ColumnCryptoMetaData::ENCRYPTIONWITHCOLUMNKEY(ref f) => {
6316 written += o_prot.write_field_begin(&TFieldIdentifier::new("ENCRYPTION_WITH_COLUMN_KEY", TType::Struct, 2))?;
6317 written += f.write_to_out_protocol(o_prot)?;
6318 written += o_prot.write_field_end()?;
6319 },
6320 }
6321 written += o_prot.write_field_stop()?;
6322 written += o_prot.write_struct_end()?;
6323 Ok(written)
6324 }
6325 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6326 let struct_ident = TStructIdentifier::new("ColumnCryptoMetaData");
6327 let mut written = o_prot.write_struct_begin(&struct_ident).await?;
6328 match *self {
6329 ColumnCryptoMetaData::ENCRYPTIONWITHFOOTERKEY(ref f) => {
6330 written += o_prot.write_field_begin(&TFieldIdentifier::new("ENCRYPTION_WITH_FOOTER_KEY", TType::Struct, 1)).await?;
6331 written += f.write_to_out_stream_protocol(o_prot).await?;
6332 written += o_prot.write_field_end()?;
6333 },
6334 ColumnCryptoMetaData::ENCRYPTIONWITHCOLUMNKEY(ref f) => {
6335 written += o_prot.write_field_begin(&TFieldIdentifier::new("ENCRYPTION_WITH_COLUMN_KEY", TType::Struct, 2)).await?;
6336 written += f.write_to_out_stream_protocol(o_prot).await?;
6337 written += o_prot.write_field_end()?;
6338 },
6339 }
6340 written += o_prot.write_field_stop().await?;
6341 written += o_prot.write_struct_end()?;
6342 Ok(written)
6343 }
6344}
6345
6346#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
6351pub struct ColumnChunk {
6352 pub file_path: Option<String>,
6356 pub file_offset: i64,
6358 pub meta_data: Option<ColumnMetaData>,
6363 pub offset_index_offset: Option<i64>,
6365 pub offset_index_length: Option<i32>,
6367 pub column_index_offset: Option<i64>,
6369 pub column_index_length: Option<i32>,
6371 pub crypto_metadata: Option<ColumnCryptoMetaData>,
6373 pub encrypted_column_metadata: Option<Vec<u8>>,
6375}
6376
6377impl ColumnChunk {
6378 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>>> {
6379 ColumnChunk {
6380 file_path: file_path.into(),
6381 file_offset,
6382 meta_data: meta_data.into(),
6383 offset_index_offset: offset_index_offset.into(),
6384 offset_index_length: offset_index_length.into(),
6385 column_index_offset: column_index_offset.into(),
6386 column_index_length: column_index_length.into(),
6387 crypto_metadata: crypto_metadata.into(),
6388 encrypted_column_metadata: encrypted_column_metadata.into(),
6389 }
6390 }
6391 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ColumnChunk> {
6392 i_prot.read_struct_begin()?;
6393 let mut f_1: Option<String> = None;
6394 let mut f_2: Option<i64> = None;
6395 let mut f_3: Option<ColumnMetaData> = None;
6396 let mut f_4: Option<i64> = None;
6397 let mut f_5: Option<i32> = None;
6398 let mut f_6: Option<i64> = None;
6399 let mut f_7: Option<i32> = None;
6400 let mut f_8: Option<ColumnCryptoMetaData> = None;
6401 let mut f_9: Option<Vec<u8>> = None;
6402 loop {
6403 let field_ident = i_prot.read_field_begin()?;
6404 if field_ident.field_type == TType::Stop {
6405 break;
6406 }
6407 let field_id = field_id(&field_ident)?;
6408 match field_id {
6409 1 => {
6410 let val = i_prot.read_string()?;
6411 f_1 = Some(val);
6412 },
6413 2 => {
6414 let val = i_prot.read_i64()?;
6415 f_2 = Some(val);
6416 },
6417 3 => {
6418 let val = ColumnMetaData::read_from_in_protocol(i_prot)?;
6419 f_3 = Some(val);
6420 },
6421 4 => {
6422 let val = i_prot.read_i64()?;
6423 f_4 = Some(val);
6424 },
6425 5 => {
6426 let val = i_prot.read_i32()?;
6427 f_5 = Some(val);
6428 },
6429 6 => {
6430 let val = i_prot.read_i64()?;
6431 f_6 = Some(val);
6432 },
6433 7 => {
6434 let val = i_prot.read_i32()?;
6435 f_7 = Some(val);
6436 },
6437 8 => {
6438 let val = ColumnCryptoMetaData::read_from_in_protocol(i_prot)?;
6439 f_8 = Some(val);
6440 },
6441 9 => {
6442 let val = i_prot.read_bytes()?;
6443 f_9 = Some(val);
6444 },
6445 _ => {
6446 i_prot.skip(field_ident.field_type)?;
6447 },
6448 };
6449 i_prot.read_field_end()?;
6450 }
6451 i_prot.read_struct_end()?;
6452 verify_required_field_exists("ColumnChunk.file_offset", &f_2)?;
6453 let ret = ColumnChunk {
6454 file_path: f_1,
6455 file_offset: f_2.expect("auto-generated code should have checked for presence of required fields"),
6456 meta_data: f_3,
6457 offset_index_offset: f_4,
6458 offset_index_length: f_5,
6459 column_index_offset: f_6,
6460 column_index_length: f_7,
6461 crypto_metadata: f_8,
6462 encrypted_column_metadata: f_9,
6463 };
6464 Ok(ret)
6465 }
6466 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<ColumnChunk> {
6467 i_prot.read_struct_begin().await?;
6468 let mut f_1: Option<String> = None;
6469 let mut f_2: Option<i64> = None;
6470 let mut f_3: Option<ColumnMetaData> = None;
6471 let mut f_4: Option<i64> = None;
6472 let mut f_5: Option<i32> = None;
6473 let mut f_6: Option<i64> = None;
6474 let mut f_7: Option<i32> = None;
6475 let mut f_8: Option<ColumnCryptoMetaData> = None;
6476 let mut f_9: Option<Vec<u8>> = None;
6477 loop {
6478 let field_ident = i_prot.read_field_begin().await?;
6479 if field_ident.field_type == TType::Stop {
6480 break;
6481 }
6482 let field_id = field_id(&field_ident)?;
6483 match field_id {
6484 1 => {
6485 let val = i_prot.read_string().await?;
6486 f_1 = Some(val);
6487 },
6488 2 => {
6489 let val = i_prot.read_i64().await?;
6490 f_2 = Some(val);
6491 },
6492 3 => {
6493 let val = ColumnMetaData::stream_from_in_protocol(i_prot).await?;
6494 f_3 = Some(val);
6495 },
6496 4 => {
6497 let val = i_prot.read_i64().await?;
6498 f_4 = Some(val);
6499 },
6500 5 => {
6501 let val = i_prot.read_i32().await?;
6502 f_5 = Some(val);
6503 },
6504 6 => {
6505 let val = i_prot.read_i64().await?;
6506 f_6 = Some(val);
6507 },
6508 7 => {
6509 let val = i_prot.read_i32().await?;
6510 f_7 = Some(val);
6511 },
6512 8 => {
6513 let val = ColumnCryptoMetaData::stream_from_in_protocol(i_prot).await?;
6514 f_8 = Some(val);
6515 },
6516 9 => {
6517 let val = i_prot.read_bytes().await?;
6518 f_9 = Some(val);
6519 },
6520 _ => {
6521 i_prot.skip(field_ident.field_type).await?;
6522 },
6523 };
6524 i_prot.read_field_end().await?;
6525 }
6526 i_prot.read_struct_end().await?;
6527 verify_required_field_exists("ColumnChunk.file_offset", &f_2)?;
6528 let ret = ColumnChunk {
6529 file_path: f_1,
6530 file_offset: f_2.expect("auto-generated code should have checked for presence of required fields"),
6531 meta_data: f_3,
6532 offset_index_offset: f_4,
6533 offset_index_length: f_5,
6534 column_index_offset: f_6,
6535 column_index_length: f_7,
6536 crypto_metadata: f_8,
6537 encrypted_column_metadata: f_9,
6538 };
6539 Ok(ret)
6540 }
6541 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6542 let mut written = 0;
6543 let struct_ident = TStructIdentifier::new("ColumnChunk");
6544 written += o_prot.write_struct_begin(&struct_ident)?;
6545 if let Some(ref fld_var) = self.file_path {
6546 written += o_prot.write_field_begin(&TFieldIdentifier::new("file_path", TType::String, 1))?;
6547 written += o_prot.write_string(fld_var)?;
6548 written += o_prot.write_field_end()?;
6549 }
6550 written += o_prot.write_field_begin(&TFieldIdentifier::new("file_offset", TType::I64, 2))?;
6551 written += o_prot.write_i64(self.file_offset)?;
6552 written += o_prot.write_field_end()?;
6553 if let Some(ref fld_var) = self.meta_data {
6554 written += o_prot.write_field_begin(&TFieldIdentifier::new("meta_data", TType::Struct, 3))?;
6555 written += fld_var.write_to_out_protocol(o_prot)?;
6556 written += o_prot.write_field_end()?;
6557 }
6558 if let Some(fld_var) = self.offset_index_offset {
6559 written += o_prot.write_field_begin(&TFieldIdentifier::new("offset_index_offset", TType::I64, 4))?;
6560 written += o_prot.write_i64(fld_var)?;
6561 written += o_prot.write_field_end()?;
6562 }
6563 if let Some(fld_var) = self.offset_index_length {
6564 written += o_prot.write_field_begin(&TFieldIdentifier::new("offset_index_length", TType::I32, 5))?;
6565 written += o_prot.write_i32(fld_var)?;
6566 written += o_prot.write_field_end()?;
6567 }
6568 if let Some(fld_var) = self.column_index_offset {
6569 written += o_prot.write_field_begin(&TFieldIdentifier::new("column_index_offset", TType::I64, 6))?;
6570 written += o_prot.write_i64(fld_var)?;
6571 written += o_prot.write_field_end()?;
6572 }
6573 if let Some(fld_var) = self.column_index_length {
6574 written += o_prot.write_field_begin(&TFieldIdentifier::new("column_index_length", TType::I32, 7))?;
6575 written += o_prot.write_i32(fld_var)?;
6576 written += o_prot.write_field_end()?;
6577 }
6578 if let Some(ref fld_var) = self.crypto_metadata {
6579 written += o_prot.write_field_begin(&TFieldIdentifier::new("crypto_metadata", TType::Struct, 8))?;
6580 written += fld_var.write_to_out_protocol(o_prot)?;
6581 written += o_prot.write_field_end()?;
6582 }
6583 if let Some(ref fld_var) = self.encrypted_column_metadata {
6584 written += o_prot.write_field_begin(&TFieldIdentifier::new("encrypted_column_metadata", TType::String, 9))?;
6585 written += o_prot.write_bytes(fld_var)?;
6586 written += o_prot.write_field_end()?;
6587 }
6588 written += o_prot.write_field_stop()?;
6589 written += o_prot.write_struct_end()?;
6590 Ok(written)
6591 }
6592 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6593 let mut written = 0;
6594 let struct_ident = TStructIdentifier::new("ColumnChunk");
6595 written += o_prot.write_struct_begin(&struct_ident).await?;
6596 if let Some(ref fld_var) = self.file_path {
6597 written += o_prot.write_field_begin(&TFieldIdentifier::new("file_path", TType::String, 1)).await?;
6598 written += o_prot.write_string(fld_var).await?;
6599 written += o_prot.write_field_end()?;
6600 }
6601 written += o_prot.write_field_begin(&TFieldIdentifier::new("file_offset", TType::I64, 2)).await?;
6602 written += o_prot.write_i64(self.file_offset).await?;
6603 written += o_prot.write_field_end()?;
6604 if let Some(ref fld_var) = self.meta_data {
6605 written += o_prot.write_field_begin(&TFieldIdentifier::new("meta_data", TType::Struct, 3)).await?;
6606 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
6607 written += o_prot.write_field_end()?;
6608 }
6609 if let Some(fld_var) = self.offset_index_offset {
6610 written += o_prot.write_field_begin(&TFieldIdentifier::new("offset_index_offset", TType::I64, 4)).await?;
6611 written += o_prot.write_i64(fld_var).await?;
6612 written += o_prot.write_field_end()?;
6613 }
6614 if let Some(fld_var) = self.offset_index_length {
6615 written += o_prot.write_field_begin(&TFieldIdentifier::new("offset_index_length", TType::I32, 5)).await?;
6616 written += o_prot.write_i32(fld_var).await?;
6617 written += o_prot.write_field_end()?;
6618 }
6619 if let Some(fld_var) = self.column_index_offset {
6620 written += o_prot.write_field_begin(&TFieldIdentifier::new("column_index_offset", TType::I64, 6)).await?;
6621 written += o_prot.write_i64(fld_var).await?;
6622 written += o_prot.write_field_end()?;
6623 }
6624 if let Some(fld_var) = self.column_index_length {
6625 written += o_prot.write_field_begin(&TFieldIdentifier::new("column_index_length", TType::I32, 7)).await?;
6626 written += o_prot.write_i32(fld_var).await?;
6627 written += o_prot.write_field_end()?;
6628 }
6629 if let Some(ref fld_var) = self.crypto_metadata {
6630 written += o_prot.write_field_begin(&TFieldIdentifier::new("crypto_metadata", TType::Struct, 8)).await?;
6631 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
6632 written += o_prot.write_field_end()?;
6633 }
6634 if let Some(ref fld_var) = self.encrypted_column_metadata {
6635 written += o_prot.write_field_begin(&TFieldIdentifier::new("encrypted_column_metadata", TType::String, 9)).await?;
6636 written += o_prot.write_bytes(fld_var).await?;
6637 written += o_prot.write_field_end()?;
6638 }
6639 written += o_prot.write_field_stop().await?;
6640 written += o_prot.write_struct_end()?;
6641 Ok(written)
6642 }
6643}
6644
6645#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
6650pub struct RowGroup {
6651 pub columns: Vec<ColumnChunk>,
6655 pub total_byte_size: i64,
6657 pub num_rows: i64,
6659 pub sorting_columns: Option<Vec<SortingColumn>>,
6662 pub file_offset: Option<i64>,
6665 pub total_compressed_size: Option<i64>,
6668 pub ordinal: Option<i16>,
6670}
6671
6672impl RowGroup {
6673 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>> {
6674 RowGroup {
6675 columns,
6676 total_byte_size,
6677 num_rows,
6678 sorting_columns: sorting_columns.into(),
6679 file_offset: file_offset.into(),
6680 total_compressed_size: total_compressed_size.into(),
6681 ordinal: ordinal.into(),
6682 }
6683 }
6684 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<RowGroup> {
6685 i_prot.read_struct_begin()?;
6686 let mut f_1: Option<Vec<ColumnChunk>> = None;
6687 let mut f_2: Option<i64> = None;
6688 let mut f_3: Option<i64> = None;
6689 let mut f_4: Option<Vec<SortingColumn>> = None;
6690 let mut f_5: Option<i64> = None;
6691 let mut f_6: Option<i64> = None;
6692 let mut f_7: Option<i16> = None;
6693 loop {
6694 let field_ident = i_prot.read_field_begin()?;
6695 if field_ident.field_type == TType::Stop {
6696 break;
6697 }
6698 let field_id = field_id(&field_ident)?;
6699 match field_id {
6700 1 => {
6701 let list_ident = i_prot.read_list_begin()?;
6702 let mut val: Vec<ColumnChunk> = Vec::with_capacity(list_ident.size as usize);
6703 for _ in 0..list_ident.size {
6704 let list_elem_10 = ColumnChunk::read_from_in_protocol(i_prot)?;
6705 val.push(list_elem_10);
6706 }
6707 i_prot.read_list_end()?;
6708 f_1 = Some(val);
6709 },
6710 2 => {
6711 let val = i_prot.read_i64()?;
6712 f_2 = Some(val);
6713 },
6714 3 => {
6715 let val = i_prot.read_i64()?;
6716 f_3 = Some(val);
6717 },
6718 4 => {
6719 let list_ident = i_prot.read_list_begin()?;
6720 let mut val: Vec<SortingColumn> = Vec::with_capacity(list_ident.size as usize);
6721 for _ in 0..list_ident.size {
6722 let list_elem_11 = SortingColumn::read_from_in_protocol(i_prot)?;
6723 val.push(list_elem_11);
6724 }
6725 i_prot.read_list_end()?;
6726 f_4 = Some(val);
6727 },
6728 5 => {
6729 let val = i_prot.read_i64()?;
6730 f_5 = Some(val);
6731 },
6732 6 => {
6733 let val = i_prot.read_i64()?;
6734 f_6 = Some(val);
6735 },
6736 7 => {
6737 let val = i_prot.read_i16()?;
6738 f_7 = Some(val);
6739 },
6740 _ => {
6741 i_prot.skip(field_ident.field_type)?;
6742 },
6743 };
6744 i_prot.read_field_end()?;
6745 }
6746 i_prot.read_struct_end()?;
6747 verify_required_field_exists("RowGroup.columns", &f_1)?;
6748 verify_required_field_exists("RowGroup.total_byte_size", &f_2)?;
6749 verify_required_field_exists("RowGroup.num_rows", &f_3)?;
6750 let ret = RowGroup {
6751 columns: f_1.expect("auto-generated code should have checked for presence of required fields"),
6752 total_byte_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
6753 num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
6754 sorting_columns: f_4,
6755 file_offset: f_5,
6756 total_compressed_size: f_6,
6757 ordinal: f_7,
6758 };
6759 Ok(ret)
6760 }
6761 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<RowGroup> {
6762 i_prot.read_struct_begin().await?;
6763 let mut f_1: Option<Vec<ColumnChunk>> = None;
6764 let mut f_2: Option<i64> = None;
6765 let mut f_3: Option<i64> = None;
6766 let mut f_4: Option<Vec<SortingColumn>> = None;
6767 let mut f_5: Option<i64> = None;
6768 let mut f_6: Option<i64> = None;
6769 let mut f_7: Option<i16> = None;
6770 loop {
6771 let field_ident = i_prot.read_field_begin().await?;
6772 if field_ident.field_type == TType::Stop {
6773 break;
6774 }
6775 let field_id = field_id(&field_ident)?;
6776 match field_id {
6777 1 => {
6778 let list_ident = i_prot.read_list_begin().await?;
6779 let mut val: Vec<ColumnChunk> = Vec::with_capacity(list_ident.size as usize);
6780 for _ in 0..list_ident.size {
6781 let list_elem_12 = ColumnChunk::stream_from_in_protocol(i_prot).await?;
6782 val.push(list_elem_12);
6783 }
6784 i_prot.read_list_end().await?;
6785 f_1 = Some(val);
6786 },
6787 2 => {
6788 let val = i_prot.read_i64().await?;
6789 f_2 = Some(val);
6790 },
6791 3 => {
6792 let val = i_prot.read_i64().await?;
6793 f_3 = Some(val);
6794 },
6795 4 => {
6796 let list_ident = i_prot.read_list_begin().await?;
6797 let mut val: Vec<SortingColumn> = Vec::with_capacity(list_ident.size as usize);
6798 for _ in 0..list_ident.size {
6799 let list_elem_13 = SortingColumn::stream_from_in_protocol(i_prot).await?;
6800 val.push(list_elem_13);
6801 }
6802 i_prot.read_list_end().await?;
6803 f_4 = Some(val);
6804 },
6805 5 => {
6806 let val = i_prot.read_i64().await?;
6807 f_5 = Some(val);
6808 },
6809 6 => {
6810 let val = i_prot.read_i64().await?;
6811 f_6 = Some(val);
6812 },
6813 7 => {
6814 let val = i_prot.read_i16().await?;
6815 f_7 = Some(val);
6816 },
6817 _ => {
6818 i_prot.skip(field_ident.field_type).await?;
6819 },
6820 };
6821 i_prot.read_field_end().await?;
6822 }
6823 i_prot.read_struct_end().await?;
6824 verify_required_field_exists("RowGroup.columns", &f_1)?;
6825 verify_required_field_exists("RowGroup.total_byte_size", &f_2)?;
6826 verify_required_field_exists("RowGroup.num_rows", &f_3)?;
6827 let ret = RowGroup {
6828 columns: f_1.expect("auto-generated code should have checked for presence of required fields"),
6829 total_byte_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
6830 num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
6831 sorting_columns: f_4,
6832 file_offset: f_5,
6833 total_compressed_size: f_6,
6834 ordinal: f_7,
6835 };
6836 Ok(ret)
6837 }
6838 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6839 let mut written = 0;
6840 let struct_ident = TStructIdentifier::new("RowGroup");
6841 written += o_prot.write_struct_begin(&struct_ident)?;
6842 written += o_prot.write_field_begin(&TFieldIdentifier::new("columns", TType::List, 1))?;
6843 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.columns.len() as i32))?;
6844 for e in &self.columns {
6845 written += e.write_to_out_protocol(o_prot)?;
6846 }
6847 written += o_prot.write_list_end()?;
6848 written += o_prot.write_field_end()?;
6849 written += o_prot.write_field_begin(&TFieldIdentifier::new("total_byte_size", TType::I64, 2))?;
6850 written += o_prot.write_i64(self.total_byte_size)?;
6851 written += o_prot.write_field_end()?;
6852 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I64, 3))?;
6853 written += o_prot.write_i64(self.num_rows)?;
6854 written += o_prot.write_field_end()?;
6855 if let Some(ref fld_var) = self.sorting_columns {
6856 written += o_prot.write_field_begin(&TFieldIdentifier::new("sorting_columns", TType::List, 4))?;
6857 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
6858 for e in fld_var {
6859 written += e.write_to_out_protocol(o_prot)?;
6860 }
6861 written += o_prot.write_list_end()?;
6862 written += o_prot.write_field_end()?;
6863 }
6864 if let Some(fld_var) = self.file_offset {
6865 written += o_prot.write_field_begin(&TFieldIdentifier::new("file_offset", TType::I64, 5))?;
6866 written += o_prot.write_i64(fld_var)?;
6867 written += o_prot.write_field_end()?;
6868 }
6869 if let Some(fld_var) = self.total_compressed_size {
6870 written += o_prot.write_field_begin(&TFieldIdentifier::new("total_compressed_size", TType::I64, 6))?;
6871 written += o_prot.write_i64(fld_var)?;
6872 written += o_prot.write_field_end()?;
6873 }
6874 if let Some(fld_var) = self.ordinal {
6875 written += o_prot.write_field_begin(&TFieldIdentifier::new("ordinal", TType::I16, 7))?;
6876 written += o_prot.write_i16(fld_var)?;
6877 written += o_prot.write_field_end()?;
6878 }
6879 written += o_prot.write_field_stop()?;
6880 written += o_prot.write_struct_end()?;
6881 Ok(written)
6882 }
6883 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6884 let mut written = 0;
6885 let struct_ident = TStructIdentifier::new("RowGroup");
6886 written += o_prot.write_struct_begin(&struct_ident).await?;
6887 written += o_prot.write_field_begin(&TFieldIdentifier::new("columns", TType::List, 1)).await?;
6888 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.columns.len() as i32)).await?;
6889 for e in &self.columns {
6890 written += e.write_to_out_stream_protocol(o_prot).await?;
6891 }
6892 written += o_prot.write_list_end().await?;
6893 written += o_prot.write_field_end()?;
6894 written += o_prot.write_field_begin(&TFieldIdentifier::new("total_byte_size", TType::I64, 2)).await?;
6895 written += o_prot.write_i64(self.total_byte_size).await?;
6896 written += o_prot.write_field_end()?;
6897 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I64, 3)).await?;
6898 written += o_prot.write_i64(self.num_rows).await?;
6899 written += o_prot.write_field_end()?;
6900 if let Some(ref fld_var) = self.sorting_columns {
6901 written += o_prot.write_field_begin(&TFieldIdentifier::new("sorting_columns", TType::List, 4)).await?;
6902 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32)).await?;
6903 for e in fld_var {
6904 written += e.write_to_out_stream_protocol(o_prot).await?;
6905 }
6906 written += o_prot.write_list_end().await?;
6907 written += o_prot.write_field_end()?;
6908 }
6909 if let Some(fld_var) = self.file_offset {
6910 written += o_prot.write_field_begin(&TFieldIdentifier::new("file_offset", TType::I64, 5)).await?;
6911 written += o_prot.write_i64(fld_var).await?;
6912 written += o_prot.write_field_end()?;
6913 }
6914 if let Some(fld_var) = self.total_compressed_size {
6915 written += o_prot.write_field_begin(&TFieldIdentifier::new("total_compressed_size", TType::I64, 6)).await?;
6916 written += o_prot.write_i64(fld_var).await?;
6917 written += o_prot.write_field_end()?;
6918 }
6919 if let Some(fld_var) = self.ordinal {
6920 written += o_prot.write_field_begin(&TFieldIdentifier::new("ordinal", TType::I16, 7)).await?;
6921 written += o_prot.write_i16(fld_var).await?;
6922 written += o_prot.write_field_end()?;
6923 }
6924 written += o_prot.write_field_stop().await?;
6925 written += o_prot.write_struct_end()?;
6926 Ok(written)
6927 }
6928}
6929
6930#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
6936pub struct TypeDefinedOrder {
6937}
6938
6939impl TypeDefinedOrder {
6940 pub fn new() -> TypeDefinedOrder {
6941 TypeDefinedOrder {}
6942 }
6943 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<TypeDefinedOrder> {
6944 i_prot.read_struct_begin()?;
6945 loop {
6946 let field_ident = i_prot.read_field_begin()?;
6947 if field_ident.field_type == TType::Stop {
6948 break;
6949 }
6950 let field_id = field_id(&field_ident)?;
6951 match field_id {
6952 _ => {
6953 i_prot.skip(field_ident.field_type)?;
6954 },
6955 };
6956 i_prot.read_field_end()?;
6957 }
6958 i_prot.read_struct_end()?;
6959 let ret = TypeDefinedOrder {};
6960 Ok(ret)
6961 }
6962 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<TypeDefinedOrder> {
6963 i_prot.read_struct_begin().await?;
6964 loop {
6965 let field_ident = i_prot.read_field_begin().await?;
6966 if field_ident.field_type == TType::Stop {
6967 break;
6968 }
6969 let field_id = field_id(&field_ident)?;
6970 match field_id {
6971 _ => {
6972 i_prot.skip(field_ident.field_type).await?;
6973 },
6974 };
6975 i_prot.read_field_end().await?;
6976 }
6977 i_prot.read_struct_end().await?;
6978 let ret = TypeDefinedOrder {};
6979 Ok(ret)
6980 }
6981 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6982 let mut written = 0;
6983 let struct_ident = TStructIdentifier::new("TypeDefinedOrder");
6984 written += o_prot.write_struct_begin(&struct_ident)?;
6985 written += o_prot.write_field_stop()?;
6986 written += o_prot.write_struct_end()?;
6987 Ok(written)
6988 }
6989 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
6990 let mut written = 0;
6991 let struct_ident = TStructIdentifier::new("TypeDefinedOrder");
6992 written += o_prot.write_struct_begin(&struct_ident).await?;
6993 written += o_prot.write_field_stop().await?;
6994 written += o_prot.write_struct_end()?;
6995 Ok(written)
6996 }
6997}
6998
6999impl Default for TypeDefinedOrder {
7000 fn default() -> Self {
7001 TypeDefinedOrder{}
7002 }
7003}
7004
7005#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
7010pub enum ColumnOrder {
7011 TYPEORDER(TypeDefinedOrder),
7012}
7013
7014impl ColumnOrder {
7015 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ColumnOrder> {
7016 let mut ret: Option<ColumnOrder> = None;
7017 let mut received_field_count = 0;
7018 i_prot.read_struct_begin()?;
7019 loop {
7020 let field_ident = i_prot.read_field_begin()?;
7021 if field_ident.field_type == TType::Stop {
7022 break;
7023 }
7024 let field_id = field_id(&field_ident)?;
7025 match field_id {
7026 1 => {
7027 let val = TypeDefinedOrder::read_from_in_protocol(i_prot)?;
7028 if ret.is_none() {
7029 ret = Some(ColumnOrder::TYPEORDER(val));
7030 }
7031 received_field_count += 1;
7032 },
7033 _ => {
7034 i_prot.skip(field_ident.field_type)?;
7035 received_field_count += 1;
7036 },
7037 };
7038 i_prot.read_field_end()?;
7039 }
7040 i_prot.read_struct_end()?;
7041 if received_field_count == 0 {
7042 Err(
7043 thrift::Error::Protocol(
7044 ProtocolError::new(
7045 ProtocolErrorKind::InvalidData,
7046 "received empty union from remote ColumnOrder"
7047 )
7048 )
7049 )
7050 } else if received_field_count > 1 {
7051 Err(
7052 thrift::Error::Protocol(
7053 ProtocolError::new(
7054 ProtocolErrorKind::InvalidData,
7055 "received multiple fields for union from remote ColumnOrder"
7056 )
7057 )
7058 )
7059 } else {
7060 ret.ok_or_else(|| thrift::Error::Protocol(
7061 ProtocolError::new(
7062 ProtocolErrorKind::InvalidData,
7063 "received no field for union from remoteColumnOrder"
7064 )
7065 ))
7066 }
7067 }
7068 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<ColumnOrder> {
7069 let mut ret: Option<ColumnOrder> = None;
7070 let mut received_field_count = 0;
7071 i_prot.read_struct_begin().await?;
7072 loop {
7073 let field_ident = i_prot.read_field_begin().await?;
7074 if field_ident.field_type == TType::Stop {
7075 break;
7076 }
7077 let field_id = field_id(&field_ident)?;
7078 match field_id {
7079 1 => {
7080 let val = TypeDefinedOrder::stream_from_in_protocol(i_prot).await?;
7081 if ret.is_none() {
7082 ret = Some(ColumnOrder::TYPEORDER(val));
7083 }
7084 received_field_count += 1;
7085 },
7086 _ => {
7087 i_prot.skip(field_ident.field_type).await?;
7088 received_field_count += 1;
7089 },
7090 };
7091 i_prot.read_field_end().await?;
7092 }
7093 i_prot.read_struct_end().await?;
7094 if received_field_count == 0 {
7095 Err(
7096 thrift::Error::Protocol(
7097 ProtocolError::new(
7098 ProtocolErrorKind::InvalidData,
7099 "received empty union from remote ColumnOrder"
7100 )
7101 )
7102 )
7103 } else if received_field_count > 1 {
7104 Err(
7105 thrift::Error::Protocol(
7106 ProtocolError::new(
7107 ProtocolErrorKind::InvalidData,
7108 "received multiple fields for union from remote ColumnOrder"
7109 )
7110 )
7111 )
7112 } else {
7113 ret.ok_or_else(|| thrift::Error::Protocol(
7114 ProtocolError::new(
7115 ProtocolErrorKind::InvalidData,
7116 "received no field for union from remoteColumnOrder"
7117 )
7118 ))
7119 }
7120 }
7121 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7122 let struct_ident = TStructIdentifier::new("ColumnOrder");
7123 let mut written = o_prot.write_struct_begin(&struct_ident)?;
7124 match *self {
7125 ColumnOrder::TYPEORDER(ref f) => {
7126 written += o_prot.write_field_begin(&TFieldIdentifier::new("TYPE_ORDER", TType::Struct, 1))?;
7127 written += f.write_to_out_protocol(o_prot)?;
7128 written += o_prot.write_field_end()?;
7129 },
7130 }
7131 written += o_prot.write_field_stop()?;
7132 written += o_prot.write_struct_end()?;
7133 Ok(written)
7134 }
7135 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7136 let struct_ident = TStructIdentifier::new("ColumnOrder");
7137 let mut written = o_prot.write_struct_begin(&struct_ident).await?;
7138 match *self {
7139 ColumnOrder::TYPEORDER(ref f) => {
7140 written += o_prot.write_field_begin(&TFieldIdentifier::new("TYPE_ORDER", TType::Struct, 1)).await?;
7141 written += f.write_to_out_stream_protocol(o_prot).await?;
7142 written += o_prot.write_field_end()?;
7143 },
7144 }
7145 written += o_prot.write_field_stop().await?;
7146 written += o_prot.write_struct_end()?;
7147 Ok(written)
7148 }
7149}
7150
7151#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
7156pub struct PageLocation {
7157 pub offset: i64,
7159 pub compressed_page_size: i32,
7162 pub first_row_index: i64,
7165}
7166
7167impl PageLocation {
7168 pub fn new(offset: i64, compressed_page_size: i32, first_row_index: i64) -> PageLocation {
7169 PageLocation {
7170 offset,
7171 compressed_page_size,
7172 first_row_index,
7173 }
7174 }
7175 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<PageLocation> {
7176 i_prot.read_struct_begin()?;
7177 let mut f_1: Option<i64> = None;
7178 let mut f_2: Option<i32> = None;
7179 let mut f_3: Option<i64> = None;
7180 loop {
7181 let field_ident = i_prot.read_field_begin()?;
7182 if field_ident.field_type == TType::Stop {
7183 break;
7184 }
7185 let field_id = field_id(&field_ident)?;
7186 match field_id {
7187 1 => {
7188 let val = i_prot.read_i64()?;
7189 f_1 = Some(val);
7190 },
7191 2 => {
7192 let val = i_prot.read_i32()?;
7193 f_2 = Some(val);
7194 },
7195 3 => {
7196 let val = i_prot.read_i64()?;
7197 f_3 = Some(val);
7198 },
7199 _ => {
7200 i_prot.skip(field_ident.field_type)?;
7201 },
7202 };
7203 i_prot.read_field_end()?;
7204 }
7205 i_prot.read_struct_end()?;
7206 verify_required_field_exists("PageLocation.offset", &f_1)?;
7207 verify_required_field_exists("PageLocation.compressed_page_size", &f_2)?;
7208 verify_required_field_exists("PageLocation.first_row_index", &f_3)?;
7209 let ret = PageLocation {
7210 offset: f_1.expect("auto-generated code should have checked for presence of required fields"),
7211 compressed_page_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
7212 first_row_index: f_3.expect("auto-generated code should have checked for presence of required fields"),
7213 };
7214 Ok(ret)
7215 }
7216 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<PageLocation> {
7217 i_prot.read_struct_begin().await?;
7218 let mut f_1: Option<i64> = None;
7219 let mut f_2: Option<i32> = None;
7220 let mut f_3: Option<i64> = None;
7221 loop {
7222 let field_ident = i_prot.read_field_begin().await?;
7223 if field_ident.field_type == TType::Stop {
7224 break;
7225 }
7226 let field_id = field_id(&field_ident)?;
7227 match field_id {
7228 1 => {
7229 let val = i_prot.read_i64().await?;
7230 f_1 = Some(val);
7231 },
7232 2 => {
7233 let val = i_prot.read_i32().await?;
7234 f_2 = Some(val);
7235 },
7236 3 => {
7237 let val = i_prot.read_i64().await?;
7238 f_3 = Some(val);
7239 },
7240 _ => {
7241 i_prot.skip(field_ident.field_type).await?;
7242 },
7243 };
7244 i_prot.read_field_end().await?;
7245 }
7246 i_prot.read_struct_end().await?;
7247 verify_required_field_exists("PageLocation.offset", &f_1)?;
7248 verify_required_field_exists("PageLocation.compressed_page_size", &f_2)?;
7249 verify_required_field_exists("PageLocation.first_row_index", &f_3)?;
7250 let ret = PageLocation {
7251 offset: f_1.expect("auto-generated code should have checked for presence of required fields"),
7252 compressed_page_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
7253 first_row_index: f_3.expect("auto-generated code should have checked for presence of required fields"),
7254 };
7255 Ok(ret)
7256 }
7257 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7258 let mut written = 0;
7259 let struct_ident = TStructIdentifier::new("PageLocation");
7260 written += o_prot.write_struct_begin(&struct_ident)?;
7261 written += o_prot.write_field_begin(&TFieldIdentifier::new("offset", TType::I64, 1))?;
7262 written += o_prot.write_i64(self.offset)?;
7263 written += o_prot.write_field_end()?;
7264 written += o_prot.write_field_begin(&TFieldIdentifier::new("compressed_page_size", TType::I32, 2))?;
7265 written += o_prot.write_i32(self.compressed_page_size)?;
7266 written += o_prot.write_field_end()?;
7267 written += o_prot.write_field_begin(&TFieldIdentifier::new("first_row_index", TType::I64, 3))?;
7268 written += o_prot.write_i64(self.first_row_index)?;
7269 written += o_prot.write_field_end()?;
7270 written += o_prot.write_field_stop()?;
7271 written += o_prot.write_struct_end()?;
7272 Ok(written)
7273 }
7274 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7275 let mut written = 0;
7276 let struct_ident = TStructIdentifier::new("PageLocation");
7277 written += o_prot.write_struct_begin(&struct_ident).await?;
7278 written += o_prot.write_field_begin(&TFieldIdentifier::new("offset", TType::I64, 1)).await?;
7279 written += o_prot.write_i64(self.offset).await?;
7280 written += o_prot.write_field_end()?;
7281 written += o_prot.write_field_begin(&TFieldIdentifier::new("compressed_page_size", TType::I32, 2)).await?;
7282 written += o_prot.write_i32(self.compressed_page_size).await?;
7283 written += o_prot.write_field_end()?;
7284 written += o_prot.write_field_begin(&TFieldIdentifier::new("first_row_index", TType::I64, 3)).await?;
7285 written += o_prot.write_i64(self.first_row_index).await?;
7286 written += o_prot.write_field_end()?;
7287 written += o_prot.write_field_stop().await?;
7288 written += o_prot.write_struct_end()?;
7289 Ok(written)
7290 }
7291}
7292
7293#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
7298pub struct OffsetIndex {
7299 pub page_locations: Vec<PageLocation>,
7302}
7303
7304impl OffsetIndex {
7305 pub fn new(page_locations: Vec<PageLocation>) -> OffsetIndex {
7306 OffsetIndex {
7307 page_locations,
7308 }
7309 }
7310 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<OffsetIndex> {
7311 i_prot.read_struct_begin()?;
7312 let mut f_1: Option<Vec<PageLocation>> = None;
7313 loop {
7314 let field_ident = i_prot.read_field_begin()?;
7315 if field_ident.field_type == TType::Stop {
7316 break;
7317 }
7318 let field_id = field_id(&field_ident)?;
7319 match field_id {
7320 1 => {
7321 let list_ident = i_prot.read_list_begin()?;
7322 let mut val: Vec<PageLocation> = Vec::with_capacity(list_ident.size as usize);
7323 for _ in 0..list_ident.size {
7324 let list_elem_14 = PageLocation::read_from_in_protocol(i_prot)?;
7325 val.push(list_elem_14);
7326 }
7327 i_prot.read_list_end()?;
7328 f_1 = Some(val);
7329 },
7330 _ => {
7331 i_prot.skip(field_ident.field_type)?;
7332 },
7333 };
7334 i_prot.read_field_end()?;
7335 }
7336 i_prot.read_struct_end()?;
7337 verify_required_field_exists("OffsetIndex.page_locations", &f_1)?;
7338 let ret = OffsetIndex {
7339 page_locations: f_1.expect("auto-generated code should have checked for presence of required fields"),
7340 };
7341 Ok(ret)
7342 }
7343 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<OffsetIndex> {
7344 i_prot.read_struct_begin().await?;
7345 let mut f_1: Option<Vec<PageLocation>> = None;
7346 loop {
7347 let field_ident = i_prot.read_field_begin().await?;
7348 if field_ident.field_type == TType::Stop {
7349 break;
7350 }
7351 let field_id = field_id(&field_ident)?;
7352 match field_id {
7353 1 => {
7354 let list_ident = i_prot.read_list_begin().await?;
7355 let mut val: Vec<PageLocation> = Vec::with_capacity(list_ident.size as usize);
7356 for _ in 0..list_ident.size {
7357 let list_elem_15 = PageLocation::stream_from_in_protocol(i_prot).await?;
7358 val.push(list_elem_15);
7359 }
7360 i_prot.read_list_end().await?;
7361 f_1 = Some(val);
7362 },
7363 _ => {
7364 i_prot.skip(field_ident.field_type).await?;
7365 },
7366 };
7367 i_prot.read_field_end().await?;
7368 }
7369 i_prot.read_struct_end().await?;
7370 verify_required_field_exists("OffsetIndex.page_locations", &f_1)?;
7371 let ret = OffsetIndex {
7372 page_locations: f_1.expect("auto-generated code should have checked for presence of required fields"),
7373 };
7374 Ok(ret)
7375 }
7376 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7377 let mut written = 0;
7378 let struct_ident = TStructIdentifier::new("OffsetIndex");
7379 written += o_prot.write_struct_begin(&struct_ident)?;
7380 written += o_prot.write_field_begin(&TFieldIdentifier::new("page_locations", TType::List, 1))?;
7381 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.page_locations.len() as i32))?;
7382 for e in &self.page_locations {
7383 written += e.write_to_out_protocol(o_prot)?;
7384 }
7385 written += o_prot.write_list_end()?;
7386 written += o_prot.write_field_end()?;
7387 written += o_prot.write_field_stop()?;
7388 written += o_prot.write_struct_end()?;
7389 Ok(written)
7390 }
7391 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7392 let mut written = 0;
7393 let struct_ident = TStructIdentifier::new("OffsetIndex");
7394 written += o_prot.write_struct_begin(&struct_ident).await?;
7395 written += o_prot.write_field_begin(&TFieldIdentifier::new("page_locations", TType::List, 1)).await?;
7396 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.page_locations.len() as i32)).await?;
7397 for e in &self.page_locations {
7398 written += e.write_to_out_stream_protocol(o_prot).await?;
7399 }
7400 written += o_prot.write_list_end().await?;
7401 written += o_prot.write_field_end()?;
7402 written += o_prot.write_field_stop().await?;
7403 written += o_prot.write_struct_end()?;
7404 Ok(written)
7405 }
7406}
7407
7408#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
7415pub struct ColumnIndex {
7416 pub null_pages: Vec<bool>,
7422 pub min_values: Vec<Vec<u8>>,
7431 pub max_values: Vec<Vec<u8>>,
7432 pub boundary_order: BoundaryOrder,
7437 pub null_counts: Option<Vec<i64>>,
7439}
7440
7441impl ColumnIndex {
7442 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>>> {
7443 ColumnIndex {
7444 null_pages,
7445 min_values,
7446 max_values,
7447 boundary_order,
7448 null_counts: null_counts.into(),
7449 }
7450 }
7451 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ColumnIndex> {
7452 i_prot.read_struct_begin()?;
7453 let mut f_1: Option<Vec<bool>> = None;
7454 let mut f_2: Option<Vec<Vec<u8>>> = None;
7455 let mut f_3: Option<Vec<Vec<u8>>> = None;
7456 let mut f_4: Option<BoundaryOrder> = None;
7457 let mut f_5: Option<Vec<i64>> = None;
7458 loop {
7459 let field_ident = i_prot.read_field_begin()?;
7460 if field_ident.field_type == TType::Stop {
7461 break;
7462 }
7463 let field_id = field_id(&field_ident)?;
7464 match field_id {
7465 1 => {
7466 let list_ident = i_prot.read_list_begin()?;
7467 let mut val: Vec<bool> = Vec::with_capacity(list_ident.size as usize);
7468 for _ in 0..list_ident.size {
7469 let list_elem_16 = i_prot.read_bool()?;
7470 val.push(list_elem_16);
7471 }
7472 i_prot.read_list_end()?;
7473 f_1 = Some(val);
7474 },
7475 2 => {
7476 let list_ident = i_prot.read_list_begin()?;
7477 let mut val: Vec<Vec<u8>> = Vec::with_capacity(list_ident.size as usize);
7478 for _ in 0..list_ident.size {
7479 let list_elem_17 = i_prot.read_bytes()?;
7480 val.push(list_elem_17);
7481 }
7482 i_prot.read_list_end()?;
7483 f_2 = Some(val);
7484 },
7485 3 => {
7486 let list_ident = i_prot.read_list_begin()?;
7487 let mut val: Vec<Vec<u8>> = Vec::with_capacity(list_ident.size as usize);
7488 for _ in 0..list_ident.size {
7489 let list_elem_18 = i_prot.read_bytes()?;
7490 val.push(list_elem_18);
7491 }
7492 i_prot.read_list_end()?;
7493 f_3 = Some(val);
7494 },
7495 4 => {
7496 let val = BoundaryOrder::read_from_in_protocol(i_prot)?;
7497 f_4 = Some(val);
7498 },
7499 5 => {
7500 let list_ident = i_prot.read_list_begin()?;
7501 let mut val: Vec<i64> = Vec::with_capacity(list_ident.size as usize);
7502 for _ in 0..list_ident.size {
7503 let list_elem_19 = i_prot.read_i64()?;
7504 val.push(list_elem_19);
7505 }
7506 i_prot.read_list_end()?;
7507 f_5 = Some(val);
7508 },
7509 _ => {
7510 i_prot.skip(field_ident.field_type)?;
7511 },
7512 };
7513 i_prot.read_field_end()?;
7514 }
7515 i_prot.read_struct_end()?;
7516 verify_required_field_exists("ColumnIndex.null_pages", &f_1)?;
7517 verify_required_field_exists("ColumnIndex.min_values", &f_2)?;
7518 verify_required_field_exists("ColumnIndex.max_values", &f_3)?;
7519 verify_required_field_exists("ColumnIndex.boundary_order", &f_4)?;
7520 let ret = ColumnIndex {
7521 null_pages: f_1.expect("auto-generated code should have checked for presence of required fields"),
7522 min_values: f_2.expect("auto-generated code should have checked for presence of required fields"),
7523 max_values: f_3.expect("auto-generated code should have checked for presence of required fields"),
7524 boundary_order: f_4.expect("auto-generated code should have checked for presence of required fields"),
7525 null_counts: f_5,
7526 };
7527 Ok(ret)
7528 }
7529 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<ColumnIndex> {
7530 i_prot.read_struct_begin().await?;
7531 let mut f_1: Option<Vec<bool>> = None;
7532 let mut f_2: Option<Vec<Vec<u8>>> = None;
7533 let mut f_3: Option<Vec<Vec<u8>>> = None;
7534 let mut f_4: Option<BoundaryOrder> = None;
7535 let mut f_5: Option<Vec<i64>> = None;
7536 loop {
7537 let field_ident = i_prot.read_field_begin().await?;
7538 if field_ident.field_type == TType::Stop {
7539 break;
7540 }
7541 let field_id = field_id(&field_ident)?;
7542 match field_id {
7543 1 => {
7544 let list_ident = i_prot.read_list_begin().await?;
7545 let mut val: Vec<bool> = Vec::with_capacity(list_ident.size as usize);
7546 for _ in 0..list_ident.size {
7547 let list_elem_20 = i_prot.read_bool().await?;
7548 val.push(list_elem_20);
7549 }
7550 i_prot.read_list_end().await?;
7551 f_1 = Some(val);
7552 },
7553 2 => {
7554 let list_ident = i_prot.read_list_begin().await?;
7555 let mut val: Vec<Vec<u8>> = Vec::with_capacity(list_ident.size as usize);
7556 for _ in 0..list_ident.size {
7557 let list_elem_21 = i_prot.read_bytes().await?;
7558 val.push(list_elem_21);
7559 }
7560 i_prot.read_list_end().await?;
7561 f_2 = Some(val);
7562 },
7563 3 => {
7564 let list_ident = i_prot.read_list_begin().await?;
7565 let mut val: Vec<Vec<u8>> = Vec::with_capacity(list_ident.size as usize);
7566 for _ in 0..list_ident.size {
7567 let list_elem_22 = i_prot.read_bytes().await?;
7568 val.push(list_elem_22);
7569 }
7570 i_prot.read_list_end().await?;
7571 f_3 = Some(val);
7572 },
7573 4 => {
7574 let val = BoundaryOrder::stream_from_in_protocol(i_prot).await?;
7575 f_4 = Some(val);
7576 },
7577 5 => {
7578 let list_ident = i_prot.read_list_begin().await?;
7579 let mut val: Vec<i64> = Vec::with_capacity(list_ident.size as usize);
7580 for _ in 0..list_ident.size {
7581 let list_elem_23 = i_prot.read_i64().await?;
7582 val.push(list_elem_23);
7583 }
7584 i_prot.read_list_end().await?;
7585 f_5 = Some(val);
7586 },
7587 _ => {
7588 i_prot.skip(field_ident.field_type).await?;
7589 },
7590 };
7591 i_prot.read_field_end().await?;
7592 }
7593 i_prot.read_struct_end().await?;
7594 verify_required_field_exists("ColumnIndex.null_pages", &f_1)?;
7595 verify_required_field_exists("ColumnIndex.min_values", &f_2)?;
7596 verify_required_field_exists("ColumnIndex.max_values", &f_3)?;
7597 verify_required_field_exists("ColumnIndex.boundary_order", &f_4)?;
7598 let ret = ColumnIndex {
7599 null_pages: f_1.expect("auto-generated code should have checked for presence of required fields"),
7600 min_values: f_2.expect("auto-generated code should have checked for presence of required fields"),
7601 max_values: f_3.expect("auto-generated code should have checked for presence of required fields"),
7602 boundary_order: f_4.expect("auto-generated code should have checked for presence of required fields"),
7603 null_counts: f_5,
7604 };
7605 Ok(ret)
7606 }
7607 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7608 let mut written = 0;
7609 let struct_ident = TStructIdentifier::new("ColumnIndex");
7610 written += o_prot.write_struct_begin(&struct_ident)?;
7611 written += o_prot.write_field_begin(&TFieldIdentifier::new("null_pages", TType::List, 1))?;
7612 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Bool, self.null_pages.len() as i32))?;
7613 for e in &self.null_pages {
7614 written += o_prot.write_bool(*e)?;
7615 }
7616 written += o_prot.write_list_end()?;
7617 written += o_prot.write_field_end()?;
7618 written += o_prot.write_field_begin(&TFieldIdentifier::new("min_values", TType::List, 2))?;
7619 written += o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.min_values.len() as i32))?;
7620 for e in &self.min_values {
7621 written += o_prot.write_bytes(e)?;
7622 }
7623 written += o_prot.write_list_end()?;
7624 written += o_prot.write_field_end()?;
7625 written += o_prot.write_field_begin(&TFieldIdentifier::new("max_values", TType::List, 3))?;
7626 written += o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.max_values.len() as i32))?;
7627 for e in &self.max_values {
7628 written += o_prot.write_bytes(e)?;
7629 }
7630 written += o_prot.write_list_end()?;
7631 written += o_prot.write_field_end()?;
7632 written += o_prot.write_field_begin(&TFieldIdentifier::new("boundary_order", TType::I32, 4))?;
7633 written += self.boundary_order.write_to_out_protocol(o_prot)?;
7634 written += o_prot.write_field_end()?;
7635 if let Some(ref fld_var) = self.null_counts {
7636 written += o_prot.write_field_begin(&TFieldIdentifier::new("null_counts", TType::List, 5))?;
7637 written += o_prot.write_list_begin(&TListIdentifier::new(TType::I64, fld_var.len() as i32))?;
7638 for e in fld_var {
7639 written += o_prot.write_i64(*e)?;
7640 }
7641 written += o_prot.write_list_end()?;
7642 written += o_prot.write_field_end()?;
7643 }
7644 written += o_prot.write_field_stop()?;
7645 written += o_prot.write_struct_end()?;
7646 Ok(written)
7647 }
7648 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7649 let mut written = 0;
7650 let struct_ident = TStructIdentifier::new("ColumnIndex");
7651 written += o_prot.write_struct_begin(&struct_ident).await?;
7652 written += o_prot.write_field_begin(&TFieldIdentifier::new("null_pages", TType::List, 1)).await?;
7653 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Bool, self.null_pages.len() as i32)).await?;
7654 for e in &self.null_pages {
7655 written += o_prot.write_bool(*e).await?;
7656 }
7657 written += o_prot.write_list_end().await?;
7658 written += o_prot.write_field_end()?;
7659 written += o_prot.write_field_begin(&TFieldIdentifier::new("min_values", TType::List, 2)).await?;
7660 written += o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.min_values.len() as i32)).await?;
7661 for e in &self.min_values {
7662 written += o_prot.write_bytes(e).await?;
7663 }
7664 written += o_prot.write_list_end().await?;
7665 written += o_prot.write_field_end()?;
7666 written += o_prot.write_field_begin(&TFieldIdentifier::new("max_values", TType::List, 3)).await?;
7667 written += o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.max_values.len() as i32)).await?;
7668 for e in &self.max_values {
7669 written += o_prot.write_bytes(e).await?;
7670 }
7671 written += o_prot.write_list_end().await?;
7672 written += o_prot.write_field_end()?;
7673 written += o_prot.write_field_begin(&TFieldIdentifier::new("boundary_order", TType::I32, 4)).await?;
7674 written += self.boundary_order.write_to_out_stream_protocol(o_prot).await?;
7675 written += o_prot.write_field_end()?;
7676 if let Some(ref fld_var) = self.null_counts {
7677 written += o_prot.write_field_begin(&TFieldIdentifier::new("null_counts", TType::List, 5)).await?;
7678 written += o_prot.write_list_begin(&TListIdentifier::new(TType::I64, fld_var.len() as i32)).await?;
7679 for e in fld_var {
7680 written += o_prot.write_i64(*e).await?;
7681 }
7682 written += o_prot.write_list_end().await?;
7683 written += o_prot.write_field_end()?;
7684 }
7685 written += o_prot.write_field_stop().await?;
7686 written += o_prot.write_struct_end()?;
7687 Ok(written)
7688 }
7689}
7690
7691#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
7696pub struct AesGcmV1 {
7697 pub aad_prefix: Option<Vec<u8>>,
7699 pub aad_file_unique: Option<Vec<u8>>,
7701 pub supply_aad_prefix: Option<bool>,
7704}
7705
7706impl AesGcmV1 {
7707 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>> {
7708 AesGcmV1 {
7709 aad_prefix: aad_prefix.into(),
7710 aad_file_unique: aad_file_unique.into(),
7711 supply_aad_prefix: supply_aad_prefix.into(),
7712 }
7713 }
7714 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<AesGcmV1> {
7715 i_prot.read_struct_begin()?;
7716 let mut f_1: Option<Vec<u8>> = None;
7717 let mut f_2: Option<Vec<u8>> = None;
7718 let mut f_3: Option<bool> = None;
7719 loop {
7720 let field_ident = i_prot.read_field_begin()?;
7721 if field_ident.field_type == TType::Stop {
7722 break;
7723 }
7724 let field_id = field_id(&field_ident)?;
7725 match field_id {
7726 1 => {
7727 let val = i_prot.read_bytes()?;
7728 f_1 = Some(val);
7729 },
7730 2 => {
7731 let val = i_prot.read_bytes()?;
7732 f_2 = Some(val);
7733 },
7734 3 => {
7735 let val = i_prot.read_bool()?;
7736 f_3 = Some(val);
7737 },
7738 _ => {
7739 i_prot.skip(field_ident.field_type)?;
7740 },
7741 };
7742 i_prot.read_field_end()?;
7743 }
7744 i_prot.read_struct_end()?;
7745 let ret = AesGcmV1 {
7746 aad_prefix: f_1,
7747 aad_file_unique: f_2,
7748 supply_aad_prefix: f_3,
7749 };
7750 Ok(ret)
7751 }
7752 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<AesGcmV1> {
7753 i_prot.read_struct_begin().await?;
7754 let mut f_1: Option<Vec<u8>> = None;
7755 let mut f_2: Option<Vec<u8>> = None;
7756 let mut f_3: Option<bool> = None;
7757 loop {
7758 let field_ident = i_prot.read_field_begin().await?;
7759 if field_ident.field_type == TType::Stop {
7760 break;
7761 }
7762 let field_id = field_id(&field_ident)?;
7763 match field_id {
7764 1 => {
7765 let val = i_prot.read_bytes().await?;
7766 f_1 = Some(val);
7767 },
7768 2 => {
7769 let val = i_prot.read_bytes().await?;
7770 f_2 = Some(val);
7771 },
7772 3 => {
7773 let val = i_prot.read_bool().await?;
7774 f_3 = Some(val);
7775 },
7776 _ => {
7777 i_prot.skip(field_ident.field_type).await?;
7778 },
7779 };
7780 i_prot.read_field_end().await?;
7781 }
7782 i_prot.read_struct_end().await?;
7783 let ret = AesGcmV1 {
7784 aad_prefix: f_1,
7785 aad_file_unique: f_2,
7786 supply_aad_prefix: f_3,
7787 };
7788 Ok(ret)
7789 }
7790 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7791 let mut written = 0;
7792 let struct_ident = TStructIdentifier::new("AesGcmV1");
7793 written += o_prot.write_struct_begin(&struct_ident)?;
7794 if let Some(ref fld_var) = self.aad_prefix {
7795 written += o_prot.write_field_begin(&TFieldIdentifier::new("aad_prefix", TType::String, 1))?;
7796 written += o_prot.write_bytes(fld_var)?;
7797 written += o_prot.write_field_end()?;
7798 }
7799 if let Some(ref fld_var) = self.aad_file_unique {
7800 written += o_prot.write_field_begin(&TFieldIdentifier::new("aad_file_unique", TType::String, 2))?;
7801 written += o_prot.write_bytes(fld_var)?;
7802 written += o_prot.write_field_end()?;
7803 }
7804 if let Some(fld_var) = self.supply_aad_prefix {
7805 written += o_prot.write_field_begin(&TFieldIdentifier::new("supply_aad_prefix", TType::Bool, 3))?;
7806 written += o_prot.write_bool(fld_var)?;
7807 written += o_prot.write_field_end()?;
7808 }
7809 written += o_prot.write_field_stop()?;
7810 written += o_prot.write_struct_end()?;
7811 Ok(written)
7812 }
7813 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7814 let mut written = 0;
7815 let struct_ident = TStructIdentifier::new("AesGcmV1");
7816 written += o_prot.write_struct_begin(&struct_ident).await?;
7817 if let Some(ref fld_var) = self.aad_prefix {
7818 written += o_prot.write_field_begin(&TFieldIdentifier::new("aad_prefix", TType::String, 1)).await?;
7819 written += o_prot.write_bytes(fld_var).await?;
7820 written += o_prot.write_field_end()?;
7821 }
7822 if let Some(ref fld_var) = self.aad_file_unique {
7823 written += o_prot.write_field_begin(&TFieldIdentifier::new("aad_file_unique", TType::String, 2)).await?;
7824 written += o_prot.write_bytes(fld_var).await?;
7825 written += o_prot.write_field_end()?;
7826 }
7827 if let Some(fld_var) = self.supply_aad_prefix {
7828 written += o_prot.write_field_begin(&TFieldIdentifier::new("supply_aad_prefix", TType::Bool, 3)).await?;
7829 written += o_prot.write_bool(fld_var).await?;
7830 written += o_prot.write_field_end()?;
7831 }
7832 written += o_prot.write_field_stop().await?;
7833 written += o_prot.write_struct_end()?;
7834 Ok(written)
7835 }
7836}
7837
7838impl Default for AesGcmV1 {
7839 fn default() -> Self {
7840 AesGcmV1{
7841 aad_prefix: Some(Vec::new()),
7842 aad_file_unique: Some(Vec::new()),
7843 supply_aad_prefix: Some(false),
7844 }
7845 }
7846}
7847
7848#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
7853pub struct AesGcmCtrV1 {
7854 pub aad_prefix: Option<Vec<u8>>,
7856 pub aad_file_unique: Option<Vec<u8>>,
7858 pub supply_aad_prefix: Option<bool>,
7861}
7862
7863impl AesGcmCtrV1 {
7864 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>> {
7865 AesGcmCtrV1 {
7866 aad_prefix: aad_prefix.into(),
7867 aad_file_unique: aad_file_unique.into(),
7868 supply_aad_prefix: supply_aad_prefix.into(),
7869 }
7870 }
7871 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<AesGcmCtrV1> {
7872 i_prot.read_struct_begin()?;
7873 let mut f_1: Option<Vec<u8>> = None;
7874 let mut f_2: Option<Vec<u8>> = None;
7875 let mut f_3: Option<bool> = None;
7876 loop {
7877 let field_ident = i_prot.read_field_begin()?;
7878 if field_ident.field_type == TType::Stop {
7879 break;
7880 }
7881 let field_id = field_id(&field_ident)?;
7882 match field_id {
7883 1 => {
7884 let val = i_prot.read_bytes()?;
7885 f_1 = Some(val);
7886 },
7887 2 => {
7888 let val = i_prot.read_bytes()?;
7889 f_2 = Some(val);
7890 },
7891 3 => {
7892 let val = i_prot.read_bool()?;
7893 f_3 = Some(val);
7894 },
7895 _ => {
7896 i_prot.skip(field_ident.field_type)?;
7897 },
7898 };
7899 i_prot.read_field_end()?;
7900 }
7901 i_prot.read_struct_end()?;
7902 let ret = AesGcmCtrV1 {
7903 aad_prefix: f_1,
7904 aad_file_unique: f_2,
7905 supply_aad_prefix: f_3,
7906 };
7907 Ok(ret)
7908 }
7909 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<AesGcmCtrV1> {
7910 i_prot.read_struct_begin().await?;
7911 let mut f_1: Option<Vec<u8>> = None;
7912 let mut f_2: Option<Vec<u8>> = None;
7913 let mut f_3: Option<bool> = None;
7914 loop {
7915 let field_ident = i_prot.read_field_begin().await?;
7916 if field_ident.field_type == TType::Stop {
7917 break;
7918 }
7919 let field_id = field_id(&field_ident)?;
7920 match field_id {
7921 1 => {
7922 let val = i_prot.read_bytes().await?;
7923 f_1 = Some(val);
7924 },
7925 2 => {
7926 let val = i_prot.read_bytes().await?;
7927 f_2 = Some(val);
7928 },
7929 3 => {
7930 let val = i_prot.read_bool().await?;
7931 f_3 = Some(val);
7932 },
7933 _ => {
7934 i_prot.skip(field_ident.field_type).await?;
7935 },
7936 };
7937 i_prot.read_field_end().await?;
7938 }
7939 i_prot.read_struct_end().await?;
7940 let ret = AesGcmCtrV1 {
7941 aad_prefix: f_1,
7942 aad_file_unique: f_2,
7943 supply_aad_prefix: f_3,
7944 };
7945 Ok(ret)
7946 }
7947 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7948 let mut written = 0;
7949 let struct_ident = TStructIdentifier::new("AesGcmCtrV1");
7950 written += o_prot.write_struct_begin(&struct_ident)?;
7951 if let Some(ref fld_var) = self.aad_prefix {
7952 written += o_prot.write_field_begin(&TFieldIdentifier::new("aad_prefix", TType::String, 1))?;
7953 written += o_prot.write_bytes(fld_var)?;
7954 written += o_prot.write_field_end()?;
7955 }
7956 if let Some(ref fld_var) = self.aad_file_unique {
7957 written += o_prot.write_field_begin(&TFieldIdentifier::new("aad_file_unique", TType::String, 2))?;
7958 written += o_prot.write_bytes(fld_var)?;
7959 written += o_prot.write_field_end()?;
7960 }
7961 if let Some(fld_var) = self.supply_aad_prefix {
7962 written += o_prot.write_field_begin(&TFieldIdentifier::new("supply_aad_prefix", TType::Bool, 3))?;
7963 written += o_prot.write_bool(fld_var)?;
7964 written += o_prot.write_field_end()?;
7965 }
7966 written += o_prot.write_field_stop()?;
7967 written += o_prot.write_struct_end()?;
7968 Ok(written)
7969 }
7970 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
7971 let mut written = 0;
7972 let struct_ident = TStructIdentifier::new("AesGcmCtrV1");
7973 written += o_prot.write_struct_begin(&struct_ident).await?;
7974 if let Some(ref fld_var) = self.aad_prefix {
7975 written += o_prot.write_field_begin(&TFieldIdentifier::new("aad_prefix", TType::String, 1)).await?;
7976 written += o_prot.write_bytes(fld_var).await?;
7977 written += o_prot.write_field_end()?;
7978 }
7979 if let Some(ref fld_var) = self.aad_file_unique {
7980 written += o_prot.write_field_begin(&TFieldIdentifier::new("aad_file_unique", TType::String, 2)).await?;
7981 written += o_prot.write_bytes(fld_var).await?;
7982 written += o_prot.write_field_end()?;
7983 }
7984 if let Some(fld_var) = self.supply_aad_prefix {
7985 written += o_prot.write_field_begin(&TFieldIdentifier::new("supply_aad_prefix", TType::Bool, 3)).await?;
7986 written += o_prot.write_bool(fld_var).await?;
7987 written += o_prot.write_field_end()?;
7988 }
7989 written += o_prot.write_field_stop().await?;
7990 written += o_prot.write_struct_end()?;
7991 Ok(written)
7992 }
7993}
7994
7995impl Default for AesGcmCtrV1 {
7996 fn default() -> Self {
7997 AesGcmCtrV1{
7998 aad_prefix: Some(Vec::new()),
7999 aad_file_unique: Some(Vec::new()),
8000 supply_aad_prefix: Some(false),
8001 }
8002 }
8003}
8004
8005#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
8010pub enum EncryptionAlgorithm {
8011 AESGCMV1(AesGcmV1),
8012 AESGCMCTRV1(AesGcmCtrV1),
8013}
8014
8015impl EncryptionAlgorithm {
8016 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<EncryptionAlgorithm> {
8017 let mut ret: Option<EncryptionAlgorithm> = None;
8018 let mut received_field_count = 0;
8019 i_prot.read_struct_begin()?;
8020 loop {
8021 let field_ident = i_prot.read_field_begin()?;
8022 if field_ident.field_type == TType::Stop {
8023 break;
8024 }
8025 let field_id = field_id(&field_ident)?;
8026 match field_id {
8027 1 => {
8028 let val = AesGcmV1::read_from_in_protocol(i_prot)?;
8029 if ret.is_none() {
8030 ret = Some(EncryptionAlgorithm::AESGCMV1(val));
8031 }
8032 received_field_count += 1;
8033 },
8034 2 => {
8035 let val = AesGcmCtrV1::read_from_in_protocol(i_prot)?;
8036 if ret.is_none() {
8037 ret = Some(EncryptionAlgorithm::AESGCMCTRV1(val));
8038 }
8039 received_field_count += 1;
8040 },
8041 _ => {
8042 i_prot.skip(field_ident.field_type)?;
8043 received_field_count += 1;
8044 },
8045 };
8046 i_prot.read_field_end()?;
8047 }
8048 i_prot.read_struct_end()?;
8049 if received_field_count == 0 {
8050 Err(
8051 thrift::Error::Protocol(
8052 ProtocolError::new(
8053 ProtocolErrorKind::InvalidData,
8054 "received empty union from remote EncryptionAlgorithm"
8055 )
8056 )
8057 )
8058 } else if received_field_count > 1 {
8059 Err(
8060 thrift::Error::Protocol(
8061 ProtocolError::new(
8062 ProtocolErrorKind::InvalidData,
8063 "received multiple fields for union from remote EncryptionAlgorithm"
8064 )
8065 )
8066 )
8067 } else {
8068 ret.ok_or_else(|| thrift::Error::Protocol(
8069 ProtocolError::new(
8070 ProtocolErrorKind::InvalidData,
8071 "received no field for union from remoteEncryptionAlgorithm"
8072 )
8073 ))
8074 }
8075 }
8076 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<EncryptionAlgorithm> {
8077 let mut ret: Option<EncryptionAlgorithm> = None;
8078 let mut received_field_count = 0;
8079 i_prot.read_struct_begin().await?;
8080 loop {
8081 let field_ident = i_prot.read_field_begin().await?;
8082 if field_ident.field_type == TType::Stop {
8083 break;
8084 }
8085 let field_id = field_id(&field_ident)?;
8086 match field_id {
8087 1 => {
8088 let val = AesGcmV1::stream_from_in_protocol(i_prot).await?;
8089 if ret.is_none() {
8090 ret = Some(EncryptionAlgorithm::AESGCMV1(val));
8091 }
8092 received_field_count += 1;
8093 },
8094 2 => {
8095 let val = AesGcmCtrV1::stream_from_in_protocol(i_prot).await?;
8096 if ret.is_none() {
8097 ret = Some(EncryptionAlgorithm::AESGCMCTRV1(val));
8098 }
8099 received_field_count += 1;
8100 },
8101 _ => {
8102 i_prot.skip(field_ident.field_type).await?;
8103 received_field_count += 1;
8104 },
8105 };
8106 i_prot.read_field_end().await?;
8107 }
8108 i_prot.read_struct_end().await?;
8109 if received_field_count == 0 {
8110 Err(
8111 thrift::Error::Protocol(
8112 ProtocolError::new(
8113 ProtocolErrorKind::InvalidData,
8114 "received empty union from remote EncryptionAlgorithm"
8115 )
8116 )
8117 )
8118 } else if received_field_count > 1 {
8119 Err(
8120 thrift::Error::Protocol(
8121 ProtocolError::new(
8122 ProtocolErrorKind::InvalidData,
8123 "received multiple fields for union from remote EncryptionAlgorithm"
8124 )
8125 )
8126 )
8127 } else {
8128 ret.ok_or_else(|| thrift::Error::Protocol(
8129 ProtocolError::new(
8130 ProtocolErrorKind::InvalidData,
8131 "received no field for union from remoteEncryptionAlgorithm"
8132 )
8133 ))
8134 }
8135 }
8136 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
8137 let struct_ident = TStructIdentifier::new("EncryptionAlgorithm");
8138 let mut written = o_prot.write_struct_begin(&struct_ident)?;
8139 match *self {
8140 EncryptionAlgorithm::AESGCMV1(ref f) => {
8141 written += o_prot.write_field_begin(&TFieldIdentifier::new("AES_GCM_V1", TType::Struct, 1))?;
8142 written += f.write_to_out_protocol(o_prot)?;
8143 written += o_prot.write_field_end()?;
8144 },
8145 EncryptionAlgorithm::AESGCMCTRV1(ref f) => {
8146 written += o_prot.write_field_begin(&TFieldIdentifier::new("AES_GCM_CTR_V1", TType::Struct, 2))?;
8147 written += f.write_to_out_protocol(o_prot)?;
8148 written += o_prot.write_field_end()?;
8149 },
8150 }
8151 written += o_prot.write_field_stop()?;
8152 written += o_prot.write_struct_end()?;
8153 Ok(written)
8154 }
8155 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
8156 let struct_ident = TStructIdentifier::new("EncryptionAlgorithm");
8157 let mut written = o_prot.write_struct_begin(&struct_ident).await?;
8158 match *self {
8159 EncryptionAlgorithm::AESGCMV1(ref f) => {
8160 written += o_prot.write_field_begin(&TFieldIdentifier::new("AES_GCM_V1", TType::Struct, 1)).await?;
8161 written += f.write_to_out_stream_protocol(o_prot).await?;
8162 written += o_prot.write_field_end()?;
8163 },
8164 EncryptionAlgorithm::AESGCMCTRV1(ref f) => {
8165 written += o_prot.write_field_begin(&TFieldIdentifier::new("AES_GCM_CTR_V1", TType::Struct, 2)).await?;
8166 written += f.write_to_out_stream_protocol(o_prot).await?;
8167 written += o_prot.write_field_end()?;
8168 },
8169 }
8170 written += o_prot.write_field_stop().await?;
8171 written += o_prot.write_struct_end()?;
8172 Ok(written)
8173 }
8174}
8175
8176#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
8182pub struct FileMetaData {
8183 pub version: i32,
8185 pub schema: Vec<SchemaElement>,
8192 pub num_rows: i64,
8194 pub row_groups: Vec<RowGroup>,
8196 pub key_value_metadata: Option<Vec<KeyValue>>,
8198 pub created_by: Option<String>,
8203 pub column_orders: Option<Vec<ColumnOrder>>,
8218 pub encryption_algorithm: Option<EncryptionAlgorithm>,
8222 pub footer_signing_key_metadata: Option<Vec<u8>>,
8225}
8226
8227impl FileMetaData {
8228 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>>> {
8229 FileMetaData {
8230 version,
8231 schema,
8232 num_rows,
8233 row_groups,
8234 key_value_metadata: key_value_metadata.into(),
8235 created_by: created_by.into(),
8236 column_orders: column_orders.into(),
8237 encryption_algorithm: encryption_algorithm.into(),
8238 footer_signing_key_metadata: footer_signing_key_metadata.into(),
8239 }
8240 }
8241 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<FileMetaData> {
8242 i_prot.read_struct_begin()?;
8243 let mut f_1: Option<i32> = None;
8244 let mut f_2: Option<Vec<SchemaElement>> = None;
8245 let mut f_3: Option<i64> = None;
8246 let mut f_4: Option<Vec<RowGroup>> = None;
8247 let mut f_5: Option<Vec<KeyValue>> = None;
8248 let mut f_6: Option<String> = None;
8249 let mut f_7: Option<Vec<ColumnOrder>> = None;
8250 let mut f_8: Option<EncryptionAlgorithm> = None;
8251 let mut f_9: Option<Vec<u8>> = None;
8252 loop {
8253 let field_ident = i_prot.read_field_begin()?;
8254 if field_ident.field_type == TType::Stop {
8255 break;
8256 }
8257 let field_id = field_id(&field_ident)?;
8258 match field_id {
8259 1 => {
8260 let val = i_prot.read_i32()?;
8261 f_1 = Some(val);
8262 },
8263 2 => {
8264 let list_ident = i_prot.read_list_begin()?;
8265 let mut val: Vec<SchemaElement> = Vec::with_capacity(list_ident.size as usize);
8266 for _ in 0..list_ident.size {
8267 let list_elem_24 = SchemaElement::read_from_in_protocol(i_prot)?;
8268 val.push(list_elem_24);
8269 }
8270 i_prot.read_list_end()?;
8271 f_2 = Some(val);
8272 },
8273 3 => {
8274 let val = i_prot.read_i64()?;
8275 f_3 = Some(val);
8276 },
8277 4 => {
8278 let list_ident = i_prot.read_list_begin()?;
8279 let mut val: Vec<RowGroup> = Vec::with_capacity(list_ident.size as usize);
8280 for _ in 0..list_ident.size {
8281 let list_elem_25 = RowGroup::read_from_in_protocol(i_prot)?;
8282 val.push(list_elem_25);
8283 }
8284 i_prot.read_list_end()?;
8285 f_4 = Some(val);
8286 },
8287 5 => {
8288 let list_ident = i_prot.read_list_begin()?;
8289 let mut val: Vec<KeyValue> = Vec::with_capacity(list_ident.size as usize);
8290 for _ in 0..list_ident.size {
8291 let list_elem_26 = KeyValue::read_from_in_protocol(i_prot)?;
8292 val.push(list_elem_26);
8293 }
8294 i_prot.read_list_end()?;
8295 f_5 = Some(val);
8296 },
8297 6 => {
8298 let val = i_prot.read_string()?;
8299 f_6 = Some(val);
8300 },
8301 7 => {
8302 let list_ident = i_prot.read_list_begin()?;
8303 let mut val: Vec<ColumnOrder> = Vec::with_capacity(list_ident.size as usize);
8304 for _ in 0..list_ident.size {
8305 let list_elem_27 = ColumnOrder::read_from_in_protocol(i_prot)?;
8306 val.push(list_elem_27);
8307 }
8308 i_prot.read_list_end()?;
8309 f_7 = Some(val);
8310 },
8311 8 => {
8312 let val = EncryptionAlgorithm::read_from_in_protocol(i_prot)?;
8313 f_8 = Some(val);
8314 },
8315 9 => {
8316 let val = i_prot.read_bytes()?;
8317 f_9 = Some(val);
8318 },
8319 _ => {
8320 i_prot.skip(field_ident.field_type)?;
8321 },
8322 };
8323 i_prot.read_field_end()?;
8324 }
8325 i_prot.read_struct_end()?;
8326 verify_required_field_exists("FileMetaData.version", &f_1)?;
8327 verify_required_field_exists("FileMetaData.schema", &f_2)?;
8328 verify_required_field_exists("FileMetaData.num_rows", &f_3)?;
8329 verify_required_field_exists("FileMetaData.row_groups", &f_4)?;
8330 let ret = FileMetaData {
8331 version: f_1.expect("auto-generated code should have checked for presence of required fields"),
8332 schema: f_2.expect("auto-generated code should have checked for presence of required fields"),
8333 num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
8334 row_groups: f_4.expect("auto-generated code should have checked for presence of required fields"),
8335 key_value_metadata: f_5,
8336 created_by: f_6,
8337 column_orders: f_7,
8338 encryption_algorithm: f_8,
8339 footer_signing_key_metadata: f_9,
8340 };
8341 Ok(ret)
8342 }
8343 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<FileMetaData> {
8344 i_prot.read_struct_begin().await?;
8345 let mut f_1: Option<i32> = None;
8346 let mut f_2: Option<Vec<SchemaElement>> = None;
8347 let mut f_3: Option<i64> = None;
8348 let mut f_4: Option<Vec<RowGroup>> = None;
8349 let mut f_5: Option<Vec<KeyValue>> = None;
8350 let mut f_6: Option<String> = None;
8351 let mut f_7: Option<Vec<ColumnOrder>> = None;
8352 let mut f_8: Option<EncryptionAlgorithm> = None;
8353 let mut f_9: Option<Vec<u8>> = None;
8354 loop {
8355 let field_ident = i_prot.read_field_begin().await?;
8356 if field_ident.field_type == TType::Stop {
8357 break;
8358 }
8359 let field_id = field_id(&field_ident)?;
8360 match field_id {
8361 1 => {
8362 let val = i_prot.read_i32().await?;
8363 f_1 = Some(val);
8364 },
8365 2 => {
8366 let list_ident = i_prot.read_list_begin().await?;
8367 let mut val: Vec<SchemaElement> = Vec::with_capacity(list_ident.size as usize);
8368 for _ in 0..list_ident.size {
8369 let list_elem_28 = SchemaElement::stream_from_in_protocol(i_prot).await?;
8370 val.push(list_elem_28);
8371 }
8372 i_prot.read_list_end().await?;
8373 f_2 = Some(val);
8374 },
8375 3 => {
8376 let val = i_prot.read_i64().await?;
8377 f_3 = Some(val);
8378 },
8379 4 => {
8380 let list_ident = i_prot.read_list_begin().await?;
8381 let mut val: Vec<RowGroup> = Vec::with_capacity(list_ident.size as usize);
8382 for _ in 0..list_ident.size {
8383 let list_elem_29 = RowGroup::stream_from_in_protocol(i_prot).await?;
8384 val.push(list_elem_29);
8385 }
8386 i_prot.read_list_end().await?;
8387 f_4 = Some(val);
8388 },
8389 5 => {
8390 let list_ident = i_prot.read_list_begin().await?;
8391 let mut val: Vec<KeyValue> = Vec::with_capacity(list_ident.size as usize);
8392 for _ in 0..list_ident.size {
8393 let list_elem_30 = KeyValue::stream_from_in_protocol(i_prot).await?;
8394 val.push(list_elem_30);
8395 }
8396 i_prot.read_list_end().await?;
8397 f_5 = Some(val);
8398 },
8399 6 => {
8400 let val = i_prot.read_string().await?;
8401 f_6 = Some(val);
8402 },
8403 7 => {
8404 let list_ident = i_prot.read_list_begin().await?;
8405 let mut val: Vec<ColumnOrder> = Vec::with_capacity(list_ident.size as usize);
8406 for _ in 0..list_ident.size {
8407 let list_elem_31 = ColumnOrder::stream_from_in_protocol(i_prot).await?;
8408 val.push(list_elem_31);
8409 }
8410 i_prot.read_list_end().await?;
8411 f_7 = Some(val);
8412 },
8413 8 => {
8414 let val = EncryptionAlgorithm::stream_from_in_protocol(i_prot).await?;
8415 f_8 = Some(val);
8416 },
8417 9 => {
8418 let val = i_prot.read_bytes().await?;
8419 f_9 = Some(val);
8420 },
8421 _ => {
8422 i_prot.skip(field_ident.field_type).await?;
8423 },
8424 };
8425 i_prot.read_field_end().await?;
8426 }
8427 i_prot.read_struct_end().await?;
8428 verify_required_field_exists("FileMetaData.version", &f_1)?;
8429 verify_required_field_exists("FileMetaData.schema", &f_2)?;
8430 verify_required_field_exists("FileMetaData.num_rows", &f_3)?;
8431 verify_required_field_exists("FileMetaData.row_groups", &f_4)?;
8432 let ret = FileMetaData {
8433 version: f_1.expect("auto-generated code should have checked for presence of required fields"),
8434 schema: f_2.expect("auto-generated code should have checked for presence of required fields"),
8435 num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
8436 row_groups: f_4.expect("auto-generated code should have checked for presence of required fields"),
8437 key_value_metadata: f_5,
8438 created_by: f_6,
8439 column_orders: f_7,
8440 encryption_algorithm: f_8,
8441 footer_signing_key_metadata: f_9,
8442 };
8443 Ok(ret)
8444 }
8445 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
8446 let mut written = 0;
8447 let struct_ident = TStructIdentifier::new("FileMetaData");
8448 written += o_prot.write_struct_begin(&struct_ident)?;
8449 written += o_prot.write_field_begin(&TFieldIdentifier::new("version", TType::I32, 1))?;
8450 written += o_prot.write_i32(self.version)?;
8451 written += o_prot.write_field_end()?;
8452 written += o_prot.write_field_begin(&TFieldIdentifier::new("schema", TType::List, 2))?;
8453 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.schema.len() as i32))?;
8454 for e in &self.schema {
8455 written += e.write_to_out_protocol(o_prot)?;
8456 }
8457 written += o_prot.write_list_end()?;
8458 written += o_prot.write_field_end()?;
8459 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I64, 3))?;
8460 written += o_prot.write_i64(self.num_rows)?;
8461 written += o_prot.write_field_end()?;
8462 written += o_prot.write_field_begin(&TFieldIdentifier::new("row_groups", TType::List, 4))?;
8463 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.row_groups.len() as i32))?;
8464 for e in &self.row_groups {
8465 written += e.write_to_out_protocol(o_prot)?;
8466 }
8467 written += o_prot.write_list_end()?;
8468 written += o_prot.write_field_end()?;
8469 if let Some(ref fld_var) = self.key_value_metadata {
8470 written += o_prot.write_field_begin(&TFieldIdentifier::new("key_value_metadata", TType::List, 5))?;
8471 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
8472 for e in fld_var {
8473 written += e.write_to_out_protocol(o_prot)?;
8474 }
8475 written += o_prot.write_list_end()?;
8476 written += o_prot.write_field_end()?;
8477 }
8478 if let Some(ref fld_var) = self.created_by {
8479 written += o_prot.write_field_begin(&TFieldIdentifier::new("created_by", TType::String, 6))?;
8480 written += o_prot.write_string(fld_var)?;
8481 written += o_prot.write_field_end()?;
8482 }
8483 if let Some(ref fld_var) = self.column_orders {
8484 written += o_prot.write_field_begin(&TFieldIdentifier::new("column_orders", TType::List, 7))?;
8485 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
8486 for e in fld_var {
8487 written += e.write_to_out_protocol(o_prot)?;
8488 }
8489 written += o_prot.write_list_end()?;
8490 written += o_prot.write_field_end()?;
8491 }
8492 if let Some(ref fld_var) = self.encryption_algorithm {
8493 written += o_prot.write_field_begin(&TFieldIdentifier::new("encryption_algorithm", TType::Struct, 8))?;
8494 written += fld_var.write_to_out_protocol(o_prot)?;
8495 written += o_prot.write_field_end()?;
8496 }
8497 if let Some(ref fld_var) = self.footer_signing_key_metadata {
8498 written += o_prot.write_field_begin(&TFieldIdentifier::new("footer_signing_key_metadata", TType::String, 9))?;
8499 written += o_prot.write_bytes(fld_var)?;
8500 written += o_prot.write_field_end()?;
8501 }
8502 written += o_prot.write_field_stop()?;
8503 written += o_prot.write_struct_end()?;
8504 Ok(written)
8505 }
8506 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
8507 let mut written = 0;
8508 let struct_ident = TStructIdentifier::new("FileMetaData");
8509 written += o_prot.write_struct_begin(&struct_ident).await?;
8510 written += o_prot.write_field_begin(&TFieldIdentifier::new("version", TType::I32, 1)).await?;
8511 written += o_prot.write_i32(self.version).await?;
8512 written += o_prot.write_field_end()?;
8513 written += o_prot.write_field_begin(&TFieldIdentifier::new("schema", TType::List, 2)).await?;
8514 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.schema.len() as i32)).await?;
8515 for e in &self.schema {
8516 written += e.write_to_out_stream_protocol(o_prot).await?;
8517 }
8518 written += o_prot.write_list_end().await?;
8519 written += o_prot.write_field_end()?;
8520 written += o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I64, 3)).await?;
8521 written += o_prot.write_i64(self.num_rows).await?;
8522 written += o_prot.write_field_end()?;
8523 written += o_prot.write_field_begin(&TFieldIdentifier::new("row_groups", TType::List, 4)).await?;
8524 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.row_groups.len() as i32)).await?;
8525 for e in &self.row_groups {
8526 written += e.write_to_out_stream_protocol(o_prot).await?;
8527 }
8528 written += o_prot.write_list_end().await?;
8529 written += o_prot.write_field_end()?;
8530 if let Some(ref fld_var) = self.key_value_metadata {
8531 written += o_prot.write_field_begin(&TFieldIdentifier::new("key_value_metadata", TType::List, 5)).await?;
8532 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32)).await?;
8533 for e in fld_var {
8534 written += e.write_to_out_stream_protocol(o_prot).await?;
8535 }
8536 written += o_prot.write_list_end().await?;
8537 written += o_prot.write_field_end()?;
8538 }
8539 if let Some(ref fld_var) = self.created_by {
8540 written += o_prot.write_field_begin(&TFieldIdentifier::new("created_by", TType::String, 6)).await?;
8541 written += o_prot.write_string(fld_var).await?;
8542 written += o_prot.write_field_end()?;
8543 }
8544 if let Some(ref fld_var) = self.column_orders {
8545 written += o_prot.write_field_begin(&TFieldIdentifier::new("column_orders", TType::List, 7)).await?;
8546 written += o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32)).await?;
8547 for e in fld_var {
8548 written += e.write_to_out_stream_protocol(o_prot).await?;
8549 }
8550 written += o_prot.write_list_end().await?;
8551 written += o_prot.write_field_end()?;
8552 }
8553 if let Some(ref fld_var) = self.encryption_algorithm {
8554 written += o_prot.write_field_begin(&TFieldIdentifier::new("encryption_algorithm", TType::Struct, 8)).await?;
8555 written += fld_var.write_to_out_stream_protocol(o_prot).await?;
8556 written += o_prot.write_field_end()?;
8557 }
8558 if let Some(ref fld_var) = self.footer_signing_key_metadata {
8559 written += o_prot.write_field_begin(&TFieldIdentifier::new("footer_signing_key_metadata", TType::String, 9)).await?;
8560 written += o_prot.write_bytes(fld_var).await?;
8561 written += o_prot.write_field_end()?;
8562 }
8563 written += o_prot.write_field_stop().await?;
8564 written += o_prot.write_struct_end()?;
8565 Ok(written)
8566 }
8567}
8568
8569#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
8575pub struct FileCryptoMetaData {
8576 pub encryption_algorithm: EncryptionAlgorithm,
8580 pub key_metadata: Option<Vec<u8>>,
8583}
8584
8585impl FileCryptoMetaData {
8586 pub fn new<F2>(encryption_algorithm: EncryptionAlgorithm, key_metadata: F2) -> FileCryptoMetaData where F2: Into<Option<Vec<u8>>> {
8587 FileCryptoMetaData {
8588 encryption_algorithm,
8589 key_metadata: key_metadata.into(),
8590 }
8591 }
8592 pub fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<FileCryptoMetaData> {
8593 i_prot.read_struct_begin()?;
8594 let mut f_1: Option<EncryptionAlgorithm> = None;
8595 let mut f_2: Option<Vec<u8>> = None;
8596 loop {
8597 let field_ident = i_prot.read_field_begin()?;
8598 if field_ident.field_type == TType::Stop {
8599 break;
8600 }
8601 let field_id = field_id(&field_ident)?;
8602 match field_id {
8603 1 => {
8604 let val = EncryptionAlgorithm::read_from_in_protocol(i_prot)?;
8605 f_1 = Some(val);
8606 },
8607 2 => {
8608 let val = i_prot.read_bytes()?;
8609 f_2 = Some(val);
8610 },
8611 _ => {
8612 i_prot.skip(field_ident.field_type)?;
8613 },
8614 };
8615 i_prot.read_field_end()?;
8616 }
8617 i_prot.read_struct_end()?;
8618 verify_required_field_exists("FileCryptoMetaData.encryption_algorithm", &f_1)?;
8619 let ret = FileCryptoMetaData {
8620 encryption_algorithm: f_1.expect("auto-generated code should have checked for presence of required fields"),
8621 key_metadata: f_2,
8622 };
8623 Ok(ret)
8624 }
8625 pub async fn stream_from_in_protocol<T: TInputStreamProtocol>(i_prot: &mut T) -> thrift::Result<FileCryptoMetaData> {
8626 i_prot.read_struct_begin().await?;
8627 let mut f_1: Option<EncryptionAlgorithm> = None;
8628 let mut f_2: Option<Vec<u8>> = None;
8629 loop {
8630 let field_ident = i_prot.read_field_begin().await?;
8631 if field_ident.field_type == TType::Stop {
8632 break;
8633 }
8634 let field_id = field_id(&field_ident)?;
8635 match field_id {
8636 1 => {
8637 let val = EncryptionAlgorithm::stream_from_in_protocol(i_prot).await?;
8638 f_1 = Some(val);
8639 },
8640 2 => {
8641 let val = i_prot.read_bytes().await?;
8642 f_2 = Some(val);
8643 },
8644 _ => {
8645 i_prot.skip(field_ident.field_type).await?;
8646 },
8647 };
8648 i_prot.read_field_end().await?;
8649 }
8650 i_prot.read_struct_end().await?;
8651 verify_required_field_exists("FileCryptoMetaData.encryption_algorithm", &f_1)?;
8652 let ret = FileCryptoMetaData {
8653 encryption_algorithm: f_1.expect("auto-generated code should have checked for presence of required fields"),
8654 key_metadata: f_2,
8655 };
8656 Ok(ret)
8657 }
8658 pub fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
8659 let mut written = 0;
8660 let struct_ident = TStructIdentifier::new("FileCryptoMetaData");
8661 written += o_prot.write_struct_begin(&struct_ident)?;
8662 written += o_prot.write_field_begin(&TFieldIdentifier::new("encryption_algorithm", TType::Struct, 1))?;
8663 written += self.encryption_algorithm.write_to_out_protocol(o_prot)?;
8664 written += o_prot.write_field_end()?;
8665 if let Some(ref fld_var) = self.key_metadata {
8666 written += o_prot.write_field_begin(&TFieldIdentifier::new("key_metadata", TType::String, 2))?;
8667 written += o_prot.write_bytes(fld_var)?;
8668 written += o_prot.write_field_end()?;
8669 }
8670 written += o_prot.write_field_stop()?;
8671 written += o_prot.write_struct_end()?;
8672 Ok(written)
8673 }
8674 pub async fn write_to_out_stream_protocol<T: TOutputStreamProtocol>(&self, o_prot: &mut T) -> thrift::Result<usize> {
8675 let mut written = 0;
8676 let struct_ident = TStructIdentifier::new("FileCryptoMetaData");
8677 written += o_prot.write_struct_begin(&struct_ident).await?;
8678 written += o_prot.write_field_begin(&TFieldIdentifier::new("encryption_algorithm", TType::Struct, 1)).await?;
8679 written += self.encryption_algorithm.write_to_out_stream_protocol(o_prot).await?;
8680 written += o_prot.write_field_end()?;
8681 if let Some(ref fld_var) = self.key_metadata {
8682 written += o_prot.write_field_begin(&TFieldIdentifier::new("key_metadata", TType::String, 2)).await?;
8683 written += o_prot.write_bytes(fld_var).await?;
8684 written += o_prot.write_field_end()?;
8685 }
8686 written += o_prot.write_field_stop().await?;
8687 written += o_prot.write_struct_end()?;
8688 Ok(written)
8689 }
8690}
8691