parquet/
format.rs

1//! See [`crate::file`] for easier to use APIs.
2// Autogenerated by Thrift Compiler (0.20.0)
3// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
4
5#![allow(dead_code)]
6#![allow(unused_imports)]
7#![allow(unused_extern_crates)]
8#![allow(clippy::too_many_arguments, clippy::type_complexity, clippy::vec_box, clippy::wrong_self_convention)]
9// Fix unexpected `cfg` condition name: `rustfmt` https://github.com/apache/arrow-rs/issues/5725
10//#![cfg_attr(rustfmt, rustfmt_skip)]
11
12use std::cell::RefCell;
13use std::collections::{BTreeMap, BTreeSet};
14use std::convert::{From, TryFrom};
15use std::default::Default;
16use std::error::Error;
17use std::fmt;
18use std::fmt::{Display, Formatter};
19use std::rc::Rc;
20
21use thrift::OrderedFloat;
22use thrift::{ApplicationError, ApplicationErrorKind, ProtocolError, ProtocolErrorKind, TThriftClient};
23use thrift::protocol::{TFieldIdentifier, TListIdentifier, TMapIdentifier, TMessageIdentifier, TMessageType, TInputProtocol, TOutputProtocol, TSerializable, TSetIdentifier, TStructIdentifier, TType};
24use thrift::protocol::field_id;
25use thrift::protocol::verify_expected_message_type;
26use thrift::protocol::verify_expected_sequence_number;
27use thrift::protocol::verify_expected_service_call;
28use thrift::protocol::verify_required_field_exists;
29
30/// Types supported by Parquet.  These types are intended to be used in combination
31/// with the encodings to control the on disk storage format.
32/// For example INT16 is not included as a type since a good encoding of INT32
33/// would handle this.
34#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct Type(pub i32);
36
37impl Type {
38  pub const BOOLEAN: Type = Type(0);
39  pub const INT32: Type = Type(1);
40  pub const INT64: Type = Type(2);
41  pub const INT96: Type = Type(3);
42  pub const FLOAT: Type = Type(4);
43  pub const DOUBLE: Type = Type(5);
44  pub const BYTE_ARRAY: Type = Type(6);
45  pub const FIXED_LEN_BYTE_ARRAY: Type = Type(7);
46  pub const ENUM_VALUES: &'static [Self] = &[
47    Self::BOOLEAN,
48    Self::INT32,
49    Self::INT64,
50    Self::INT96,
51    Self::FLOAT,
52    Self::DOUBLE,
53    Self::BYTE_ARRAY,
54    Self::FIXED_LEN_BYTE_ARRAY,
55  ];
56}
57
58impl crate::thrift::TSerializable for Type {
59  #[allow(clippy::trivially_copy_pass_by_ref)]
60  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
61    o_prot.write_i32(self.0)
62  }
63  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<Type> {
64    let enum_value = i_prot.read_i32()?;
65    Ok(Type::from(enum_value))
66  }
67}
68
69impl From<i32> for Type {
70  fn from(i: i32) -> Self {
71    match i {
72      0 => Type::BOOLEAN,
73      1 => Type::INT32,
74      2 => Type::INT64,
75      3 => Type::INT96,
76      4 => Type::FLOAT,
77      5 => Type::DOUBLE,
78      6 => Type::BYTE_ARRAY,
79      7 => Type::FIXED_LEN_BYTE_ARRAY,
80      _ => Type(i)
81    }
82  }
83}
84
85impl From<&i32> for Type {
86  fn from(i: &i32) -> Self {
87    Type::from(*i)
88  }
89}
90
91impl From<Type> for i32 {
92  fn from(e: Type) -> i32 {
93    e.0
94  }
95}
96
97impl From<&Type> for i32 {
98  fn from(e: &Type) -> i32 {
99    e.0
100  }
101}
102
103/// DEPRECATED: Common types used by frameworks(e.g. hive, pig) using parquet.
104/// ConvertedType is superseded by LogicalType.  This enum should not be extended.
105/// 
106/// See LogicalTypes.md for conversion between ConvertedType and LogicalType.
107#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
108pub struct ConvertedType(pub i32);
109
110impl ConvertedType {
111  /// a BYTE_ARRAY actually contains UTF8 encoded chars
112  pub const UTF8: ConvertedType = ConvertedType(0);
113  /// a map is converted as an optional field containing a repeated key/value pair
114  pub const MAP: ConvertedType = ConvertedType(1);
115  /// a key/value pair is converted into a group of two fields
116  pub const MAP_KEY_VALUE: ConvertedType = ConvertedType(2);
117  /// a list is converted into an optional field containing a repeated field for its
118  /// values
119  pub const LIST: ConvertedType = ConvertedType(3);
120  /// an enum is converted into a BYTE_ARRAY field
121  pub const ENUM: ConvertedType = ConvertedType(4);
122  /// A decimal value.
123  /// 
124  /// This may be used to annotate BYTE_ARRAY or FIXED_LEN_BYTE_ARRAY primitive
125  /// types. The underlying byte array stores the unscaled value encoded as two's
126  /// complement using big-endian byte order (the most significant byte is the
127  /// zeroth element). The value of the decimal is the value * 10^{-scale}.
128  /// 
129  /// This must be accompanied by a (maximum) precision and a scale in the
130  /// SchemaElement. The precision specifies the number of digits in the decimal
131  /// and the scale stores the location of the decimal point. For example 1.23
132  /// would have precision 3 (3 total digits) and scale 2 (the decimal point is
133  /// 2 digits over).
134  pub const DECIMAL: ConvertedType = ConvertedType(5);
135  /// A Date
136  /// 
137  /// Stored as days since Unix epoch, encoded as the INT32 physical type.
138  /// 
139  pub const DATE: ConvertedType = ConvertedType(6);
140  /// A time
141  /// 
142  /// The total number of milliseconds since midnight.  The value is stored
143  /// as an INT32 physical type.
144  pub const TIME_MILLIS: ConvertedType = ConvertedType(7);
145  /// A time.
146  /// 
147  /// The total number of microseconds since midnight.  The value is stored as
148  /// an INT64 physical type.
149  pub const TIME_MICROS: ConvertedType = ConvertedType(8);
150  /// A date/time combination
151  /// 
152  /// Date and time recorded as milliseconds since the Unix epoch.  Recorded as
153  /// a physical type of INT64.
154  pub const TIMESTAMP_MILLIS: ConvertedType = ConvertedType(9);
155  /// A date/time combination
156  /// 
157  /// Date and time recorded as microseconds since the Unix epoch.  The value is
158  /// stored as an INT64 physical type.
159  pub const TIMESTAMP_MICROS: ConvertedType = ConvertedType(10);
160  /// An unsigned integer value.
161  /// 
162  /// The number describes the maximum number of meaningful data bits in
163  /// the stored value. 8, 16 and 32 bit values are stored using the
164  /// INT32 physical type.  64 bit values are stored using the INT64
165  /// physical type.
166  /// 
167  pub const UINT_8: ConvertedType = ConvertedType(11);
168  pub const UINT_16: ConvertedType = ConvertedType(12);
169  pub const UINT_32: ConvertedType = ConvertedType(13);
170  pub const UINT_64: ConvertedType = ConvertedType(14);
171  /// A signed integer value.
172  /// 
173  /// The number describes the maximum number of meaningful data bits in
174  /// the stored value. 8, 16 and 32 bit values are stored using the
175  /// INT32 physical type.  64 bit values are stored using the INT64
176  /// physical type.
177  /// 
178  pub const INT_8: ConvertedType = ConvertedType(15);
179  pub const INT_16: ConvertedType = ConvertedType(16);
180  pub const INT_32: ConvertedType = ConvertedType(17);
181  pub const INT_64: ConvertedType = ConvertedType(18);
182  /// An embedded JSON document
183  /// 
184  /// A JSON document embedded within a single UTF8 column.
185  pub const JSON: ConvertedType = ConvertedType(19);
186  /// An embedded BSON document
187  /// 
188  /// A BSON document embedded within a single BYTE_ARRAY column.
189  pub const BSON: ConvertedType = ConvertedType(20);
190  /// An interval of time
191  /// 
192  /// This type annotates data stored as a FIXED_LEN_BYTE_ARRAY of length 12
193  /// This data is composed of three separate little endian unsigned
194  /// integers.  Each stores a component of a duration of time.  The first
195  /// integer identifies the number of months associated with the duration,
196  /// the second identifies the number of days associated with the duration
197  /// and the third identifies the number of milliseconds associated with
198  /// the provided duration.  This duration of time is independent of any
199  /// particular timezone or date.
200  pub const INTERVAL: ConvertedType = ConvertedType(21);
201  pub const ENUM_VALUES: &'static [Self] = &[
202    Self::UTF8,
203    Self::MAP,
204    Self::MAP_KEY_VALUE,
205    Self::LIST,
206    Self::ENUM,
207    Self::DECIMAL,
208    Self::DATE,
209    Self::TIME_MILLIS,
210    Self::TIME_MICROS,
211    Self::TIMESTAMP_MILLIS,
212    Self::TIMESTAMP_MICROS,
213    Self::UINT_8,
214    Self::UINT_16,
215    Self::UINT_32,
216    Self::UINT_64,
217    Self::INT_8,
218    Self::INT_16,
219    Self::INT_32,
220    Self::INT_64,
221    Self::JSON,
222    Self::BSON,
223    Self::INTERVAL,
224  ];
225}
226
227impl crate::thrift::TSerializable for ConvertedType {
228  #[allow(clippy::trivially_copy_pass_by_ref)]
229  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
230    o_prot.write_i32(self.0)
231  }
232  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ConvertedType> {
233    let enum_value = i_prot.read_i32()?;
234    Ok(ConvertedType::from(enum_value))
235  }
236}
237
238impl From<i32> for ConvertedType {
239  fn from(i: i32) -> Self {
240    match i {
241      0 => ConvertedType::UTF8,
242      1 => ConvertedType::MAP,
243      2 => ConvertedType::MAP_KEY_VALUE,
244      3 => ConvertedType::LIST,
245      4 => ConvertedType::ENUM,
246      5 => ConvertedType::DECIMAL,
247      6 => ConvertedType::DATE,
248      7 => ConvertedType::TIME_MILLIS,
249      8 => ConvertedType::TIME_MICROS,
250      9 => ConvertedType::TIMESTAMP_MILLIS,
251      10 => ConvertedType::TIMESTAMP_MICROS,
252      11 => ConvertedType::UINT_8,
253      12 => ConvertedType::UINT_16,
254      13 => ConvertedType::UINT_32,
255      14 => ConvertedType::UINT_64,
256      15 => ConvertedType::INT_8,
257      16 => ConvertedType::INT_16,
258      17 => ConvertedType::INT_32,
259      18 => ConvertedType::INT_64,
260      19 => ConvertedType::JSON,
261      20 => ConvertedType::BSON,
262      21 => ConvertedType::INTERVAL,
263      _ => ConvertedType(i)
264    }
265  }
266}
267
268impl From<&i32> for ConvertedType {
269  fn from(i: &i32) -> Self {
270    ConvertedType::from(*i)
271  }
272}
273
274impl From<ConvertedType> for i32 {
275  fn from(e: ConvertedType) -> i32 {
276    e.0
277  }
278}
279
280impl From<&ConvertedType> for i32 {
281  fn from(e: &ConvertedType) -> i32 {
282    e.0
283  }
284}
285
286/// Representation of Schemas
287#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
288pub struct FieldRepetitionType(pub i32);
289
290impl FieldRepetitionType {
291  /// This field is required (can not be null) and each row has exactly 1 value.
292  pub const REQUIRED: FieldRepetitionType = FieldRepetitionType(0);
293  /// The field is optional (can be null) and each row has 0 or 1 values.
294  pub const OPTIONAL: FieldRepetitionType = FieldRepetitionType(1);
295  /// The field is repeated and can contain 0 or more values
296  pub const REPEATED: FieldRepetitionType = FieldRepetitionType(2);
297  pub const ENUM_VALUES: &'static [Self] = &[
298    Self::REQUIRED,
299    Self::OPTIONAL,
300    Self::REPEATED,
301  ];
302}
303
304impl crate::thrift::TSerializable for FieldRepetitionType {
305  #[allow(clippy::trivially_copy_pass_by_ref)]
306  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
307    o_prot.write_i32(self.0)
308  }
309  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<FieldRepetitionType> {
310    let enum_value = i_prot.read_i32()?;
311    Ok(FieldRepetitionType::from(enum_value))
312  }
313}
314
315impl From<i32> for FieldRepetitionType {
316  fn from(i: i32) -> Self {
317    match i {
318      0 => FieldRepetitionType::REQUIRED,
319      1 => FieldRepetitionType::OPTIONAL,
320      2 => FieldRepetitionType::REPEATED,
321      _ => FieldRepetitionType(i)
322    }
323  }
324}
325
326impl From<&i32> for FieldRepetitionType {
327  fn from(i: &i32) -> Self {
328    FieldRepetitionType::from(*i)
329  }
330}
331
332impl From<FieldRepetitionType> for i32 {
333  fn from(e: FieldRepetitionType) -> i32 {
334    e.0
335  }
336}
337
338impl From<&FieldRepetitionType> for i32 {
339  fn from(e: &FieldRepetitionType) -> i32 {
340    e.0
341  }
342}
343
344/// Encodings supported by Parquet.  Not all encodings are valid for all types.  These
345/// enums are also used to specify the encoding of definition and repetition levels.
346/// See the accompanying doc for the details of the more complicated encodings.
347#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
348pub struct Encoding(pub i32);
349
350impl Encoding {
351  /// Default encoding.
352  /// BOOLEAN - 1 bit per value. 0 is false; 1 is true.
353  /// INT32 - 4 bytes per value.  Stored as little-endian.
354  /// INT64 - 8 bytes per value.  Stored as little-endian.
355  /// FLOAT - 4 bytes per value.  IEEE. Stored as little-endian.
356  /// DOUBLE - 8 bytes per value.  IEEE. Stored as little-endian.
357  /// BYTE_ARRAY - 4 byte length stored as little endian, followed by bytes.
358  /// FIXED_LEN_BYTE_ARRAY - Just the bytes.
359  pub const PLAIN: Encoding = Encoding(0);
360  /// Deprecated: Dictionary encoding. The values in the dictionary are encoded in the
361  /// plain type.
362  /// in a data page use RLE_DICTIONARY instead.
363  /// in a Dictionary page use PLAIN instead
364  pub const PLAIN_DICTIONARY: Encoding = Encoding(2);
365  /// Group packed run length encoding. Usable for definition/repetition levels
366  /// encoding and Booleans (on one bit: 0 is false; 1 is true.)
367  pub const RLE: Encoding = Encoding(3);
368  /// Bit packed encoding.  This can only be used if the data has a known max
369  /// width.  Usable for definition/repetition levels encoding.
370  pub const BIT_PACKED: Encoding = Encoding(4);
371  /// Delta encoding for integers. This can be used for int columns and works best
372  /// on sorted data
373  pub const DELTA_BINARY_PACKED: Encoding = Encoding(5);
374  /// Encoding for byte arrays to separate the length values and the data. The lengths
375  /// are encoded using DELTA_BINARY_PACKED
376  pub const DELTA_LENGTH_BYTE_ARRAY: Encoding = Encoding(6);
377  /// Incremental-encoded byte array. Prefix lengths are encoded using DELTA_BINARY_PACKED.
378  /// Suffixes are stored as delta length byte arrays.
379  pub const DELTA_BYTE_ARRAY: Encoding = Encoding(7);
380  /// Dictionary encoding: the ids are encoded using the RLE encoding
381  pub const RLE_DICTIONARY: Encoding = Encoding(8);
382  /// Encoding for fixed-width data (FLOAT, DOUBLE, INT32, INT64, FIXED_LEN_BYTE_ARRAY).
383  /// K byte-streams are created where K is the size in bytes of the data type.
384  /// The individual bytes of a value are scattered to the corresponding stream and
385  /// the streams are concatenated.
386  /// This itself does not reduce the size of the data but can lead to better compression
387  /// afterwards.
388  /// 
389  /// Added in 2.8 for FLOAT and DOUBLE.
390  /// Support for INT32, INT64 and FIXED_LEN_BYTE_ARRAY added in 2.11.
391  pub const BYTE_STREAM_SPLIT: Encoding = Encoding(9);
392  pub const ENUM_VALUES: &'static [Self] = &[
393    Self::PLAIN,
394    Self::PLAIN_DICTIONARY,
395    Self::RLE,
396    Self::BIT_PACKED,
397    Self::DELTA_BINARY_PACKED,
398    Self::DELTA_LENGTH_BYTE_ARRAY,
399    Self::DELTA_BYTE_ARRAY,
400    Self::RLE_DICTIONARY,
401    Self::BYTE_STREAM_SPLIT,
402  ];
403}
404
405impl crate::thrift::TSerializable for Encoding {
406  #[allow(clippy::trivially_copy_pass_by_ref)]
407  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
408    o_prot.write_i32(self.0)
409  }
410  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<Encoding> {
411    let enum_value = i_prot.read_i32()?;
412    Ok(Encoding::from(enum_value))
413  }
414}
415
416impl From<i32> for Encoding {
417  fn from(i: i32) -> Self {
418    match i {
419      0 => Encoding::PLAIN,
420      2 => Encoding::PLAIN_DICTIONARY,
421      3 => Encoding::RLE,
422      4 => Encoding::BIT_PACKED,
423      5 => Encoding::DELTA_BINARY_PACKED,
424      6 => Encoding::DELTA_LENGTH_BYTE_ARRAY,
425      7 => Encoding::DELTA_BYTE_ARRAY,
426      8 => Encoding::RLE_DICTIONARY,
427      9 => Encoding::BYTE_STREAM_SPLIT,
428      _ => Encoding(i)
429    }
430  }
431}
432
433impl From<&i32> for Encoding {
434  fn from(i: &i32) -> Self {
435    Encoding::from(*i)
436  }
437}
438
439impl From<Encoding> for i32 {
440  fn from(e: Encoding) -> i32 {
441    e.0
442  }
443}
444
445impl From<&Encoding> for i32 {
446  fn from(e: &Encoding) -> i32 {
447    e.0
448  }
449}
450
451/// Supported compression algorithms.
452/// 
453/// Codecs added in format version X.Y can be read by readers based on X.Y and later.
454/// Codec support may vary between readers based on the format version and
455/// libraries available at runtime.
456/// 
457/// See Compression.md for a detailed specification of these algorithms.
458#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
459pub struct CompressionCodec(pub i32);
460
461impl CompressionCodec {
462  pub const UNCOMPRESSED: CompressionCodec = CompressionCodec(0);
463  pub const SNAPPY: CompressionCodec = CompressionCodec(1);
464  pub const GZIP: CompressionCodec = CompressionCodec(2);
465  pub const LZO: CompressionCodec = CompressionCodec(3);
466  pub const BROTLI: CompressionCodec = CompressionCodec(4);
467  pub const LZ4: CompressionCodec = CompressionCodec(5);
468  pub const ZSTD: CompressionCodec = CompressionCodec(6);
469  pub const LZ4_RAW: CompressionCodec = CompressionCodec(7);
470  pub const ENUM_VALUES: &'static [Self] = &[
471    Self::UNCOMPRESSED,
472    Self::SNAPPY,
473    Self::GZIP,
474    Self::LZO,
475    Self::BROTLI,
476    Self::LZ4,
477    Self::ZSTD,
478    Self::LZ4_RAW,
479  ];
480}
481
482impl crate::thrift::TSerializable for CompressionCodec {
483  #[allow(clippy::trivially_copy_pass_by_ref)]
484  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
485    o_prot.write_i32(self.0)
486  }
487  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<CompressionCodec> {
488    let enum_value = i_prot.read_i32()?;
489    Ok(CompressionCodec::from(enum_value))
490  }
491}
492
493impl From<i32> for CompressionCodec {
494  fn from(i: i32) -> Self {
495    match i {
496      0 => CompressionCodec::UNCOMPRESSED,
497      1 => CompressionCodec::SNAPPY,
498      2 => CompressionCodec::GZIP,
499      3 => CompressionCodec::LZO,
500      4 => CompressionCodec::BROTLI,
501      5 => CompressionCodec::LZ4,
502      6 => CompressionCodec::ZSTD,
503      7 => CompressionCodec::LZ4_RAW,
504      _ => CompressionCodec(i)
505    }
506  }
507}
508
509impl From<&i32> for CompressionCodec {
510  fn from(i: &i32) -> Self {
511    CompressionCodec::from(*i)
512  }
513}
514
515impl From<CompressionCodec> for i32 {
516  fn from(e: CompressionCodec) -> i32 {
517    e.0
518  }
519}
520
521impl From<&CompressionCodec> for i32 {
522  fn from(e: &CompressionCodec) -> i32 {
523    e.0
524  }
525}
526
527#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
528pub struct PageType(pub i32);
529
530impl PageType {
531  pub const DATA_PAGE: PageType = PageType(0);
532  pub const INDEX_PAGE: PageType = PageType(1);
533  pub const DICTIONARY_PAGE: PageType = PageType(2);
534  pub const DATA_PAGE_V2: PageType = PageType(3);
535  pub const ENUM_VALUES: &'static [Self] = &[
536    Self::DATA_PAGE,
537    Self::INDEX_PAGE,
538    Self::DICTIONARY_PAGE,
539    Self::DATA_PAGE_V2,
540  ];
541}
542
543impl crate::thrift::TSerializable for PageType {
544  #[allow(clippy::trivially_copy_pass_by_ref)]
545  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
546    o_prot.write_i32(self.0)
547  }
548  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<PageType> {
549    let enum_value = i_prot.read_i32()?;
550    Ok(PageType::from(enum_value))
551  }
552}
553
554impl From<i32> for PageType {
555  fn from(i: i32) -> Self {
556    match i {
557      0 => PageType::DATA_PAGE,
558      1 => PageType::INDEX_PAGE,
559      2 => PageType::DICTIONARY_PAGE,
560      3 => PageType::DATA_PAGE_V2,
561      _ => PageType(i)
562    }
563  }
564}
565
566impl From<&i32> for PageType {
567  fn from(i: &i32) -> Self {
568    PageType::from(*i)
569  }
570}
571
572impl From<PageType> for i32 {
573  fn from(e: PageType) -> i32 {
574    e.0
575  }
576}
577
578impl From<&PageType> for i32 {
579  fn from(e: &PageType) -> i32 {
580    e.0
581  }
582}
583
584/// Enum to annotate whether lists of min/max elements inside ColumnIndex
585/// are ordered and if so, in which direction.
586#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
587pub struct BoundaryOrder(pub i32);
588
589impl BoundaryOrder {
590  pub const UNORDERED: BoundaryOrder = BoundaryOrder(0);
591  pub const ASCENDING: BoundaryOrder = BoundaryOrder(1);
592  pub const DESCENDING: BoundaryOrder = BoundaryOrder(2);
593  pub const ENUM_VALUES: &'static [Self] = &[
594    Self::UNORDERED,
595    Self::ASCENDING,
596    Self::DESCENDING,
597  ];
598}
599
600impl crate::thrift::TSerializable for BoundaryOrder {
601  #[allow(clippy::trivially_copy_pass_by_ref)]
602  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
603    o_prot.write_i32(self.0)
604  }
605  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BoundaryOrder> {
606    let enum_value = i_prot.read_i32()?;
607    Ok(BoundaryOrder::from(enum_value))
608  }
609}
610
611impl From<i32> for BoundaryOrder {
612  fn from(i: i32) -> Self {
613    match i {
614      0 => BoundaryOrder::UNORDERED,
615      1 => BoundaryOrder::ASCENDING,
616      2 => BoundaryOrder::DESCENDING,
617      _ => BoundaryOrder(i)
618    }
619  }
620}
621
622impl From<&i32> for BoundaryOrder {
623  fn from(i: &i32) -> Self {
624    BoundaryOrder::from(*i)
625  }
626}
627
628impl From<BoundaryOrder> for i32 {
629  fn from(e: BoundaryOrder) -> i32 {
630    e.0
631  }
632}
633
634impl From<&BoundaryOrder> for i32 {
635  fn from(e: &BoundaryOrder) -> i32 {
636    e.0
637  }
638}
639
640//
641// SizeStatistics
642//
643
644/// A structure for capturing metadata for estimating the unencoded,
645/// uncompressed size of data written. This is useful for readers to estimate
646/// how much memory is needed to reconstruct data in their memory model and for
647/// fine grained filter pushdown on nested structures (the histograms contained
648/// in this structure can help determine the number of nulls at a particular
649/// nesting level and maximum length of lists).
650#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
651pub struct SizeStatistics {
652  /// The number of physical bytes stored for BYTE_ARRAY data values assuming
653  /// no encoding. This is exclusive of the bytes needed to store the length of
654  /// each byte array. In other words, this field is equivalent to the `(size
655  /// of PLAIN-ENCODING the byte array values) - (4 bytes * number of values
656  /// written)`. To determine unencoded sizes of other types readers can use
657  /// schema information multiplied by the number of non-null and null values.
658  /// The number of null/non-null values can be inferred from the histograms
659  /// below.
660  /// 
661  /// For example, if a column chunk is dictionary-encoded with dictionary
662  /// ["a", "bc", "cde"], and a data page contains the indices [0, 0, 1, 2],
663  /// then this value for that data page should be 7 (1 + 1 + 2 + 3).
664  /// 
665  /// This field should only be set for types that use BYTE_ARRAY as their
666  /// physical type.
667  pub unencoded_byte_array_data_bytes: Option<i64>,
668  /// When present, there is expected to be one element corresponding to each
669  /// repetition (i.e. size=max repetition_level+1) where each element
670  /// represents the number of times the repetition level was observed in the
671  /// data.
672  /// 
673  /// This field may be omitted if max_repetition_level is 0 without loss
674  /// of information.
675  /// 
676  pub repetition_level_histogram: Option<Vec<i64>>,
677  /// Same as repetition_level_histogram except for definition levels.
678  /// 
679  /// This field may be omitted if max_definition_level is 0 or 1 without
680  /// loss of information.
681  /// 
682  pub definition_level_histogram: Option<Vec<i64>>,
683}
684
685impl SizeStatistics {
686  pub fn new<F1, F2, F3>(unencoded_byte_array_data_bytes: F1, repetition_level_histogram: F2, definition_level_histogram: F3) -> SizeStatistics where F1: Into<Option<i64>>, F2: Into<Option<Vec<i64>>>, F3: Into<Option<Vec<i64>>> {
687    SizeStatistics {
688      unencoded_byte_array_data_bytes: unencoded_byte_array_data_bytes.into(),
689      repetition_level_histogram: repetition_level_histogram.into(),
690      definition_level_histogram: definition_level_histogram.into(),
691    }
692  }
693}
694
695impl crate::thrift::TSerializable for SizeStatistics {
696  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<SizeStatistics> {
697    i_prot.read_struct_begin()?;
698    let mut f_1: Option<i64> = None;
699    let mut f_2: Option<Vec<i64>> = None;
700    let mut f_3: Option<Vec<i64>> = None;
701    loop {
702      let field_ident = i_prot.read_field_begin()?;
703      if field_ident.field_type == TType::Stop {
704        break;
705      }
706      let field_id = field_id(&field_ident)?;
707      match field_id {
708        1 => {
709          let val = i_prot.read_i64()?;
710          f_1 = Some(val);
711        },
712        2 => {
713          let list_ident = i_prot.read_list_begin()?;
714          let mut val: Vec<i64> = Vec::with_capacity(list_ident.size as usize);
715          for _ in 0..list_ident.size {
716            let list_elem_0 = i_prot.read_i64()?;
717            val.push(list_elem_0);
718          }
719          i_prot.read_list_end()?;
720          f_2 = Some(val);
721        },
722        3 => {
723          let list_ident = i_prot.read_list_begin()?;
724          let mut val: Vec<i64> = Vec::with_capacity(list_ident.size as usize);
725          for _ in 0..list_ident.size {
726            let list_elem_1 = i_prot.read_i64()?;
727            val.push(list_elem_1);
728          }
729          i_prot.read_list_end()?;
730          f_3 = Some(val);
731        },
732        _ => {
733          i_prot.skip(field_ident.field_type)?;
734        },
735      };
736      i_prot.read_field_end()?;
737    }
738    i_prot.read_struct_end()?;
739    let ret = SizeStatistics {
740      unencoded_byte_array_data_bytes: f_1,
741      repetition_level_histogram: f_2,
742      definition_level_histogram: f_3,
743    };
744    Ok(ret)
745  }
746  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
747    let struct_ident = TStructIdentifier::new("SizeStatistics");
748    o_prot.write_struct_begin(&struct_ident)?;
749    if let Some(fld_var) = self.unencoded_byte_array_data_bytes {
750      o_prot.write_field_begin(&TFieldIdentifier::new("unencoded_byte_array_data_bytes", TType::I64, 1))?;
751      o_prot.write_i64(fld_var)?;
752      o_prot.write_field_end()?
753    }
754    if let Some(ref fld_var) = self.repetition_level_histogram {
755      o_prot.write_field_begin(&TFieldIdentifier::new("repetition_level_histogram", TType::List, 2))?;
756      o_prot.write_list_begin(&TListIdentifier::new(TType::I64, fld_var.len() as i32))?;
757      for e in fld_var {
758        o_prot.write_i64(*e)?;
759      }
760      o_prot.write_list_end()?;
761      o_prot.write_field_end()?
762    }
763    if let Some(ref fld_var) = self.definition_level_histogram {
764      o_prot.write_field_begin(&TFieldIdentifier::new("definition_level_histogram", TType::List, 3))?;
765      o_prot.write_list_begin(&TListIdentifier::new(TType::I64, fld_var.len() as i32))?;
766      for e in fld_var {
767        o_prot.write_i64(*e)?;
768      }
769      o_prot.write_list_end()?;
770      o_prot.write_field_end()?
771    }
772    o_prot.write_field_stop()?;
773    o_prot.write_struct_end()
774  }
775}
776
777//
778// Statistics
779//
780
781/// Statistics per row group and per page
782/// All fields are optional.
783#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
784pub struct Statistics {
785  /// DEPRECATED: min and max value of the column. Use min_value and max_value.
786  /// 
787  /// Values are encoded using PLAIN encoding, except that variable-length byte
788  /// arrays do not include a length prefix.
789  /// 
790  /// These fields encode min and max values determined by signed comparison
791  /// only. New files should use the correct order for a column's logical type
792  /// and store the values in the min_value and max_value fields.
793  /// 
794  /// To support older readers, these may be set when the column order is
795  /// signed.
796  pub max: Option<Vec<u8>>,
797  pub min: Option<Vec<u8>>,
798  /// count of null value in the column
799  pub null_count: Option<i64>,
800  /// count of distinct values occurring
801  pub distinct_count: Option<i64>,
802  /// Lower and upper bound values for the column, determined by its ColumnOrder.
803  /// 
804  /// These may be the actual minimum and maximum values found on a page or column
805  /// chunk, but can also be (more compact) values that do not exist on a page or
806  /// column chunk. For example, instead of storing "Blart Versenwald III", a writer
807  /// may set min_value="B", max_value="C". Such more compact values must still be
808  /// valid values within the column's logical type.
809  /// 
810  /// Values are encoded using PLAIN encoding, except that variable-length byte
811  /// arrays do not include a length prefix.
812  pub max_value: Option<Vec<u8>>,
813  pub min_value: Option<Vec<u8>>,
814  /// If true, max_value is the actual maximum value for a column
815  pub is_max_value_exact: Option<bool>,
816  /// If true, min_value is the actual minimum value for a column
817  pub is_min_value_exact: Option<bool>,
818}
819
820impl Statistics {
821  pub fn new<F1, F2, F3, F4, F5, F6, F7, F8>(max: F1, min: F2, null_count: F3, distinct_count: F4, max_value: F5, min_value: F6, is_max_value_exact: F7, is_min_value_exact: F8) -> 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>>>, F7: Into<Option<bool>>, F8: Into<Option<bool>> {
822    Statistics {
823      max: max.into(),
824      min: min.into(),
825      null_count: null_count.into(),
826      distinct_count: distinct_count.into(),
827      max_value: max_value.into(),
828      min_value: min_value.into(),
829      is_max_value_exact: is_max_value_exact.into(),
830      is_min_value_exact: is_min_value_exact.into(),
831    }
832  }
833}
834
835impl crate::thrift::TSerializable for Statistics {
836  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<Statistics> {
837    i_prot.read_struct_begin()?;
838    let mut f_1: Option<Vec<u8>> = None;
839    let mut f_2: Option<Vec<u8>> = None;
840    let mut f_3: Option<i64> = None;
841    let mut f_4: Option<i64> = None;
842    let mut f_5: Option<Vec<u8>> = None;
843    let mut f_6: Option<Vec<u8>> = None;
844    let mut f_7: Option<bool> = None;
845    let mut f_8: Option<bool> = None;
846    loop {
847      let field_ident = i_prot.read_field_begin()?;
848      if field_ident.field_type == TType::Stop {
849        break;
850      }
851      let field_id = field_id(&field_ident)?;
852      match field_id {
853        1 => {
854          let val = i_prot.read_bytes()?;
855          f_1 = Some(val);
856        },
857        2 => {
858          let val = i_prot.read_bytes()?;
859          f_2 = Some(val);
860        },
861        3 => {
862          let val = i_prot.read_i64()?;
863          f_3 = Some(val);
864        },
865        4 => {
866          let val = i_prot.read_i64()?;
867          f_4 = Some(val);
868        },
869        5 => {
870          let val = i_prot.read_bytes()?;
871          f_5 = Some(val);
872        },
873        6 => {
874          let val = i_prot.read_bytes()?;
875          f_6 = Some(val);
876        },
877        7 => {
878          let val = i_prot.read_bool()?;
879          f_7 = Some(val);
880        },
881        8 => {
882          let val = i_prot.read_bool()?;
883          f_8 = Some(val);
884        },
885        _ => {
886          i_prot.skip(field_ident.field_type)?;
887        },
888      };
889      i_prot.read_field_end()?;
890    }
891    i_prot.read_struct_end()?;
892    let ret = Statistics {
893      max: f_1,
894      min: f_2,
895      null_count: f_3,
896      distinct_count: f_4,
897      max_value: f_5,
898      min_value: f_6,
899      is_max_value_exact: f_7,
900      is_min_value_exact: f_8,
901    };
902    Ok(ret)
903  }
904  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
905    let struct_ident = TStructIdentifier::new("Statistics");
906    o_prot.write_struct_begin(&struct_ident)?;
907    if let Some(ref fld_var) = self.max {
908      o_prot.write_field_begin(&TFieldIdentifier::new("max", TType::String, 1))?;
909      o_prot.write_bytes(fld_var)?;
910      o_prot.write_field_end()?
911    }
912    if let Some(ref fld_var) = self.min {
913      o_prot.write_field_begin(&TFieldIdentifier::new("min", TType::String, 2))?;
914      o_prot.write_bytes(fld_var)?;
915      o_prot.write_field_end()?
916    }
917    if let Some(fld_var) = self.null_count {
918      o_prot.write_field_begin(&TFieldIdentifier::new("null_count", TType::I64, 3))?;
919      o_prot.write_i64(fld_var)?;
920      o_prot.write_field_end()?
921    }
922    if let Some(fld_var) = self.distinct_count {
923      o_prot.write_field_begin(&TFieldIdentifier::new("distinct_count", TType::I64, 4))?;
924      o_prot.write_i64(fld_var)?;
925      o_prot.write_field_end()?
926    }
927    if let Some(ref fld_var) = self.max_value {
928      o_prot.write_field_begin(&TFieldIdentifier::new("max_value", TType::String, 5))?;
929      o_prot.write_bytes(fld_var)?;
930      o_prot.write_field_end()?
931    }
932    if let Some(ref fld_var) = self.min_value {
933      o_prot.write_field_begin(&TFieldIdentifier::new("min_value", TType::String, 6))?;
934      o_prot.write_bytes(fld_var)?;
935      o_prot.write_field_end()?
936    }
937    if let Some(fld_var) = self.is_max_value_exact {
938      o_prot.write_field_begin(&TFieldIdentifier::new("is_max_value_exact", TType::Bool, 7))?;
939      o_prot.write_bool(fld_var)?;
940      o_prot.write_field_end()?
941    }
942    if let Some(fld_var) = self.is_min_value_exact {
943      o_prot.write_field_begin(&TFieldIdentifier::new("is_min_value_exact", TType::Bool, 8))?;
944      o_prot.write_bool(fld_var)?;
945      o_prot.write_field_end()?
946    }
947    o_prot.write_field_stop()?;
948    o_prot.write_struct_end()
949  }
950}
951
952//
953// StringType
954//
955
956/// Empty structs to use as logical type annotations
957#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
958pub struct StringType {
959}
960
961impl StringType {
962  pub fn new() -> StringType {
963    StringType {}
964  }
965}
966
967impl crate::thrift::TSerializable for StringType {
968  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<StringType> {
969    i_prot.read_struct_begin()?;
970    loop {
971      let field_ident = i_prot.read_field_begin()?;
972      if field_ident.field_type == TType::Stop {
973        break;
974      }
975      i_prot.skip(field_ident.field_type)?;
976      i_prot.read_field_end()?;
977    }
978    i_prot.read_struct_end()?;
979    let ret = StringType {};
980    Ok(ret)
981  }
982  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
983    let struct_ident = TStructIdentifier::new("StringType");
984    o_prot.write_struct_begin(&struct_ident)?;
985    o_prot.write_field_stop()?;
986    o_prot.write_struct_end()
987  }
988}
989
990//
991// UUIDType
992//
993
994#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
995pub struct UUIDType {
996}
997
998impl UUIDType {
999  pub fn new() -> UUIDType {
1000    UUIDType {}
1001  }
1002}
1003
1004impl crate::thrift::TSerializable for UUIDType {
1005  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<UUIDType> {
1006    i_prot.read_struct_begin()?;
1007    loop {
1008      let field_ident = i_prot.read_field_begin()?;
1009      if field_ident.field_type == TType::Stop {
1010        break;
1011      }
1012      i_prot.skip(field_ident.field_type)?;
1013      i_prot.read_field_end()?;
1014    }
1015    i_prot.read_struct_end()?;
1016    let ret = UUIDType {};
1017    Ok(ret)
1018  }
1019  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1020    let struct_ident = TStructIdentifier::new("UUIDType");
1021    o_prot.write_struct_begin(&struct_ident)?;
1022    o_prot.write_field_stop()?;
1023    o_prot.write_struct_end()
1024  }
1025}
1026
1027//
1028// MapType
1029//
1030
1031#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1032pub struct MapType {
1033}
1034
1035impl MapType {
1036  pub fn new() -> MapType {
1037    MapType {}
1038  }
1039}
1040
1041impl crate::thrift::TSerializable for MapType {
1042  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<MapType> {
1043    i_prot.read_struct_begin()?;
1044    loop {
1045      let field_ident = i_prot.read_field_begin()?;
1046      if field_ident.field_type == TType::Stop {
1047        break;
1048      }
1049      i_prot.skip(field_ident.field_type)?;
1050      i_prot.read_field_end()?;
1051    }
1052    i_prot.read_struct_end()?;
1053    let ret = MapType {};
1054    Ok(ret)
1055  }
1056  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1057    let struct_ident = TStructIdentifier::new("MapType");
1058    o_prot.write_struct_begin(&struct_ident)?;
1059    o_prot.write_field_stop()?;
1060    o_prot.write_struct_end()
1061  }
1062}
1063
1064//
1065// ListType
1066//
1067
1068#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1069pub struct ListType {
1070}
1071
1072impl ListType {
1073  pub fn new() -> ListType {
1074    ListType {}
1075  }
1076}
1077
1078impl crate::thrift::TSerializable for ListType {
1079  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ListType> {
1080    i_prot.read_struct_begin()?;
1081    loop {
1082      let field_ident = i_prot.read_field_begin()?;
1083      if field_ident.field_type == TType::Stop {
1084        break;
1085      }
1086      i_prot.skip(field_ident.field_type)?;
1087      i_prot.read_field_end()?;
1088    }
1089    i_prot.read_struct_end()?;
1090    let ret = ListType {};
1091    Ok(ret)
1092  }
1093  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1094    let struct_ident = TStructIdentifier::new("ListType");
1095    o_prot.write_struct_begin(&struct_ident)?;
1096    o_prot.write_field_stop()?;
1097    o_prot.write_struct_end()
1098  }
1099}
1100
1101//
1102// EnumType
1103//
1104
1105#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1106pub struct EnumType {
1107}
1108
1109impl EnumType {
1110  pub fn new() -> EnumType {
1111    EnumType {}
1112  }
1113}
1114
1115impl crate::thrift::TSerializable for EnumType {
1116  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<EnumType> {
1117    i_prot.read_struct_begin()?;
1118    loop {
1119      let field_ident = i_prot.read_field_begin()?;
1120      if field_ident.field_type == TType::Stop {
1121        break;
1122      }
1123      i_prot.skip(field_ident.field_type)?;
1124      i_prot.read_field_end()?;
1125    }
1126    i_prot.read_struct_end()?;
1127    let ret = EnumType {};
1128    Ok(ret)
1129  }
1130  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1131    let struct_ident = TStructIdentifier::new("EnumType");
1132    o_prot.write_struct_begin(&struct_ident)?;
1133    o_prot.write_field_stop()?;
1134    o_prot.write_struct_end()
1135  }
1136}
1137
1138//
1139// DateType
1140//
1141
1142#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1143pub struct DateType {
1144}
1145
1146impl DateType {
1147  pub fn new() -> DateType {
1148    DateType {}
1149  }
1150}
1151
1152impl crate::thrift::TSerializable for DateType {
1153  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<DateType> {
1154    i_prot.read_struct_begin()?;
1155    loop {
1156      let field_ident = i_prot.read_field_begin()?;
1157      if field_ident.field_type == TType::Stop {
1158        break;
1159      }
1160      i_prot.skip(field_ident.field_type)?;
1161      i_prot.read_field_end()?;
1162    }
1163    i_prot.read_struct_end()?;
1164    let ret = DateType {};
1165    Ok(ret)
1166  }
1167  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1168    let struct_ident = TStructIdentifier::new("DateType");
1169    o_prot.write_struct_begin(&struct_ident)?;
1170    o_prot.write_field_stop()?;
1171    o_prot.write_struct_end()
1172  }
1173}
1174
1175//
1176// Float16Type
1177//
1178
1179#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1180pub struct Float16Type {
1181}
1182
1183impl Float16Type {
1184  pub fn new() -> Float16Type {
1185    Float16Type {}
1186  }
1187}
1188
1189impl crate::thrift::TSerializable for Float16Type {
1190  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<Float16Type> {
1191    i_prot.read_struct_begin()?;
1192    loop {
1193      let field_ident = i_prot.read_field_begin()?;
1194      if field_ident.field_type == TType::Stop {
1195        break;
1196      }
1197      i_prot.skip(field_ident.field_type)?;
1198      i_prot.read_field_end()?;
1199    }
1200    i_prot.read_struct_end()?;
1201    let ret = Float16Type {};
1202    Ok(ret)
1203  }
1204  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1205    let struct_ident = TStructIdentifier::new("Float16Type");
1206    o_prot.write_struct_begin(&struct_ident)?;
1207    o_prot.write_field_stop()?;
1208    o_prot.write_struct_end()
1209  }
1210}
1211
1212//
1213// NullType
1214//
1215
1216/// Logical type to annotate a column that is always null.
1217/// 
1218/// Sometimes when discovering the schema of existing data, values are always
1219/// null and the physical type can't be determined. This annotation signals
1220/// the case where the physical type was guessed from all null values.
1221#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1222pub struct NullType {
1223}
1224
1225impl NullType {
1226  pub fn new() -> NullType {
1227    NullType {}
1228  }
1229}
1230
1231impl crate::thrift::TSerializable for NullType {
1232  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<NullType> {
1233    i_prot.read_struct_begin()?;
1234    loop {
1235      let field_ident = i_prot.read_field_begin()?;
1236      if field_ident.field_type == TType::Stop {
1237        break;
1238      }
1239      i_prot.skip(field_ident.field_type)?;
1240      i_prot.read_field_end()?;
1241    }
1242    i_prot.read_struct_end()?;
1243    let ret = NullType {};
1244    Ok(ret)
1245  }
1246  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1247    let struct_ident = TStructIdentifier::new("NullType");
1248    o_prot.write_struct_begin(&struct_ident)?;
1249    o_prot.write_field_stop()?;
1250    o_prot.write_struct_end()
1251  }
1252}
1253
1254//
1255// DecimalType
1256//
1257
1258/// Decimal logical type annotation
1259/// 
1260/// Scale must be zero or a positive integer less than or equal to the precision.
1261/// Precision must be a non-zero positive integer.
1262/// 
1263/// To maintain forward-compatibility in v1, implementations using this logical
1264/// type must also set scale and precision on the annotated SchemaElement.
1265/// 
1266/// Allowed for physical types: INT32, INT64, FIXED_LEN_BYTE_ARRAY, and BYTE_ARRAY.
1267#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1268pub struct DecimalType {
1269  pub scale: i32,
1270  pub precision: i32,
1271}
1272
1273impl DecimalType {
1274  pub fn new(scale: i32, precision: i32) -> DecimalType {
1275    DecimalType {
1276      scale,
1277      precision,
1278    }
1279  }
1280}
1281
1282impl crate::thrift::TSerializable for DecimalType {
1283  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<DecimalType> {
1284    i_prot.read_struct_begin()?;
1285    let mut f_1: Option<i32> = None;
1286    let mut f_2: Option<i32> = None;
1287    loop {
1288      let field_ident = i_prot.read_field_begin()?;
1289      if field_ident.field_type == TType::Stop {
1290        break;
1291      }
1292      let field_id = field_id(&field_ident)?;
1293      match field_id {
1294        1 => {
1295          let val = i_prot.read_i32()?;
1296          f_1 = Some(val);
1297        },
1298        2 => {
1299          let val = i_prot.read_i32()?;
1300          f_2 = Some(val);
1301        },
1302        _ => {
1303          i_prot.skip(field_ident.field_type)?;
1304        },
1305      };
1306      i_prot.read_field_end()?;
1307    }
1308    i_prot.read_struct_end()?;
1309    verify_required_field_exists("DecimalType.scale", &f_1)?;
1310    verify_required_field_exists("DecimalType.precision", &f_2)?;
1311    let ret = DecimalType {
1312      scale: f_1.expect("auto-generated code should have checked for presence of required fields"),
1313      precision: f_2.expect("auto-generated code should have checked for presence of required fields"),
1314    };
1315    Ok(ret)
1316  }
1317  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1318    let struct_ident = TStructIdentifier::new("DecimalType");
1319    o_prot.write_struct_begin(&struct_ident)?;
1320    o_prot.write_field_begin(&TFieldIdentifier::new("scale", TType::I32, 1))?;
1321    o_prot.write_i32(self.scale)?;
1322    o_prot.write_field_end()?;
1323    o_prot.write_field_begin(&TFieldIdentifier::new("precision", TType::I32, 2))?;
1324    o_prot.write_i32(self.precision)?;
1325    o_prot.write_field_end()?;
1326    o_prot.write_field_stop()?;
1327    o_prot.write_struct_end()
1328  }
1329}
1330
1331//
1332// MilliSeconds
1333//
1334
1335/// Time units for logical types
1336#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1337pub struct MilliSeconds {
1338}
1339
1340impl MilliSeconds {
1341  pub fn new() -> MilliSeconds {
1342    MilliSeconds {}
1343  }
1344}
1345
1346impl crate::thrift::TSerializable for MilliSeconds {
1347  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<MilliSeconds> {
1348    i_prot.read_struct_begin()?;
1349    loop {
1350      let field_ident = i_prot.read_field_begin()?;
1351      if field_ident.field_type == TType::Stop {
1352        break;
1353      }
1354      i_prot.skip(field_ident.field_type)?;
1355      i_prot.read_field_end()?;
1356    }
1357    i_prot.read_struct_end()?;
1358    let ret = MilliSeconds {};
1359    Ok(ret)
1360  }
1361  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1362    let struct_ident = TStructIdentifier::new("MilliSeconds");
1363    o_prot.write_struct_begin(&struct_ident)?;
1364    o_prot.write_field_stop()?;
1365    o_prot.write_struct_end()
1366  }
1367}
1368
1369//
1370// MicroSeconds
1371//
1372
1373#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1374pub struct MicroSeconds {
1375}
1376
1377impl MicroSeconds {
1378  pub fn new() -> MicroSeconds {
1379    MicroSeconds {}
1380  }
1381}
1382
1383impl crate::thrift::TSerializable for MicroSeconds {
1384  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<MicroSeconds> {
1385    i_prot.read_struct_begin()?;
1386    loop {
1387      let field_ident = i_prot.read_field_begin()?;
1388      if field_ident.field_type == TType::Stop {
1389        break;
1390      }
1391      i_prot.skip(field_ident.field_type)?;
1392      i_prot.read_field_end()?;
1393    }
1394    i_prot.read_struct_end()?;
1395    let ret = MicroSeconds {};
1396    Ok(ret)
1397  }
1398  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1399    let struct_ident = TStructIdentifier::new("MicroSeconds");
1400    o_prot.write_struct_begin(&struct_ident)?;
1401    o_prot.write_field_stop()?;
1402    o_prot.write_struct_end()
1403  }
1404}
1405
1406//
1407// NanoSeconds
1408//
1409
1410#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1411pub struct NanoSeconds {
1412}
1413
1414impl NanoSeconds {
1415  pub fn new() -> NanoSeconds {
1416    NanoSeconds {}
1417  }
1418}
1419
1420impl crate::thrift::TSerializable for NanoSeconds {
1421  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<NanoSeconds> {
1422    i_prot.read_struct_begin()?;
1423    loop {
1424      let field_ident = i_prot.read_field_begin()?;
1425      if field_ident.field_type == TType::Stop {
1426        break;
1427      }
1428      i_prot.skip(field_ident.field_type)?;
1429      i_prot.read_field_end()?;
1430    }
1431    i_prot.read_struct_end()?;
1432    let ret = NanoSeconds {};
1433    Ok(ret)
1434  }
1435  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1436    let struct_ident = TStructIdentifier::new("NanoSeconds");
1437    o_prot.write_struct_begin(&struct_ident)?;
1438    o_prot.write_field_stop()?;
1439    o_prot.write_struct_end()
1440  }
1441}
1442
1443//
1444// TimeUnit
1445//
1446
1447#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1448pub enum TimeUnit {
1449  MILLIS(MilliSeconds),
1450  MICROS(MicroSeconds),
1451  NANOS(NanoSeconds),
1452}
1453
1454impl crate::thrift::TSerializable for TimeUnit {
1455  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<TimeUnit> {
1456    let mut ret: Option<TimeUnit> = None;
1457    let mut received_field_count = 0;
1458    i_prot.read_struct_begin()?;
1459    loop {
1460      let field_ident = i_prot.read_field_begin()?;
1461      if field_ident.field_type == TType::Stop {
1462        break;
1463      }
1464      let field_id = field_id(&field_ident)?;
1465      match field_id {
1466        1 => {
1467          let val = MilliSeconds::read_from_in_protocol(i_prot)?;
1468          if ret.is_none() {
1469            ret = Some(TimeUnit::MILLIS(val));
1470          }
1471          received_field_count += 1;
1472        },
1473        2 => {
1474          let val = MicroSeconds::read_from_in_protocol(i_prot)?;
1475          if ret.is_none() {
1476            ret = Some(TimeUnit::MICROS(val));
1477          }
1478          received_field_count += 1;
1479        },
1480        3 => {
1481          let val = NanoSeconds::read_from_in_protocol(i_prot)?;
1482          if ret.is_none() {
1483            ret = Some(TimeUnit::NANOS(val));
1484          }
1485          received_field_count += 1;
1486        },
1487        _ => {
1488          i_prot.skip(field_ident.field_type)?;
1489          received_field_count += 1;
1490        },
1491      };
1492      i_prot.read_field_end()?;
1493    }
1494    i_prot.read_struct_end()?;
1495    if received_field_count == 0 {
1496      Err(
1497        thrift::Error::Protocol(
1498          ProtocolError::new(
1499            ProtocolErrorKind::InvalidData,
1500            "received empty union from remote TimeUnit"
1501          )
1502        )
1503      )
1504    } else if received_field_count > 1 {
1505      Err(
1506        thrift::Error::Protocol(
1507          ProtocolError::new(
1508            ProtocolErrorKind::InvalidData,
1509            "received multiple fields for union from remote TimeUnit"
1510          )
1511        )
1512      )
1513    } else {
1514      ret.ok_or_else(|| thrift::Error::Protocol(ProtocolError::new(ProtocolErrorKind::InvalidData, "return value should have been constructed")))
1515    }
1516  }
1517  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1518    let struct_ident = TStructIdentifier::new("TimeUnit");
1519    o_prot.write_struct_begin(&struct_ident)?;
1520    match *self {
1521      TimeUnit::MILLIS(ref f) => {
1522        o_prot.write_field_begin(&TFieldIdentifier::new("MILLIS", TType::Struct, 1))?;
1523        f.write_to_out_protocol(o_prot)?;
1524        o_prot.write_field_end()?;
1525      },
1526      TimeUnit::MICROS(ref f) => {
1527        o_prot.write_field_begin(&TFieldIdentifier::new("MICROS", TType::Struct, 2))?;
1528        f.write_to_out_protocol(o_prot)?;
1529        o_prot.write_field_end()?;
1530      },
1531      TimeUnit::NANOS(ref f) => {
1532        o_prot.write_field_begin(&TFieldIdentifier::new("NANOS", TType::Struct, 3))?;
1533        f.write_to_out_protocol(o_prot)?;
1534        o_prot.write_field_end()?;
1535      },
1536    }
1537    o_prot.write_field_stop()?;
1538    o_prot.write_struct_end()
1539  }
1540}
1541
1542//
1543// TimestampType
1544//
1545
1546/// Timestamp logical type annotation
1547/// 
1548/// Allowed for physical types: INT64
1549#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1550pub struct TimestampType {
1551  pub is_adjusted_to_u_t_c: bool,
1552  pub unit: TimeUnit,
1553}
1554
1555impl TimestampType {
1556  pub fn new(is_adjusted_to_u_t_c: bool, unit: TimeUnit) -> TimestampType {
1557    TimestampType {
1558      is_adjusted_to_u_t_c,
1559      unit,
1560    }
1561  }
1562}
1563
1564impl crate::thrift::TSerializable for TimestampType {
1565  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<TimestampType> {
1566    i_prot.read_struct_begin()?;
1567    let mut f_1: Option<bool> = None;
1568    let mut f_2: Option<TimeUnit> = None;
1569    loop {
1570      let field_ident = i_prot.read_field_begin()?;
1571      if field_ident.field_type == TType::Stop {
1572        break;
1573      }
1574      let field_id = field_id(&field_ident)?;
1575      match field_id {
1576        1 => {
1577          let val = i_prot.read_bool()?;
1578          f_1 = Some(val);
1579        },
1580        2 => {
1581          let val = TimeUnit::read_from_in_protocol(i_prot)?;
1582          f_2 = Some(val);
1583        },
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    verify_required_field_exists("TimestampType.is_adjusted_to_u_t_c", &f_1)?;
1592    verify_required_field_exists("TimestampType.unit", &f_2)?;
1593    let ret = TimestampType {
1594      is_adjusted_to_u_t_c: f_1.expect("auto-generated code should have checked for presence of required fields"),
1595      unit: f_2.expect("auto-generated code should have checked for presence of required fields"),
1596    };
1597    Ok(ret)
1598  }
1599  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1600    let struct_ident = TStructIdentifier::new("TimestampType");
1601    o_prot.write_struct_begin(&struct_ident)?;
1602    o_prot.write_field_begin(&TFieldIdentifier::new("isAdjustedToUTC", TType::Bool, 1))?;
1603    o_prot.write_bool(self.is_adjusted_to_u_t_c)?;
1604    o_prot.write_field_end()?;
1605    o_prot.write_field_begin(&TFieldIdentifier::new("unit", TType::Struct, 2))?;
1606    self.unit.write_to_out_protocol(o_prot)?;
1607    o_prot.write_field_end()?;
1608    o_prot.write_field_stop()?;
1609    o_prot.write_struct_end()
1610  }
1611}
1612
1613//
1614// TimeType
1615//
1616
1617/// Time logical type annotation
1618/// 
1619/// Allowed for physical types: INT32 (millis), INT64 (micros, nanos)
1620#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1621pub struct TimeType {
1622  pub is_adjusted_to_u_t_c: bool,
1623  pub unit: TimeUnit,
1624}
1625
1626impl TimeType {
1627  pub fn new(is_adjusted_to_u_t_c: bool, unit: TimeUnit) -> TimeType {
1628    TimeType {
1629      is_adjusted_to_u_t_c,
1630      unit,
1631    }
1632  }
1633}
1634
1635impl crate::thrift::TSerializable for TimeType {
1636  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<TimeType> {
1637    i_prot.read_struct_begin()?;
1638    let mut f_1: Option<bool> = None;
1639    let mut f_2: Option<TimeUnit> = None;
1640    loop {
1641      let field_ident = i_prot.read_field_begin()?;
1642      if field_ident.field_type == TType::Stop {
1643        break;
1644      }
1645      let field_id = field_id(&field_ident)?;
1646      match field_id {
1647        1 => {
1648          let val = i_prot.read_bool()?;
1649          f_1 = Some(val);
1650        },
1651        2 => {
1652          let val = TimeUnit::read_from_in_protocol(i_prot)?;
1653          f_2 = Some(val);
1654        },
1655        _ => {
1656          i_prot.skip(field_ident.field_type)?;
1657        },
1658      };
1659      i_prot.read_field_end()?;
1660    }
1661    i_prot.read_struct_end()?;
1662    verify_required_field_exists("TimeType.is_adjusted_to_u_t_c", &f_1)?;
1663    verify_required_field_exists("TimeType.unit", &f_2)?;
1664    let ret = TimeType {
1665      is_adjusted_to_u_t_c: f_1.expect("auto-generated code should have checked for presence of required fields"),
1666      unit: f_2.expect("auto-generated code should have checked for presence of required fields"),
1667    };
1668    Ok(ret)
1669  }
1670  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1671    let struct_ident = TStructIdentifier::new("TimeType");
1672    o_prot.write_struct_begin(&struct_ident)?;
1673    o_prot.write_field_begin(&TFieldIdentifier::new("isAdjustedToUTC", TType::Bool, 1))?;
1674    o_prot.write_bool(self.is_adjusted_to_u_t_c)?;
1675    o_prot.write_field_end()?;
1676    o_prot.write_field_begin(&TFieldIdentifier::new("unit", TType::Struct, 2))?;
1677    self.unit.write_to_out_protocol(o_prot)?;
1678    o_prot.write_field_end()?;
1679    o_prot.write_field_stop()?;
1680    o_prot.write_struct_end()
1681  }
1682}
1683
1684//
1685// IntType
1686//
1687
1688/// Integer logical type annotation
1689/// 
1690/// bitWidth must be 8, 16, 32, or 64.
1691/// 
1692/// Allowed for physical types: INT32, INT64
1693#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1694pub struct IntType {
1695  pub bit_width: i8,
1696  pub is_signed: bool,
1697}
1698
1699impl IntType {
1700  pub fn new(bit_width: i8, is_signed: bool) -> IntType {
1701    IntType {
1702      bit_width,
1703      is_signed,
1704    }
1705  }
1706}
1707
1708impl crate::thrift::TSerializable for IntType {
1709  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<IntType> {
1710    i_prot.read_struct_begin()?;
1711    let mut f_1: Option<i8> = None;
1712    let mut f_2: Option<bool> = None;
1713    loop {
1714      let field_ident = i_prot.read_field_begin()?;
1715      if field_ident.field_type == TType::Stop {
1716        break;
1717      }
1718      let field_id = field_id(&field_ident)?;
1719      match field_id {
1720        1 => {
1721          let val = i_prot.read_i8()?;
1722          f_1 = Some(val);
1723        },
1724        2 => {
1725          let val = i_prot.read_bool()?;
1726          f_2 = Some(val);
1727        },
1728        _ => {
1729          i_prot.skip(field_ident.field_type)?;
1730        },
1731      };
1732      i_prot.read_field_end()?;
1733    }
1734    i_prot.read_struct_end()?;
1735    verify_required_field_exists("IntType.bit_width", &f_1)?;
1736    verify_required_field_exists("IntType.is_signed", &f_2)?;
1737    let ret = IntType {
1738      bit_width: f_1.expect("auto-generated code should have checked for presence of required fields"),
1739      is_signed: f_2.expect("auto-generated code should have checked for presence of required fields"),
1740    };
1741    Ok(ret)
1742  }
1743  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1744    let struct_ident = TStructIdentifier::new("IntType");
1745    o_prot.write_struct_begin(&struct_ident)?;
1746    o_prot.write_field_begin(&TFieldIdentifier::new("bitWidth", TType::I08, 1))?;
1747    o_prot.write_i8(self.bit_width)?;
1748    o_prot.write_field_end()?;
1749    o_prot.write_field_begin(&TFieldIdentifier::new("isSigned", TType::Bool, 2))?;
1750    o_prot.write_bool(self.is_signed)?;
1751    o_prot.write_field_end()?;
1752    o_prot.write_field_stop()?;
1753    o_prot.write_struct_end()
1754  }
1755}
1756
1757//
1758// JsonType
1759//
1760
1761/// Embedded JSON logical type annotation
1762/// 
1763/// Allowed for physical types: BYTE_ARRAY
1764#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1765pub struct JsonType {
1766}
1767
1768impl JsonType {
1769  pub fn new() -> JsonType {
1770    JsonType {}
1771  }
1772}
1773
1774impl crate::thrift::TSerializable for JsonType {
1775  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<JsonType> {
1776    i_prot.read_struct_begin()?;
1777    loop {
1778      let field_ident = i_prot.read_field_begin()?;
1779      if field_ident.field_type == TType::Stop {
1780        break;
1781      }
1782      i_prot.skip(field_ident.field_type)?;
1783      i_prot.read_field_end()?;
1784    }
1785    i_prot.read_struct_end()?;
1786    let ret = JsonType {};
1787    Ok(ret)
1788  }
1789  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1790    let struct_ident = TStructIdentifier::new("JsonType");
1791    o_prot.write_struct_begin(&struct_ident)?;
1792    o_prot.write_field_stop()?;
1793    o_prot.write_struct_end()
1794  }
1795}
1796
1797//
1798// BsonType
1799//
1800
1801/// Embedded BSON logical type annotation
1802/// 
1803/// Allowed for physical types: BYTE_ARRAY
1804#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
1805pub struct BsonType {
1806}
1807
1808impl BsonType {
1809  pub fn new() -> BsonType {
1810    BsonType {}
1811  }
1812}
1813
1814impl crate::thrift::TSerializable for BsonType {
1815  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BsonType> {
1816    i_prot.read_struct_begin()?;
1817    loop {
1818      let field_ident = i_prot.read_field_begin()?;
1819      if field_ident.field_type == TType::Stop {
1820        break;
1821      }
1822      i_prot.skip(field_ident.field_type)?;
1823      i_prot.read_field_end()?;
1824    }
1825    i_prot.read_struct_end()?;
1826    let ret = BsonType {};
1827    Ok(ret)
1828  }
1829  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
1830    let struct_ident = TStructIdentifier::new("BsonType");
1831    o_prot.write_struct_begin(&struct_ident)?;
1832    o_prot.write_field_stop()?;
1833    o_prot.write_struct_end()
1834  }
1835}
1836
1837//
1838// LogicalType
1839//
1840
1841#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1842pub enum LogicalType {
1843  STRING(StringType),
1844  MAP(MapType),
1845  LIST(ListType),
1846  ENUM(EnumType),
1847  DECIMAL(DecimalType),
1848  DATE(DateType),
1849  TIME(TimeType),
1850  TIMESTAMP(TimestampType),
1851  INTEGER(IntType),
1852  UNKNOWN(NullType),
1853  JSON(JsonType),
1854  BSON(BsonType),
1855  UUID(UUIDType),
1856  FLOAT16(Float16Type),
1857}
1858
1859impl crate::thrift::TSerializable for LogicalType {
1860  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<LogicalType> {
1861    let mut ret: Option<LogicalType> = None;
1862    let mut received_field_count = 0;
1863    i_prot.read_struct_begin()?;
1864    loop {
1865      let field_ident = i_prot.read_field_begin()?;
1866      if field_ident.field_type == TType::Stop {
1867        break;
1868      }
1869      let field_id = field_id(&field_ident)?;
1870      match field_id {
1871        1 => {
1872          let val = StringType::read_from_in_protocol(i_prot)?;
1873          if ret.is_none() {
1874            ret = Some(LogicalType::STRING(val));
1875          }
1876          received_field_count += 1;
1877        },
1878        2 => {
1879          let val = MapType::read_from_in_protocol(i_prot)?;
1880          if ret.is_none() {
1881            ret = Some(LogicalType::MAP(val));
1882          }
1883          received_field_count += 1;
1884        },
1885        3 => {
1886          let val = ListType::read_from_in_protocol(i_prot)?;
1887          if ret.is_none() {
1888            ret = Some(LogicalType::LIST(val));
1889          }
1890          received_field_count += 1;
1891        },
1892        4 => {
1893          let val = EnumType::read_from_in_protocol(i_prot)?;
1894          if ret.is_none() {
1895            ret = Some(LogicalType::ENUM(val));
1896          }
1897          received_field_count += 1;
1898        },
1899        5 => {
1900          let val = DecimalType::read_from_in_protocol(i_prot)?;
1901          if ret.is_none() {
1902            ret = Some(LogicalType::DECIMAL(val));
1903          }
1904          received_field_count += 1;
1905        },
1906        6 => {
1907          let val = DateType::read_from_in_protocol(i_prot)?;
1908          if ret.is_none() {
1909            ret = Some(LogicalType::DATE(val));
1910          }
1911          received_field_count += 1;
1912        },
1913        7 => {
1914          let val = TimeType::read_from_in_protocol(i_prot)?;
1915          if ret.is_none() {
1916            ret = Some(LogicalType::TIME(val));
1917          }
1918          received_field_count += 1;
1919        },
1920        8 => {
1921          let val = TimestampType::read_from_in_protocol(i_prot)?;
1922          if ret.is_none() {
1923            ret = Some(LogicalType::TIMESTAMP(val));
1924          }
1925          received_field_count += 1;
1926        },
1927        10 => {
1928          let val = IntType::read_from_in_protocol(i_prot)?;
1929          if ret.is_none() {
1930            ret = Some(LogicalType::INTEGER(val));
1931          }
1932          received_field_count += 1;
1933        },
1934        11 => {
1935          let val = NullType::read_from_in_protocol(i_prot)?;
1936          if ret.is_none() {
1937            ret = Some(LogicalType::UNKNOWN(val));
1938          }
1939          received_field_count += 1;
1940        },
1941        12 => {
1942          let val = JsonType::read_from_in_protocol(i_prot)?;
1943          if ret.is_none() {
1944            ret = Some(LogicalType::JSON(val));
1945          }
1946          received_field_count += 1;
1947        },
1948        13 => {
1949          let val = BsonType::read_from_in_protocol(i_prot)?;
1950          if ret.is_none() {
1951            ret = Some(LogicalType::BSON(val));
1952          }
1953          received_field_count += 1;
1954        },
1955        14 => {
1956          let val = UUIDType::read_from_in_protocol(i_prot)?;
1957          if ret.is_none() {
1958            ret = Some(LogicalType::UUID(val));
1959          }
1960          received_field_count += 1;
1961        },
1962        15 => {
1963          let val = Float16Type::read_from_in_protocol(i_prot)?;
1964          if ret.is_none() {
1965            ret = Some(LogicalType::FLOAT16(val));
1966          }
1967          received_field_count += 1;
1968        },
1969        _ => {
1970          i_prot.skip(field_ident.field_type)?;
1971          received_field_count += 1;
1972        },
1973      };
1974      i_prot.read_field_end()?;
1975    }
1976    i_prot.read_struct_end()?;
1977    if received_field_count == 0 {
1978      Err(
1979        thrift::Error::Protocol(
1980          ProtocolError::new(
1981            ProtocolErrorKind::InvalidData,
1982            "received empty union from remote LogicalType"
1983          )
1984        )
1985      )
1986    } else if received_field_count > 1 {
1987      Err(
1988        thrift::Error::Protocol(
1989          ProtocolError::new(
1990            ProtocolErrorKind::InvalidData,
1991            "received multiple fields for union from remote LogicalType"
1992          )
1993        )
1994      )
1995    } else {
1996      ret.ok_or_else(|| thrift::Error::Protocol(ProtocolError::new(ProtocolErrorKind::InvalidData, "return value should have been constructed")))
1997    }
1998  }
1999  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2000    let struct_ident = TStructIdentifier::new("LogicalType");
2001    o_prot.write_struct_begin(&struct_ident)?;
2002    match *self {
2003      LogicalType::STRING(ref f) => {
2004        o_prot.write_field_begin(&TFieldIdentifier::new("STRING", TType::Struct, 1))?;
2005        f.write_to_out_protocol(o_prot)?;
2006        o_prot.write_field_end()?;
2007      },
2008      LogicalType::MAP(ref f) => {
2009        o_prot.write_field_begin(&TFieldIdentifier::new("MAP", TType::Struct, 2))?;
2010        f.write_to_out_protocol(o_prot)?;
2011        o_prot.write_field_end()?;
2012      },
2013      LogicalType::LIST(ref f) => {
2014        o_prot.write_field_begin(&TFieldIdentifier::new("LIST", TType::Struct, 3))?;
2015        f.write_to_out_protocol(o_prot)?;
2016        o_prot.write_field_end()?;
2017      },
2018      LogicalType::ENUM(ref f) => {
2019        o_prot.write_field_begin(&TFieldIdentifier::new("ENUM", TType::Struct, 4))?;
2020        f.write_to_out_protocol(o_prot)?;
2021        o_prot.write_field_end()?;
2022      },
2023      LogicalType::DECIMAL(ref f) => {
2024        o_prot.write_field_begin(&TFieldIdentifier::new("DECIMAL", TType::Struct, 5))?;
2025        f.write_to_out_protocol(o_prot)?;
2026        o_prot.write_field_end()?;
2027      },
2028      LogicalType::DATE(ref f) => {
2029        o_prot.write_field_begin(&TFieldIdentifier::new("DATE", TType::Struct, 6))?;
2030        f.write_to_out_protocol(o_prot)?;
2031        o_prot.write_field_end()?;
2032      },
2033      LogicalType::TIME(ref f) => {
2034        o_prot.write_field_begin(&TFieldIdentifier::new("TIME", TType::Struct, 7))?;
2035        f.write_to_out_protocol(o_prot)?;
2036        o_prot.write_field_end()?;
2037      },
2038      LogicalType::TIMESTAMP(ref f) => {
2039        o_prot.write_field_begin(&TFieldIdentifier::new("TIMESTAMP", TType::Struct, 8))?;
2040        f.write_to_out_protocol(o_prot)?;
2041        o_prot.write_field_end()?;
2042      },
2043      LogicalType::INTEGER(ref f) => {
2044        o_prot.write_field_begin(&TFieldIdentifier::new("INTEGER", TType::Struct, 10))?;
2045        f.write_to_out_protocol(o_prot)?;
2046        o_prot.write_field_end()?;
2047      },
2048      LogicalType::UNKNOWN(ref f) => {
2049        o_prot.write_field_begin(&TFieldIdentifier::new("UNKNOWN", TType::Struct, 11))?;
2050        f.write_to_out_protocol(o_prot)?;
2051        o_prot.write_field_end()?;
2052      },
2053      LogicalType::JSON(ref f) => {
2054        o_prot.write_field_begin(&TFieldIdentifier::new("JSON", TType::Struct, 12))?;
2055        f.write_to_out_protocol(o_prot)?;
2056        o_prot.write_field_end()?;
2057      },
2058      LogicalType::BSON(ref f) => {
2059        o_prot.write_field_begin(&TFieldIdentifier::new("BSON", TType::Struct, 13))?;
2060        f.write_to_out_protocol(o_prot)?;
2061        o_prot.write_field_end()?;
2062      },
2063      LogicalType::UUID(ref f) => {
2064        o_prot.write_field_begin(&TFieldIdentifier::new("UUID", TType::Struct, 14))?;
2065        f.write_to_out_protocol(o_prot)?;
2066        o_prot.write_field_end()?;
2067      },
2068      LogicalType::FLOAT16(ref f) => {
2069        o_prot.write_field_begin(&TFieldIdentifier::new("FLOAT16", TType::Struct, 15))?;
2070        f.write_to_out_protocol(o_prot)?;
2071        o_prot.write_field_end()?;
2072      },
2073    }
2074    o_prot.write_field_stop()?;
2075    o_prot.write_struct_end()
2076  }
2077}
2078
2079//
2080// SchemaElement
2081//
2082
2083/// Represents a element inside a schema definition.
2084///
2085///  - if it is a group (inner node) then type is undefined and num_children
2086///    is defined
2087///  - if it is a primitive type (leaf) then type is defined and
2088///    num_children is undefined
2089///
2090/// Note the  nodes are listed in depth first traversal order.
2091#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2092pub struct SchemaElement {
2093  /// Data type for this field. Not set if the current element is a non-leaf node
2094  pub type_: Option<Type>,
2095  /// If type is FIXED_LEN_BYTE_ARRAY, this is the byte length of the values.
2096  /// Otherwise, if specified, this is the maximum bit length to store any of the values.
2097  /// (e.g. a low cardinality INT col could have this set to 3).  Note that this is
2098  /// in the schema, and therefore fixed for the entire file.
2099  pub type_length: Option<i32>,
2100  /// repetition of the field. The root of the schema does not have a repetition_type.
2101  /// All other nodes must have one
2102  pub repetition_type: Option<FieldRepetitionType>,
2103  /// Name of the field in the schema
2104  pub name: String,
2105  /// Nested fields.  Since thrift does not support nested fields,
2106  /// the nesting is flattened to a single list by a depth-first traversal.
2107  /// The children count is used to construct the nested relationship.
2108  /// This field is not set when the element is a primitive type
2109  pub num_children: Option<i32>,
2110  /// DEPRECATED: When the schema is the result of a conversion from another model.
2111  /// Used to record the original type to help with cross conversion.
2112  /// 
2113  /// This is superseded by logicalType.
2114  pub converted_type: Option<ConvertedType>,
2115  /// DEPRECATED: Used when this column contains decimal data.
2116  /// See the DECIMAL converted type for more details.
2117  /// 
2118  /// This is superseded by using the DecimalType annotation in logicalType.
2119  pub scale: Option<i32>,
2120  pub precision: Option<i32>,
2121  /// When the original schema supports field ids, this will save the
2122  /// original field id in the parquet schema
2123  pub field_id: Option<i32>,
2124  /// The logical type of this SchemaElement
2125  /// 
2126  /// LogicalType replaces ConvertedType, but ConvertedType is still required
2127  /// for some logical types to ensure forward-compatibility in format v1.
2128  pub logical_type: Option<LogicalType>,
2129}
2130
2131impl SchemaElement {
2132  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>> {
2133    SchemaElement {
2134      type_: type_.into(),
2135      type_length: type_length.into(),
2136      repetition_type: repetition_type.into(),
2137      name,
2138      num_children: num_children.into(),
2139      converted_type: converted_type.into(),
2140      scale: scale.into(),
2141      precision: precision.into(),
2142      field_id: field_id.into(),
2143      logical_type: logical_type.into(),
2144    }
2145  }
2146}
2147
2148impl crate::thrift::TSerializable for SchemaElement {
2149  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<SchemaElement> {
2150    i_prot.read_struct_begin()?;
2151    let mut f_1: Option<Type> = None;
2152    let mut f_2: Option<i32> = None;
2153    let mut f_3: Option<FieldRepetitionType> = None;
2154    let mut f_4: Option<String> = None;
2155    let mut f_5: Option<i32> = None;
2156    let mut f_6: Option<ConvertedType> = None;
2157    let mut f_7: Option<i32> = None;
2158    let mut f_8: Option<i32> = None;
2159    let mut f_9: Option<i32> = None;
2160    let mut f_10: Option<LogicalType> = None;
2161    loop {
2162      let field_ident = i_prot.read_field_begin()?;
2163      if field_ident.field_type == TType::Stop {
2164        break;
2165      }
2166      let field_id = field_id(&field_ident)?;
2167      match field_id {
2168        1 => {
2169          let val = Type::read_from_in_protocol(i_prot)?;
2170          f_1 = Some(val);
2171        },
2172        2 => {
2173          let val = i_prot.read_i32()?;
2174          f_2 = Some(val);
2175        },
2176        3 => {
2177          let val = FieldRepetitionType::read_from_in_protocol(i_prot)?;
2178          f_3 = Some(val);
2179        },
2180        4 => {
2181          let val = i_prot.read_string()?;
2182          f_4 = Some(val);
2183        },
2184        5 => {
2185          let val = i_prot.read_i32()?;
2186          f_5 = Some(val);
2187        },
2188        6 => {
2189          let val = ConvertedType::read_from_in_protocol(i_prot)?;
2190          f_6 = Some(val);
2191        },
2192        7 => {
2193          let val = i_prot.read_i32()?;
2194          f_7 = Some(val);
2195        },
2196        8 => {
2197          let val = i_prot.read_i32()?;
2198          f_8 = Some(val);
2199        },
2200        9 => {
2201          let val = i_prot.read_i32()?;
2202          f_9 = Some(val);
2203        },
2204        10 => {
2205          let val = LogicalType::read_from_in_protocol(i_prot)?;
2206          f_10 = Some(val);
2207        },
2208        _ => {
2209          i_prot.skip(field_ident.field_type)?;
2210        },
2211      };
2212      i_prot.read_field_end()?;
2213    }
2214    i_prot.read_struct_end()?;
2215    verify_required_field_exists("SchemaElement.name", &f_4)?;
2216    let ret = SchemaElement {
2217      type_: f_1,
2218      type_length: f_2,
2219      repetition_type: f_3,
2220      name: f_4.expect("auto-generated code should have checked for presence of required fields"),
2221      num_children: f_5,
2222      converted_type: f_6,
2223      scale: f_7,
2224      precision: f_8,
2225      field_id: f_9,
2226      logical_type: f_10,
2227    };
2228    Ok(ret)
2229  }
2230  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2231    let struct_ident = TStructIdentifier::new("SchemaElement");
2232    o_prot.write_struct_begin(&struct_ident)?;
2233    if let Some(ref fld_var) = self.type_ {
2234      o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1))?;
2235      fld_var.write_to_out_protocol(o_prot)?;
2236      o_prot.write_field_end()?
2237    }
2238    if let Some(fld_var) = self.type_length {
2239      o_prot.write_field_begin(&TFieldIdentifier::new("type_length", TType::I32, 2))?;
2240      o_prot.write_i32(fld_var)?;
2241      o_prot.write_field_end()?
2242    }
2243    if let Some(ref fld_var) = self.repetition_type {
2244      o_prot.write_field_begin(&TFieldIdentifier::new("repetition_type", TType::I32, 3))?;
2245      fld_var.write_to_out_protocol(o_prot)?;
2246      o_prot.write_field_end()?
2247    }
2248    o_prot.write_field_begin(&TFieldIdentifier::new("name", TType::String, 4))?;
2249    o_prot.write_string(&self.name)?;
2250    o_prot.write_field_end()?;
2251    if let Some(fld_var) = self.num_children {
2252      o_prot.write_field_begin(&TFieldIdentifier::new("num_children", TType::I32, 5))?;
2253      o_prot.write_i32(fld_var)?;
2254      o_prot.write_field_end()?
2255    }
2256    if let Some(ref fld_var) = self.converted_type {
2257      o_prot.write_field_begin(&TFieldIdentifier::new("converted_type", TType::I32, 6))?;
2258      fld_var.write_to_out_protocol(o_prot)?;
2259      o_prot.write_field_end()?
2260    }
2261    if let Some(fld_var) = self.scale {
2262      o_prot.write_field_begin(&TFieldIdentifier::new("scale", TType::I32, 7))?;
2263      o_prot.write_i32(fld_var)?;
2264      o_prot.write_field_end()?
2265    }
2266    if let Some(fld_var) = self.precision {
2267      o_prot.write_field_begin(&TFieldIdentifier::new("precision", TType::I32, 8))?;
2268      o_prot.write_i32(fld_var)?;
2269      o_prot.write_field_end()?
2270    }
2271    if let Some(fld_var) = self.field_id {
2272      o_prot.write_field_begin(&TFieldIdentifier::new("field_id", TType::I32, 9))?;
2273      o_prot.write_i32(fld_var)?;
2274      o_prot.write_field_end()?
2275    }
2276    if let Some(ref fld_var) = self.logical_type {
2277      o_prot.write_field_begin(&TFieldIdentifier::new("logicalType", TType::Struct, 10))?;
2278      fld_var.write_to_out_protocol(o_prot)?;
2279      o_prot.write_field_end()?
2280    }
2281    o_prot.write_field_stop()?;
2282    o_prot.write_struct_end()
2283  }
2284}
2285
2286//
2287// DataPageHeader
2288//
2289
2290/// Data page header
2291#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2292pub struct DataPageHeader {
2293  /// Number of values, including NULLs, in this data page.
2294  /// 
2295  /// If a OffsetIndex is present, a page must begin at a row
2296  /// boundary (repetition_level = 0). Otherwise, pages may begin
2297  /// within a row (repetition_level > 0).
2298  /// 
2299  pub num_values: i32,
2300  /// Encoding used for this data page *
2301  pub encoding: Encoding,
2302  /// Encoding used for definition levels *
2303  pub definition_level_encoding: Encoding,
2304  /// Encoding used for repetition levels *
2305  pub repetition_level_encoding: Encoding,
2306  /// Optional statistics for the data in this page *
2307  pub statistics: Option<Statistics>,
2308}
2309
2310impl DataPageHeader {
2311  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>> {
2312    DataPageHeader {
2313      num_values,
2314      encoding,
2315      definition_level_encoding,
2316      repetition_level_encoding,
2317      statistics: statistics.into(),
2318    }
2319  }
2320}
2321
2322impl crate::thrift::TSerializable for DataPageHeader {
2323  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<DataPageHeader> {
2324    i_prot.read_struct_begin()?;
2325    let mut f_1: Option<i32> = None;
2326    let mut f_2: Option<Encoding> = None;
2327    let mut f_3: Option<Encoding> = None;
2328    let mut f_4: Option<Encoding> = None;
2329    let mut f_5: Option<Statistics> = None;
2330    loop {
2331      let field_ident = i_prot.read_field_begin()?;
2332      if field_ident.field_type == TType::Stop {
2333        break;
2334      }
2335      let field_id = field_id(&field_ident)?;
2336      match field_id {
2337        1 => {
2338          let val = i_prot.read_i32()?;
2339          f_1 = Some(val);
2340        },
2341        2 => {
2342          let val = Encoding::read_from_in_protocol(i_prot)?;
2343          f_2 = Some(val);
2344        },
2345        3 => {
2346          let val = Encoding::read_from_in_protocol(i_prot)?;
2347          f_3 = Some(val);
2348        },
2349        4 => {
2350          let val = Encoding::read_from_in_protocol(i_prot)?;
2351          f_4 = Some(val);
2352        },
2353        5 => {
2354          let val = Statistics::read_from_in_protocol(i_prot)?;
2355          f_5 = Some(val);
2356        },
2357        _ => {
2358          i_prot.skip(field_ident.field_type)?;
2359        },
2360      };
2361      i_prot.read_field_end()?;
2362    }
2363    i_prot.read_struct_end()?;
2364    verify_required_field_exists("DataPageHeader.num_values", &f_1)?;
2365    verify_required_field_exists("DataPageHeader.encoding", &f_2)?;
2366    verify_required_field_exists("DataPageHeader.definition_level_encoding", &f_3)?;
2367    verify_required_field_exists("DataPageHeader.repetition_level_encoding", &f_4)?;
2368    let ret = DataPageHeader {
2369      num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
2370      encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
2371      definition_level_encoding: f_3.expect("auto-generated code should have checked for presence of required fields"),
2372      repetition_level_encoding: f_4.expect("auto-generated code should have checked for presence of required fields"),
2373      statistics: f_5,
2374    };
2375    Ok(ret)
2376  }
2377  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2378    let struct_ident = TStructIdentifier::new("DataPageHeader");
2379    o_prot.write_struct_begin(&struct_ident)?;
2380    o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1))?;
2381    o_prot.write_i32(self.num_values)?;
2382    o_prot.write_field_end()?;
2383    o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2))?;
2384    self.encoding.write_to_out_protocol(o_prot)?;
2385    o_prot.write_field_end()?;
2386    o_prot.write_field_begin(&TFieldIdentifier::new("definition_level_encoding", TType::I32, 3))?;
2387    self.definition_level_encoding.write_to_out_protocol(o_prot)?;
2388    o_prot.write_field_end()?;
2389    o_prot.write_field_begin(&TFieldIdentifier::new("repetition_level_encoding", TType::I32, 4))?;
2390    self.repetition_level_encoding.write_to_out_protocol(o_prot)?;
2391    o_prot.write_field_end()?;
2392    if let Some(ref fld_var) = self.statistics {
2393      o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 5))?;
2394      fld_var.write_to_out_protocol(o_prot)?;
2395      o_prot.write_field_end()?
2396    }
2397    o_prot.write_field_stop()?;
2398    o_prot.write_struct_end()
2399  }
2400}
2401
2402//
2403// IndexPageHeader
2404//
2405
2406#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
2407pub struct IndexPageHeader {
2408}
2409
2410impl IndexPageHeader {
2411  pub fn new() -> IndexPageHeader {
2412    IndexPageHeader {}
2413  }
2414}
2415
2416impl crate::thrift::TSerializable for IndexPageHeader {
2417  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<IndexPageHeader> {
2418    i_prot.read_struct_begin()?;
2419    loop {
2420      let field_ident = i_prot.read_field_begin()?;
2421      if field_ident.field_type == TType::Stop {
2422        break;
2423      }
2424      i_prot.skip(field_ident.field_type)?;
2425      i_prot.read_field_end()?;
2426    }
2427    i_prot.read_struct_end()?;
2428    let ret = IndexPageHeader {};
2429    Ok(ret)
2430  }
2431  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2432    let struct_ident = TStructIdentifier::new("IndexPageHeader");
2433    o_prot.write_struct_begin(&struct_ident)?;
2434    o_prot.write_field_stop()?;
2435    o_prot.write_struct_end()
2436  }
2437}
2438
2439//
2440// DictionaryPageHeader
2441//
2442
2443/// The dictionary page must be placed at the first position of the column chunk
2444/// if it is partly or completely dictionary encoded. At most one dictionary page
2445/// can be placed in a column chunk.
2446/// 
2447#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2448pub struct DictionaryPageHeader {
2449  /// Number of values in the dictionary *
2450  pub num_values: i32,
2451  /// Encoding using this dictionary page *
2452  pub encoding: Encoding,
2453  /// If true, the entries in the dictionary are sorted in ascending order *
2454  pub is_sorted: Option<bool>,
2455}
2456
2457impl DictionaryPageHeader {
2458  pub fn new<F3>(num_values: i32, encoding: Encoding, is_sorted: F3) -> DictionaryPageHeader where F3: Into<Option<bool>> {
2459    DictionaryPageHeader {
2460      num_values,
2461      encoding,
2462      is_sorted: is_sorted.into(),
2463    }
2464  }
2465}
2466
2467impl crate::thrift::TSerializable for DictionaryPageHeader {
2468  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<DictionaryPageHeader> {
2469    i_prot.read_struct_begin()?;
2470    let mut f_1: Option<i32> = None;
2471    let mut f_2: Option<Encoding> = None;
2472    let mut f_3: Option<bool> = None;
2473    loop {
2474      let field_ident = i_prot.read_field_begin()?;
2475      if field_ident.field_type == TType::Stop {
2476        break;
2477      }
2478      let field_id = field_id(&field_ident)?;
2479      match field_id {
2480        1 => {
2481          let val = i_prot.read_i32()?;
2482          f_1 = Some(val);
2483        },
2484        2 => {
2485          let val = Encoding::read_from_in_protocol(i_prot)?;
2486          f_2 = Some(val);
2487        },
2488        3 => {
2489          let val = i_prot.read_bool()?;
2490          f_3 = Some(val);
2491        },
2492        _ => {
2493          i_prot.skip(field_ident.field_type)?;
2494        },
2495      };
2496      i_prot.read_field_end()?;
2497    }
2498    i_prot.read_struct_end()?;
2499    verify_required_field_exists("DictionaryPageHeader.num_values", &f_1)?;
2500    verify_required_field_exists("DictionaryPageHeader.encoding", &f_2)?;
2501    let ret = DictionaryPageHeader {
2502      num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
2503      encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
2504      is_sorted: f_3,
2505    };
2506    Ok(ret)
2507  }
2508  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2509    let struct_ident = TStructIdentifier::new("DictionaryPageHeader");
2510    o_prot.write_struct_begin(&struct_ident)?;
2511    o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1))?;
2512    o_prot.write_i32(self.num_values)?;
2513    o_prot.write_field_end()?;
2514    o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2))?;
2515    self.encoding.write_to_out_protocol(o_prot)?;
2516    o_prot.write_field_end()?;
2517    if let Some(fld_var) = self.is_sorted {
2518      o_prot.write_field_begin(&TFieldIdentifier::new("is_sorted", TType::Bool, 3))?;
2519      o_prot.write_bool(fld_var)?;
2520      o_prot.write_field_end()?
2521    }
2522    o_prot.write_field_stop()?;
2523    o_prot.write_struct_end()
2524  }
2525}
2526
2527//
2528// DataPageHeaderV2
2529//
2530
2531/// New page format allowing reading levels without decompressing the data
2532/// Repetition and definition levels are uncompressed
2533/// The remaining section containing the data is compressed if is_compressed is true
2534/// 
2535#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2536pub struct DataPageHeaderV2 {
2537  /// Number of values, including NULLs, in this data page. *
2538  pub num_values: i32,
2539  /// Number of NULL values, in this data page.
2540  /// Number of non-null = num_values - num_nulls which is also the number of values in the data section *
2541  pub num_nulls: i32,
2542  /// Number of rows in this data page. Every page must begin at a
2543  /// row boundary (repetition_level = 0): rows must **not** be
2544  /// split across page boundaries when using V2 data pages.
2545  /// 
2546  pub num_rows: i32,
2547  /// Encoding used for data in this page *
2548  pub encoding: Encoding,
2549  /// Length of the definition levels
2550  pub definition_levels_byte_length: i32,
2551  /// Length of the repetition levels
2552  pub repetition_levels_byte_length: i32,
2553  /// Whether the values are compressed.
2554  /// Which means the section of the page between
2555  /// definition_levels_byte_length + repetition_levels_byte_length + 1 and compressed_page_size (included)
2556  /// is compressed with the compression_codec.
2557  /// If missing it is considered compressed
2558  pub is_compressed: Option<bool>,
2559  /// Optional statistics for the data in this page *
2560  pub statistics: Option<Statistics>,
2561}
2562
2563impl DataPageHeaderV2 {
2564  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>> {
2565    DataPageHeaderV2 {
2566      num_values,
2567      num_nulls,
2568      num_rows,
2569      encoding,
2570      definition_levels_byte_length,
2571      repetition_levels_byte_length,
2572      is_compressed: is_compressed.into(),
2573      statistics: statistics.into(),
2574    }
2575  }
2576}
2577
2578impl crate::thrift::TSerializable for DataPageHeaderV2 {
2579  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<DataPageHeaderV2> {
2580    i_prot.read_struct_begin()?;
2581    let mut f_1: Option<i32> = None;
2582    let mut f_2: Option<i32> = None;
2583    let mut f_3: Option<i32> = None;
2584    let mut f_4: Option<Encoding> = None;
2585    let mut f_5: Option<i32> = None;
2586    let mut f_6: Option<i32> = None;
2587    let mut f_7: Option<bool> = None;
2588    let mut f_8: Option<Statistics> = None;
2589    loop {
2590      let field_ident = i_prot.read_field_begin()?;
2591      if field_ident.field_type == TType::Stop {
2592        break;
2593      }
2594      let field_id = field_id(&field_ident)?;
2595      match field_id {
2596        1 => {
2597          let val = i_prot.read_i32()?;
2598          f_1 = Some(val);
2599        },
2600        2 => {
2601          let val = i_prot.read_i32()?;
2602          f_2 = Some(val);
2603        },
2604        3 => {
2605          let val = i_prot.read_i32()?;
2606          f_3 = Some(val);
2607        },
2608        4 => {
2609          let val = Encoding::read_from_in_protocol(i_prot)?;
2610          f_4 = Some(val);
2611        },
2612        5 => {
2613          let val = i_prot.read_i32()?;
2614          f_5 = Some(val);
2615        },
2616        6 => {
2617          let val = i_prot.read_i32()?;
2618          f_6 = Some(val);
2619        },
2620        7 => {
2621          let val = i_prot.read_bool()?;
2622          f_7 = Some(val);
2623        },
2624        8 => {
2625          let val = Statistics::read_from_in_protocol(i_prot)?;
2626          f_8 = Some(val);
2627        },
2628        _ => {
2629          i_prot.skip(field_ident.field_type)?;
2630        },
2631      };
2632      i_prot.read_field_end()?;
2633    }
2634    i_prot.read_struct_end()?;
2635    verify_required_field_exists("DataPageHeaderV2.num_values", &f_1)?;
2636    verify_required_field_exists("DataPageHeaderV2.num_nulls", &f_2)?;
2637    verify_required_field_exists("DataPageHeaderV2.num_rows", &f_3)?;
2638    verify_required_field_exists("DataPageHeaderV2.encoding", &f_4)?;
2639    verify_required_field_exists("DataPageHeaderV2.definition_levels_byte_length", &f_5)?;
2640    verify_required_field_exists("DataPageHeaderV2.repetition_levels_byte_length", &f_6)?;
2641    let ret = DataPageHeaderV2 {
2642      num_values: f_1.expect("auto-generated code should have checked for presence of required fields"),
2643      num_nulls: f_2.expect("auto-generated code should have checked for presence of required fields"),
2644      num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
2645      encoding: f_4.expect("auto-generated code should have checked for presence of required fields"),
2646      definition_levels_byte_length: f_5.expect("auto-generated code should have checked for presence of required fields"),
2647      repetition_levels_byte_length: f_6.expect("auto-generated code should have checked for presence of required fields"),
2648      is_compressed: f_7,
2649      statistics: f_8,
2650    };
2651    Ok(ret)
2652  }
2653  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2654    let struct_ident = TStructIdentifier::new("DataPageHeaderV2");
2655    o_prot.write_struct_begin(&struct_ident)?;
2656    o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I32, 1))?;
2657    o_prot.write_i32(self.num_values)?;
2658    o_prot.write_field_end()?;
2659    o_prot.write_field_begin(&TFieldIdentifier::new("num_nulls", TType::I32, 2))?;
2660    o_prot.write_i32(self.num_nulls)?;
2661    o_prot.write_field_end()?;
2662    o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I32, 3))?;
2663    o_prot.write_i32(self.num_rows)?;
2664    o_prot.write_field_end()?;
2665    o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 4))?;
2666    self.encoding.write_to_out_protocol(o_prot)?;
2667    o_prot.write_field_end()?;
2668    o_prot.write_field_begin(&TFieldIdentifier::new("definition_levels_byte_length", TType::I32, 5))?;
2669    o_prot.write_i32(self.definition_levels_byte_length)?;
2670    o_prot.write_field_end()?;
2671    o_prot.write_field_begin(&TFieldIdentifier::new("repetition_levels_byte_length", TType::I32, 6))?;
2672    o_prot.write_i32(self.repetition_levels_byte_length)?;
2673    o_prot.write_field_end()?;
2674    if let Some(fld_var) = self.is_compressed {
2675      o_prot.write_field_begin(&TFieldIdentifier::new("is_compressed", TType::Bool, 7))?;
2676      o_prot.write_bool(fld_var)?;
2677      o_prot.write_field_end()?
2678    }
2679    if let Some(ref fld_var) = self.statistics {
2680      o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 8))?;
2681      fld_var.write_to_out_protocol(o_prot)?;
2682      o_prot.write_field_end()?
2683    }
2684    o_prot.write_field_stop()?;
2685    o_prot.write_struct_end()
2686  }
2687}
2688
2689//
2690// SplitBlockAlgorithm
2691//
2692
2693/// Block-based algorithm type annotation. *
2694#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
2695pub struct SplitBlockAlgorithm {
2696}
2697
2698impl SplitBlockAlgorithm {
2699  pub fn new() -> SplitBlockAlgorithm {
2700    SplitBlockAlgorithm {}
2701  }
2702}
2703
2704impl crate::thrift::TSerializable for SplitBlockAlgorithm {
2705  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<SplitBlockAlgorithm> {
2706    i_prot.read_struct_begin()?;
2707    loop {
2708      let field_ident = i_prot.read_field_begin()?;
2709      if field_ident.field_type == TType::Stop {
2710        break;
2711      }
2712      i_prot.skip(field_ident.field_type)?;
2713      i_prot.read_field_end()?;
2714    }
2715    i_prot.read_struct_end()?;
2716    let ret = SplitBlockAlgorithm {};
2717    Ok(ret)
2718  }
2719  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2720    let struct_ident = TStructIdentifier::new("SplitBlockAlgorithm");
2721    o_prot.write_struct_begin(&struct_ident)?;
2722    o_prot.write_field_stop()?;
2723    o_prot.write_struct_end()
2724  }
2725}
2726
2727//
2728// BloomFilterAlgorithm
2729//
2730
2731#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2732pub enum BloomFilterAlgorithm {
2733  BLOCK(SplitBlockAlgorithm),
2734}
2735
2736impl crate::thrift::TSerializable for BloomFilterAlgorithm {
2737  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterAlgorithm> {
2738    let mut ret: Option<BloomFilterAlgorithm> = None;
2739    let mut received_field_count = 0;
2740    i_prot.read_struct_begin()?;
2741    loop {
2742      let field_ident = i_prot.read_field_begin()?;
2743      if field_ident.field_type == TType::Stop {
2744        break;
2745      }
2746      let field_id = field_id(&field_ident)?;
2747      match field_id {
2748        1 => {
2749          let val = SplitBlockAlgorithm::read_from_in_protocol(i_prot)?;
2750          if ret.is_none() {
2751            ret = Some(BloomFilterAlgorithm::BLOCK(val));
2752          }
2753          received_field_count += 1;
2754        },
2755        _ => {
2756          i_prot.skip(field_ident.field_type)?;
2757          received_field_count += 1;
2758        },
2759      };
2760      i_prot.read_field_end()?;
2761    }
2762    i_prot.read_struct_end()?;
2763    if received_field_count == 0 {
2764      Err(
2765        thrift::Error::Protocol(
2766          ProtocolError::new(
2767            ProtocolErrorKind::InvalidData,
2768            "received empty union from remote BloomFilterAlgorithm"
2769          )
2770        )
2771      )
2772    } else if received_field_count > 1 {
2773      Err(
2774        thrift::Error::Protocol(
2775          ProtocolError::new(
2776            ProtocolErrorKind::InvalidData,
2777            "received multiple fields for union from remote BloomFilterAlgorithm"
2778          )
2779        )
2780      )
2781    } else {
2782      ret.ok_or_else(|| thrift::Error::Protocol(ProtocolError::new(ProtocolErrorKind::InvalidData, "return value should have been constructed")))
2783    }
2784  }
2785  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2786    let struct_ident = TStructIdentifier::new("BloomFilterAlgorithm");
2787    o_prot.write_struct_begin(&struct_ident)?;
2788    match *self {
2789      BloomFilterAlgorithm::BLOCK(ref f) => {
2790        o_prot.write_field_begin(&TFieldIdentifier::new("BLOCK", TType::Struct, 1))?;
2791        f.write_to_out_protocol(o_prot)?;
2792        o_prot.write_field_end()?;
2793      },
2794    }
2795    o_prot.write_field_stop()?;
2796    o_prot.write_struct_end()
2797  }
2798}
2799
2800//
2801// XxHash
2802//
2803
2804/// Hash strategy type annotation. xxHash is an extremely fast non-cryptographic hash
2805/// algorithm. It uses 64 bits version of xxHash.
2806/// 
2807#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
2808pub struct XxHash {
2809}
2810
2811impl XxHash {
2812  pub fn new() -> XxHash {
2813    XxHash {}
2814  }
2815}
2816
2817impl crate::thrift::TSerializable for XxHash {
2818  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<XxHash> {
2819    i_prot.read_struct_begin()?;
2820    loop {
2821      let field_ident = i_prot.read_field_begin()?;
2822      if field_ident.field_type == TType::Stop {
2823        break;
2824      }
2825      i_prot.skip(field_ident.field_type)?;
2826      i_prot.read_field_end()?;
2827    }
2828    i_prot.read_struct_end()?;
2829    let ret = XxHash {};
2830    Ok(ret)
2831  }
2832  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2833    let struct_ident = TStructIdentifier::new("XxHash");
2834    o_prot.write_struct_begin(&struct_ident)?;
2835    o_prot.write_field_stop()?;
2836    o_prot.write_struct_end()
2837  }
2838}
2839
2840//
2841// BloomFilterHash
2842//
2843
2844#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2845pub enum BloomFilterHash {
2846  XXHASH(XxHash),
2847}
2848
2849impl crate::thrift::TSerializable for BloomFilterHash {
2850  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterHash> {
2851    let mut ret: Option<BloomFilterHash> = None;
2852    let mut received_field_count = 0;
2853    i_prot.read_struct_begin()?;
2854    loop {
2855      let field_ident = i_prot.read_field_begin()?;
2856      if field_ident.field_type == TType::Stop {
2857        break;
2858      }
2859      let field_id = field_id(&field_ident)?;
2860      match field_id {
2861        1 => {
2862          let val = XxHash::read_from_in_protocol(i_prot)?;
2863          if ret.is_none() {
2864            ret = Some(BloomFilterHash::XXHASH(val));
2865          }
2866          received_field_count += 1;
2867        },
2868        _ => {
2869          i_prot.skip(field_ident.field_type)?;
2870          received_field_count += 1;
2871        },
2872      };
2873      i_prot.read_field_end()?;
2874    }
2875    i_prot.read_struct_end()?;
2876    if received_field_count == 0 {
2877      Err(
2878        thrift::Error::Protocol(
2879          ProtocolError::new(
2880            ProtocolErrorKind::InvalidData,
2881            "received empty union from remote BloomFilterHash"
2882          )
2883        )
2884      )
2885    } else if received_field_count > 1 {
2886      Err(
2887        thrift::Error::Protocol(
2888          ProtocolError::new(
2889            ProtocolErrorKind::InvalidData,
2890            "received multiple fields for union from remote BloomFilterHash"
2891          )
2892        )
2893      )
2894    } else {
2895      ret.ok_or_else(|| thrift::Error::Protocol(ProtocolError::new(ProtocolErrorKind::InvalidData, "return value should have been constructed")))
2896    }
2897  }
2898  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2899    let struct_ident = TStructIdentifier::new("BloomFilterHash");
2900    o_prot.write_struct_begin(&struct_ident)?;
2901    match *self {
2902      BloomFilterHash::XXHASH(ref f) => {
2903        o_prot.write_field_begin(&TFieldIdentifier::new("XXHASH", TType::Struct, 1))?;
2904        f.write_to_out_protocol(o_prot)?;
2905        o_prot.write_field_end()?;
2906      },
2907    }
2908    o_prot.write_field_stop()?;
2909    o_prot.write_struct_end()
2910  }
2911}
2912
2913//
2914// Uncompressed
2915//
2916
2917/// The compression used in the Bloom filter.
2918/// 
2919#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
2920pub struct Uncompressed {
2921}
2922
2923impl Uncompressed {
2924  pub fn new() -> Uncompressed {
2925    Uncompressed {}
2926  }
2927}
2928
2929impl crate::thrift::TSerializable for Uncompressed {
2930  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<Uncompressed> {
2931    i_prot.read_struct_begin()?;
2932    loop {
2933      let field_ident = i_prot.read_field_begin()?;
2934      if field_ident.field_type == TType::Stop {
2935        break;
2936      }
2937      i_prot.skip(field_ident.field_type)?;
2938      i_prot.read_field_end()?;
2939    }
2940    i_prot.read_struct_end()?;
2941    let ret = Uncompressed {};
2942    Ok(ret)
2943  }
2944  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
2945    let struct_ident = TStructIdentifier::new("Uncompressed");
2946    o_prot.write_struct_begin(&struct_ident)?;
2947    o_prot.write_field_stop()?;
2948    o_prot.write_struct_end()
2949  }
2950}
2951
2952//
2953// BloomFilterCompression
2954//
2955
2956#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
2957pub enum BloomFilterCompression {
2958  UNCOMPRESSED(Uncompressed),
2959}
2960
2961impl crate::thrift::TSerializable for BloomFilterCompression {
2962  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterCompression> {
2963    let mut ret: Option<BloomFilterCompression> = None;
2964    let mut received_field_count = 0;
2965    i_prot.read_struct_begin()?;
2966    loop {
2967      let field_ident = i_prot.read_field_begin()?;
2968      if field_ident.field_type == TType::Stop {
2969        break;
2970      }
2971      let field_id = field_id(&field_ident)?;
2972      match field_id {
2973        1 => {
2974          let val = Uncompressed::read_from_in_protocol(i_prot)?;
2975          if ret.is_none() {
2976            ret = Some(BloomFilterCompression::UNCOMPRESSED(val));
2977          }
2978          received_field_count += 1;
2979        },
2980        _ => {
2981          i_prot.skip(field_ident.field_type)?;
2982          received_field_count += 1;
2983        },
2984      };
2985      i_prot.read_field_end()?;
2986    }
2987    i_prot.read_struct_end()?;
2988    if received_field_count == 0 {
2989      Err(
2990        thrift::Error::Protocol(
2991          ProtocolError::new(
2992            ProtocolErrorKind::InvalidData,
2993            "received empty union from remote BloomFilterCompression"
2994          )
2995        )
2996      )
2997    } else if received_field_count > 1 {
2998      Err(
2999        thrift::Error::Protocol(
3000          ProtocolError::new(
3001            ProtocolErrorKind::InvalidData,
3002            "received multiple fields for union from remote BloomFilterCompression"
3003          )
3004        )
3005      )
3006    } else {
3007      ret.ok_or_else(|| thrift::Error::Protocol(ProtocolError::new(ProtocolErrorKind::InvalidData, "return value should have been constructed")))
3008    }
3009  }
3010  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
3011    let struct_ident = TStructIdentifier::new("BloomFilterCompression");
3012    o_prot.write_struct_begin(&struct_ident)?;
3013    match *self {
3014      BloomFilterCompression::UNCOMPRESSED(ref f) => {
3015        o_prot.write_field_begin(&TFieldIdentifier::new("UNCOMPRESSED", TType::Struct, 1))?;
3016        f.write_to_out_protocol(o_prot)?;
3017        o_prot.write_field_end()?;
3018      },
3019    }
3020    o_prot.write_field_stop()?;
3021    o_prot.write_struct_end()
3022  }
3023}
3024
3025//
3026// BloomFilterHeader
3027//
3028
3029/// Bloom filter header is stored at beginning of Bloom filter data of each column
3030/// and followed by its bitset.
3031/// 
3032#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3033pub struct BloomFilterHeader {
3034  /// The size of bitset in bytes *
3035  pub num_bytes: i32,
3036  /// The algorithm for setting bits. *
3037  pub algorithm: BloomFilterAlgorithm,
3038  /// The hash function used for Bloom filter. *
3039  pub hash: BloomFilterHash,
3040  /// The compression used in the Bloom filter *
3041  pub compression: BloomFilterCompression,
3042}
3043
3044impl BloomFilterHeader {
3045  pub fn new(num_bytes: i32, algorithm: BloomFilterAlgorithm, hash: BloomFilterHash, compression: BloomFilterCompression) -> BloomFilterHeader {
3046    BloomFilterHeader {
3047      num_bytes,
3048      algorithm,
3049      hash,
3050      compression,
3051    }
3052  }
3053}
3054
3055impl crate::thrift::TSerializable for BloomFilterHeader {
3056  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<BloomFilterHeader> {
3057    i_prot.read_struct_begin()?;
3058    let mut f_1: Option<i32> = None;
3059    let mut f_2: Option<BloomFilterAlgorithm> = None;
3060    let mut f_3: Option<BloomFilterHash> = None;
3061    let mut f_4: Option<BloomFilterCompression> = None;
3062    loop {
3063      let field_ident = i_prot.read_field_begin()?;
3064      if field_ident.field_type == TType::Stop {
3065        break;
3066      }
3067      let field_id = field_id(&field_ident)?;
3068      match field_id {
3069        1 => {
3070          let val = i_prot.read_i32()?;
3071          f_1 = Some(val);
3072        },
3073        2 => {
3074          let val = BloomFilterAlgorithm::read_from_in_protocol(i_prot)?;
3075          f_2 = Some(val);
3076        },
3077        3 => {
3078          let val = BloomFilterHash::read_from_in_protocol(i_prot)?;
3079          f_3 = Some(val);
3080        },
3081        4 => {
3082          let val = BloomFilterCompression::read_from_in_protocol(i_prot)?;
3083          f_4 = Some(val);
3084        },
3085        _ => {
3086          i_prot.skip(field_ident.field_type)?;
3087        },
3088      };
3089      i_prot.read_field_end()?;
3090    }
3091    i_prot.read_struct_end()?;
3092    verify_required_field_exists("BloomFilterHeader.num_bytes", &f_1)?;
3093    verify_required_field_exists("BloomFilterHeader.algorithm", &f_2)?;
3094    verify_required_field_exists("BloomFilterHeader.hash", &f_3)?;
3095    verify_required_field_exists("BloomFilterHeader.compression", &f_4)?;
3096    let ret = BloomFilterHeader {
3097      num_bytes: f_1.expect("auto-generated code should have checked for presence of required fields"),
3098      algorithm: f_2.expect("auto-generated code should have checked for presence of required fields"),
3099      hash: f_3.expect("auto-generated code should have checked for presence of required fields"),
3100      compression: f_4.expect("auto-generated code should have checked for presence of required fields"),
3101    };
3102    Ok(ret)
3103  }
3104  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
3105    let struct_ident = TStructIdentifier::new("BloomFilterHeader");
3106    o_prot.write_struct_begin(&struct_ident)?;
3107    o_prot.write_field_begin(&TFieldIdentifier::new("numBytes", TType::I32, 1))?;
3108    o_prot.write_i32(self.num_bytes)?;
3109    o_prot.write_field_end()?;
3110    o_prot.write_field_begin(&TFieldIdentifier::new("algorithm", TType::Struct, 2))?;
3111    self.algorithm.write_to_out_protocol(o_prot)?;
3112    o_prot.write_field_end()?;
3113    o_prot.write_field_begin(&TFieldIdentifier::new("hash", TType::Struct, 3))?;
3114    self.hash.write_to_out_protocol(o_prot)?;
3115    o_prot.write_field_end()?;
3116    o_prot.write_field_begin(&TFieldIdentifier::new("compression", TType::Struct, 4))?;
3117    self.compression.write_to_out_protocol(o_prot)?;
3118    o_prot.write_field_end()?;
3119    o_prot.write_field_stop()?;
3120    o_prot.write_struct_end()
3121  }
3122}
3123
3124//
3125// PageHeader
3126//
3127
3128#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3129pub struct PageHeader {
3130  /// the type of the page: indicates which of the *_header fields is set *
3131  pub type_: PageType,
3132  /// Uncompressed page size in bytes (not including this header) *
3133  pub uncompressed_page_size: i32,
3134  /// Compressed (and potentially encrypted) page size in bytes, not including this header *
3135  pub compressed_page_size: i32,
3136  /// The 32-bit CRC checksum for the page, to be be calculated as follows:
3137  /// 
3138  /// - The standard CRC32 algorithm is used (with polynomial 0x04C11DB7,
3139  ///   the same as in e.g. GZip).
3140  /// - All page types can have a CRC (v1 and v2 data pages, dictionary pages,
3141  ///   etc.).
3142  /// - The CRC is computed on the serialization binary representation of the page
3143  ///   (as written to disk), excluding the page header. For example, for v1
3144  ///   data pages, the CRC is computed on the concatenation of repetition levels,
3145  ///   definition levels and column values (optionally compressed, optionally
3146  ///   encrypted).
3147  /// - The CRC computation therefore takes place after any compression
3148  ///   and encryption steps, if any.
3149  /// 
3150  /// If enabled, this allows for disabling checksumming in HDFS if only a few
3151  /// pages need to be read.
3152  pub crc: Option<i32>,
3153  pub data_page_header: Option<DataPageHeader>,
3154  pub index_page_header: Option<IndexPageHeader>,
3155  pub dictionary_page_header: Option<DictionaryPageHeader>,
3156  pub data_page_header_v2: Option<DataPageHeaderV2>,
3157}
3158
3159impl PageHeader {
3160  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>> {
3161    PageHeader {
3162      type_,
3163      uncompressed_page_size,
3164      compressed_page_size,
3165      crc: crc.into(),
3166      data_page_header: data_page_header.into(),
3167      index_page_header: index_page_header.into(),
3168      dictionary_page_header: dictionary_page_header.into(),
3169      data_page_header_v2: data_page_header_v2.into(),
3170    }
3171  }
3172}
3173
3174impl crate::thrift::TSerializable for PageHeader {
3175  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<PageHeader> {
3176    i_prot.read_struct_begin()?;
3177    let mut f_1: Option<PageType> = None;
3178    let mut f_2: Option<i32> = None;
3179    let mut f_3: Option<i32> = None;
3180    let mut f_4: Option<i32> = None;
3181    let mut f_5: Option<DataPageHeader> = None;
3182    let mut f_6: Option<IndexPageHeader> = None;
3183    let mut f_7: Option<DictionaryPageHeader> = None;
3184    let mut f_8: Option<DataPageHeaderV2> = None;
3185    loop {
3186      let field_ident = i_prot.read_field_begin()?;
3187      if field_ident.field_type == TType::Stop {
3188        break;
3189      }
3190      let field_id = field_id(&field_ident)?;
3191      match field_id {
3192        1 => {
3193          let val = PageType::read_from_in_protocol(i_prot)?;
3194          f_1 = Some(val);
3195        },
3196        2 => {
3197          let val = i_prot.read_i32()?;
3198          f_2 = Some(val);
3199        },
3200        3 => {
3201          let val = i_prot.read_i32()?;
3202          f_3 = Some(val);
3203        },
3204        4 => {
3205          let val = i_prot.read_i32()?;
3206          f_4 = Some(val);
3207        },
3208        5 => {
3209          let val = DataPageHeader::read_from_in_protocol(i_prot)?;
3210          f_5 = Some(val);
3211        },
3212        6 => {
3213          let val = IndexPageHeader::read_from_in_protocol(i_prot)?;
3214          f_6 = Some(val);
3215        },
3216        7 => {
3217          let val = DictionaryPageHeader::read_from_in_protocol(i_prot)?;
3218          f_7 = Some(val);
3219        },
3220        8 => {
3221          let val = DataPageHeaderV2::read_from_in_protocol(i_prot)?;
3222          f_8 = Some(val);
3223        },
3224        _ => {
3225          i_prot.skip(field_ident.field_type)?;
3226        },
3227      };
3228      i_prot.read_field_end()?;
3229    }
3230    i_prot.read_struct_end()?;
3231    verify_required_field_exists("PageHeader.type_", &f_1)?;
3232    verify_required_field_exists("PageHeader.uncompressed_page_size", &f_2)?;
3233    verify_required_field_exists("PageHeader.compressed_page_size", &f_3)?;
3234    let ret = PageHeader {
3235      type_: f_1.expect("auto-generated code should have checked for presence of required fields"),
3236      uncompressed_page_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
3237      compressed_page_size: f_3.expect("auto-generated code should have checked for presence of required fields"),
3238      crc: f_4,
3239      data_page_header: f_5,
3240      index_page_header: f_6,
3241      dictionary_page_header: f_7,
3242      data_page_header_v2: f_8,
3243    };
3244    Ok(ret)
3245  }
3246  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
3247    let struct_ident = TStructIdentifier::new("PageHeader");
3248    o_prot.write_struct_begin(&struct_ident)?;
3249    o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1))?;
3250    self.type_.write_to_out_protocol(o_prot)?;
3251    o_prot.write_field_end()?;
3252    o_prot.write_field_begin(&TFieldIdentifier::new("uncompressed_page_size", TType::I32, 2))?;
3253    o_prot.write_i32(self.uncompressed_page_size)?;
3254    o_prot.write_field_end()?;
3255    o_prot.write_field_begin(&TFieldIdentifier::new("compressed_page_size", TType::I32, 3))?;
3256    o_prot.write_i32(self.compressed_page_size)?;
3257    o_prot.write_field_end()?;
3258    if let Some(fld_var) = self.crc {
3259      o_prot.write_field_begin(&TFieldIdentifier::new("crc", TType::I32, 4))?;
3260      o_prot.write_i32(fld_var)?;
3261      o_prot.write_field_end()?
3262    }
3263    if let Some(ref fld_var) = self.data_page_header {
3264      o_prot.write_field_begin(&TFieldIdentifier::new("data_page_header", TType::Struct, 5))?;
3265      fld_var.write_to_out_protocol(o_prot)?;
3266      o_prot.write_field_end()?
3267    }
3268    if let Some(ref fld_var) = self.index_page_header {
3269      o_prot.write_field_begin(&TFieldIdentifier::new("index_page_header", TType::Struct, 6))?;
3270      fld_var.write_to_out_protocol(o_prot)?;
3271      o_prot.write_field_end()?
3272    }
3273    if let Some(ref fld_var) = self.dictionary_page_header {
3274      o_prot.write_field_begin(&TFieldIdentifier::new("dictionary_page_header", TType::Struct, 7))?;
3275      fld_var.write_to_out_protocol(o_prot)?;
3276      o_prot.write_field_end()?
3277    }
3278    if let Some(ref fld_var) = self.data_page_header_v2 {
3279      o_prot.write_field_begin(&TFieldIdentifier::new("data_page_header_v2", TType::Struct, 8))?;
3280      fld_var.write_to_out_protocol(o_prot)?;
3281      o_prot.write_field_end()?
3282    }
3283    o_prot.write_field_stop()?;
3284    o_prot.write_struct_end()
3285  }
3286}
3287
3288//
3289// KeyValue
3290//
3291
3292/// Wrapper struct to store key values
3293#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3294pub struct KeyValue {
3295  pub key: String,
3296  pub value: Option<String>,
3297}
3298
3299impl KeyValue {
3300  pub fn new<F2>(key: String, value: F2) -> KeyValue where F2: Into<Option<String>> {
3301    KeyValue {
3302      key,
3303      value: value.into(),
3304    }
3305  }
3306}
3307
3308impl crate::thrift::TSerializable for KeyValue {
3309  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<KeyValue> {
3310    i_prot.read_struct_begin()?;
3311    let mut f_1: Option<String> = None;
3312    let mut f_2: Option<String> = None;
3313    loop {
3314      let field_ident = i_prot.read_field_begin()?;
3315      if field_ident.field_type == TType::Stop {
3316        break;
3317      }
3318      let field_id = field_id(&field_ident)?;
3319      match field_id {
3320        1 => {
3321          let val = i_prot.read_string()?;
3322          f_1 = Some(val);
3323        },
3324        2 => {
3325          let val = i_prot.read_string()?;
3326          f_2 = Some(val);
3327        },
3328        _ => {
3329          i_prot.skip(field_ident.field_type)?;
3330        },
3331      };
3332      i_prot.read_field_end()?;
3333    }
3334    i_prot.read_struct_end()?;
3335    verify_required_field_exists("KeyValue.key", &f_1)?;
3336    let ret = KeyValue {
3337      key: f_1.expect("auto-generated code should have checked for presence of required fields"),
3338      value: f_2,
3339    };
3340    Ok(ret)
3341  }
3342  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
3343    let struct_ident = TStructIdentifier::new("KeyValue");
3344    o_prot.write_struct_begin(&struct_ident)?;
3345    o_prot.write_field_begin(&TFieldIdentifier::new("key", TType::String, 1))?;
3346    o_prot.write_string(&self.key)?;
3347    o_prot.write_field_end()?;
3348    if let Some(ref fld_var) = self.value {
3349      o_prot.write_field_begin(&TFieldIdentifier::new("value", TType::String, 2))?;
3350      o_prot.write_string(fld_var)?;
3351      o_prot.write_field_end()?
3352    }
3353    o_prot.write_field_stop()?;
3354    o_prot.write_struct_end()
3355  }
3356}
3357
3358//
3359// SortingColumn
3360//
3361
3362/// Sort order within a RowGroup of a leaf column
3363#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3364pub struct SortingColumn {
3365  /// The ordinal position of the column (in this row group) *
3366  pub column_idx: i32,
3367  /// If true, indicates this column is sorted in descending order. *
3368  pub descending: bool,
3369  /// If true, nulls will come before non-null values, otherwise,
3370  /// nulls go at the end.
3371  pub nulls_first: bool,
3372}
3373
3374impl SortingColumn {
3375  pub fn new(column_idx: i32, descending: bool, nulls_first: bool) -> SortingColumn {
3376    SortingColumn {
3377      column_idx,
3378      descending,
3379      nulls_first,
3380    }
3381  }
3382}
3383
3384impl crate::thrift::TSerializable for SortingColumn {
3385  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<SortingColumn> {
3386    i_prot.read_struct_begin()?;
3387    let mut f_1: Option<i32> = None;
3388    let mut f_2: Option<bool> = None;
3389    let mut f_3: Option<bool> = None;
3390    loop {
3391      let field_ident = i_prot.read_field_begin()?;
3392      if field_ident.field_type == TType::Stop {
3393        break;
3394      }
3395      let field_id = field_id(&field_ident)?;
3396      match field_id {
3397        1 => {
3398          let val = i_prot.read_i32()?;
3399          f_1 = Some(val);
3400        },
3401        2 => {
3402          let val = i_prot.read_bool()?;
3403          f_2 = Some(val);
3404        },
3405        3 => {
3406          let val = i_prot.read_bool()?;
3407          f_3 = Some(val);
3408        },
3409        _ => {
3410          i_prot.skip(field_ident.field_type)?;
3411        },
3412      };
3413      i_prot.read_field_end()?;
3414    }
3415    i_prot.read_struct_end()?;
3416    verify_required_field_exists("SortingColumn.column_idx", &f_1)?;
3417    verify_required_field_exists("SortingColumn.descending", &f_2)?;
3418    verify_required_field_exists("SortingColumn.nulls_first", &f_3)?;
3419    let ret = SortingColumn {
3420      column_idx: f_1.expect("auto-generated code should have checked for presence of required fields"),
3421      descending: f_2.expect("auto-generated code should have checked for presence of required fields"),
3422      nulls_first: f_3.expect("auto-generated code should have checked for presence of required fields"),
3423    };
3424    Ok(ret)
3425  }
3426  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
3427    let struct_ident = TStructIdentifier::new("SortingColumn");
3428    o_prot.write_struct_begin(&struct_ident)?;
3429    o_prot.write_field_begin(&TFieldIdentifier::new("column_idx", TType::I32, 1))?;
3430    o_prot.write_i32(self.column_idx)?;
3431    o_prot.write_field_end()?;
3432    o_prot.write_field_begin(&TFieldIdentifier::new("descending", TType::Bool, 2))?;
3433    o_prot.write_bool(self.descending)?;
3434    o_prot.write_field_end()?;
3435    o_prot.write_field_begin(&TFieldIdentifier::new("nulls_first", TType::Bool, 3))?;
3436    o_prot.write_bool(self.nulls_first)?;
3437    o_prot.write_field_end()?;
3438    o_prot.write_field_stop()?;
3439    o_prot.write_struct_end()
3440  }
3441}
3442
3443//
3444// PageEncodingStats
3445//
3446
3447/// statistics of a given page type and encoding
3448#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3449pub struct PageEncodingStats {
3450  /// the page type (data/dic/...) *
3451  pub page_type: PageType,
3452  /// encoding of the page *
3453  pub encoding: Encoding,
3454  /// number of pages of this type with this encoding *
3455  pub count: i32,
3456}
3457
3458impl PageEncodingStats {
3459  pub fn new(page_type: PageType, encoding: Encoding, count: i32) -> PageEncodingStats {
3460    PageEncodingStats {
3461      page_type,
3462      encoding,
3463      count,
3464    }
3465  }
3466}
3467
3468impl crate::thrift::TSerializable for PageEncodingStats {
3469  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<PageEncodingStats> {
3470    i_prot.read_struct_begin()?;
3471    let mut f_1: Option<PageType> = None;
3472    let mut f_2: Option<Encoding> = None;
3473    let mut f_3: Option<i32> = None;
3474    loop {
3475      let field_ident = i_prot.read_field_begin()?;
3476      if field_ident.field_type == TType::Stop {
3477        break;
3478      }
3479      let field_id = field_id(&field_ident)?;
3480      match field_id {
3481        1 => {
3482          let val = PageType::read_from_in_protocol(i_prot)?;
3483          f_1 = Some(val);
3484        },
3485        2 => {
3486          let val = Encoding::read_from_in_protocol(i_prot)?;
3487          f_2 = Some(val);
3488        },
3489        3 => {
3490          let val = i_prot.read_i32()?;
3491          f_3 = Some(val);
3492        },
3493        _ => {
3494          i_prot.skip(field_ident.field_type)?;
3495        },
3496      };
3497      i_prot.read_field_end()?;
3498    }
3499    i_prot.read_struct_end()?;
3500    verify_required_field_exists("PageEncodingStats.page_type", &f_1)?;
3501    verify_required_field_exists("PageEncodingStats.encoding", &f_2)?;
3502    verify_required_field_exists("PageEncodingStats.count", &f_3)?;
3503    let ret = PageEncodingStats {
3504      page_type: f_1.expect("auto-generated code should have checked for presence of required fields"),
3505      encoding: f_2.expect("auto-generated code should have checked for presence of required fields"),
3506      count: f_3.expect("auto-generated code should have checked for presence of required fields"),
3507    };
3508    Ok(ret)
3509  }
3510  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
3511    let struct_ident = TStructIdentifier::new("PageEncodingStats");
3512    o_prot.write_struct_begin(&struct_ident)?;
3513    o_prot.write_field_begin(&TFieldIdentifier::new("page_type", TType::I32, 1))?;
3514    self.page_type.write_to_out_protocol(o_prot)?;
3515    o_prot.write_field_end()?;
3516    o_prot.write_field_begin(&TFieldIdentifier::new("encoding", TType::I32, 2))?;
3517    self.encoding.write_to_out_protocol(o_prot)?;
3518    o_prot.write_field_end()?;
3519    o_prot.write_field_begin(&TFieldIdentifier::new("count", TType::I32, 3))?;
3520    o_prot.write_i32(self.count)?;
3521    o_prot.write_field_end()?;
3522    o_prot.write_field_stop()?;
3523    o_prot.write_struct_end()
3524  }
3525}
3526
3527//
3528// ColumnMetaData
3529//
3530
3531/// Description for column metadata
3532#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3533pub struct ColumnMetaData {
3534  /// Type of this column *
3535  pub type_: Type,
3536  /// Set of all encodings used for this column. The purpose is to validate
3537  /// whether we can decode those pages. *
3538  pub encodings: Vec<Encoding>,
3539  /// Path in schema *
3540  pub path_in_schema: Vec<String>,
3541  /// Compression codec *
3542  pub codec: CompressionCodec,
3543  /// Number of values in this column *
3544  pub num_values: i64,
3545  /// total byte size of all uncompressed pages in this column chunk (including the headers) *
3546  pub total_uncompressed_size: i64,
3547  /// total byte size of all compressed, and potentially encrypted, pages
3548  /// in this column chunk (including the headers) *
3549  pub total_compressed_size: i64,
3550  /// Optional key/value metadata *
3551  pub key_value_metadata: Option<Vec<KeyValue>>,
3552  /// Byte offset from beginning of file to first data page *
3553  pub data_page_offset: i64,
3554  /// Byte offset from beginning of file to root index page *
3555  pub index_page_offset: Option<i64>,
3556  /// Byte offset from the beginning of file to first (only) dictionary page *
3557  pub dictionary_page_offset: Option<i64>,
3558  /// optional statistics for this column chunk
3559  pub statistics: Option<Statistics>,
3560  /// Set of all encodings used for pages in this column chunk.
3561  /// This information can be used to determine if all data pages are
3562  /// dictionary encoded for example *
3563  pub encoding_stats: Option<Vec<PageEncodingStats>>,
3564  /// Byte offset from beginning of file to Bloom filter data. *
3565  pub bloom_filter_offset: Option<i64>,
3566  /// Size of Bloom filter data including the serialized header, in bytes.
3567  /// Added in 2.10 so readers may not read this field from old files and
3568  /// it can be obtained after the BloomFilterHeader has been deserialized.
3569  /// Writers should write this field so readers can read the bloom filter
3570  /// in a single I/O.
3571  pub bloom_filter_length: Option<i32>,
3572  /// Optional statistics to help estimate total memory when converted to in-memory
3573  /// representations. The histograms contained in these statistics can
3574  /// also be useful in some cases for more fine-grained nullability/list length
3575  /// filter pushdown.
3576  pub size_statistics: Option<SizeStatistics>,
3577}
3578
3579impl ColumnMetaData {
3580  pub fn new<F8, F10, F11, F12, F13, F14, F15, F16>(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, bloom_filter_length: F15, size_statistics: F16) -> 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>>, F15: Into<Option<i32>>, F16: Into<Option<SizeStatistics>> {
3581    ColumnMetaData {
3582      type_,
3583      encodings,
3584      path_in_schema,
3585      codec,
3586      num_values,
3587      total_uncompressed_size,
3588      total_compressed_size,
3589      key_value_metadata: key_value_metadata.into(),
3590      data_page_offset,
3591      index_page_offset: index_page_offset.into(),
3592      dictionary_page_offset: dictionary_page_offset.into(),
3593      statistics: statistics.into(),
3594      encoding_stats: encoding_stats.into(),
3595      bloom_filter_offset: bloom_filter_offset.into(),
3596      bloom_filter_length: bloom_filter_length.into(),
3597      size_statistics: size_statistics.into(),
3598    }
3599  }
3600}
3601
3602impl crate::thrift::TSerializable for ColumnMetaData {
3603  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ColumnMetaData> {
3604    i_prot.read_struct_begin()?;
3605    let mut f_1: Option<Type> = None;
3606    let mut f_2: Option<Vec<Encoding>> = None;
3607    let mut f_3: Option<Vec<String>> = None;
3608    let mut f_4: Option<CompressionCodec> = None;
3609    let mut f_5: Option<i64> = None;
3610    let mut f_6: Option<i64> = None;
3611    let mut f_7: Option<i64> = None;
3612    let mut f_8: Option<Vec<KeyValue>> = None;
3613    let mut f_9: Option<i64> = None;
3614    let mut f_10: Option<i64> = None;
3615    let mut f_11: Option<i64> = None;
3616    let mut f_12: Option<Statistics> = None;
3617    let mut f_13: Option<Vec<PageEncodingStats>> = None;
3618    let mut f_14: Option<i64> = None;
3619    let mut f_15: Option<i32> = None;
3620    let mut f_16: Option<SizeStatistics> = None;
3621    loop {
3622      let field_ident = i_prot.read_field_begin()?;
3623      if field_ident.field_type == TType::Stop {
3624        break;
3625      }
3626      let field_id = field_id(&field_ident)?;
3627      match field_id {
3628        1 => {
3629          let val = Type::read_from_in_protocol(i_prot)?;
3630          f_1 = Some(val);
3631        },
3632        2 => {
3633          let list_ident = i_prot.read_list_begin()?;
3634          let mut val: Vec<Encoding> = Vec::with_capacity(list_ident.size as usize);
3635          for _ in 0..list_ident.size {
3636            let list_elem_2 = Encoding::read_from_in_protocol(i_prot)?;
3637            val.push(list_elem_2);
3638          }
3639          i_prot.read_list_end()?;
3640          f_2 = Some(val);
3641        },
3642        3 => {
3643          let list_ident = i_prot.read_list_begin()?;
3644          let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
3645          for _ in 0..list_ident.size {
3646            let list_elem_3 = i_prot.read_string()?;
3647            val.push(list_elem_3);
3648          }
3649          i_prot.read_list_end()?;
3650          f_3 = Some(val);
3651        },
3652        4 => {
3653          let val = CompressionCodec::read_from_in_protocol(i_prot)?;
3654          f_4 = Some(val);
3655        },
3656        5 => {
3657          let val = i_prot.read_i64()?;
3658          f_5 = Some(val);
3659        },
3660        6 => {
3661          let val = i_prot.read_i64()?;
3662          f_6 = Some(val);
3663        },
3664        7 => {
3665          let val = i_prot.read_i64()?;
3666          f_7 = Some(val);
3667        },
3668        8 => {
3669          let list_ident = i_prot.read_list_begin()?;
3670          let mut val: Vec<KeyValue> = Vec::with_capacity(list_ident.size as usize);
3671          for _ in 0..list_ident.size {
3672            let list_elem_4 = KeyValue::read_from_in_protocol(i_prot)?;
3673            val.push(list_elem_4);
3674          }
3675          i_prot.read_list_end()?;
3676          f_8 = Some(val);
3677        },
3678        9 => {
3679          let val = i_prot.read_i64()?;
3680          f_9 = Some(val);
3681        },
3682        10 => {
3683          let val = i_prot.read_i64()?;
3684          f_10 = Some(val);
3685        },
3686        11 => {
3687          let val = i_prot.read_i64()?;
3688          f_11 = Some(val);
3689        },
3690        12 => {
3691          let val = Statistics::read_from_in_protocol(i_prot)?;
3692          f_12 = Some(val);
3693        },
3694        13 => {
3695          let list_ident = i_prot.read_list_begin()?;
3696          let mut val: Vec<PageEncodingStats> = Vec::with_capacity(list_ident.size as usize);
3697          for _ in 0..list_ident.size {
3698            let list_elem_5 = PageEncodingStats::read_from_in_protocol(i_prot)?;
3699            val.push(list_elem_5);
3700          }
3701          i_prot.read_list_end()?;
3702          f_13 = Some(val);
3703        },
3704        14 => {
3705          let val = i_prot.read_i64()?;
3706          f_14 = Some(val);
3707        },
3708        15 => {
3709          let val = i_prot.read_i32()?;
3710          f_15 = Some(val);
3711        },
3712        16 => {
3713          let val = SizeStatistics::read_from_in_protocol(i_prot)?;
3714          f_16 = Some(val);
3715        },
3716        _ => {
3717          i_prot.skip(field_ident.field_type)?;
3718        },
3719      };
3720      i_prot.read_field_end()?;
3721    }
3722    i_prot.read_struct_end()?;
3723    verify_required_field_exists("ColumnMetaData.type_", &f_1)?;
3724    verify_required_field_exists("ColumnMetaData.encodings", &f_2)?;
3725    verify_required_field_exists("ColumnMetaData.path_in_schema", &f_3)?;
3726    verify_required_field_exists("ColumnMetaData.codec", &f_4)?;
3727    verify_required_field_exists("ColumnMetaData.num_values", &f_5)?;
3728    verify_required_field_exists("ColumnMetaData.total_uncompressed_size", &f_6)?;
3729    verify_required_field_exists("ColumnMetaData.total_compressed_size", &f_7)?;
3730    verify_required_field_exists("ColumnMetaData.data_page_offset", &f_9)?;
3731    let ret = ColumnMetaData {
3732      type_: f_1.expect("auto-generated code should have checked for presence of required fields"),
3733      encodings: f_2.expect("auto-generated code should have checked for presence of required fields"),
3734      path_in_schema: f_3.expect("auto-generated code should have checked for presence of required fields"),
3735      codec: f_4.expect("auto-generated code should have checked for presence of required fields"),
3736      num_values: f_5.expect("auto-generated code should have checked for presence of required fields"),
3737      total_uncompressed_size: f_6.expect("auto-generated code should have checked for presence of required fields"),
3738      total_compressed_size: f_7.expect("auto-generated code should have checked for presence of required fields"),
3739      key_value_metadata: f_8,
3740      data_page_offset: f_9.expect("auto-generated code should have checked for presence of required fields"),
3741      index_page_offset: f_10,
3742      dictionary_page_offset: f_11,
3743      statistics: f_12,
3744      encoding_stats: f_13,
3745      bloom_filter_offset: f_14,
3746      bloom_filter_length: f_15,
3747      size_statistics: f_16,
3748    };
3749    Ok(ret)
3750  }
3751  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
3752    let struct_ident = TStructIdentifier::new("ColumnMetaData");
3753    o_prot.write_struct_begin(&struct_ident)?;
3754    o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1))?;
3755    self.type_.write_to_out_protocol(o_prot)?;
3756    o_prot.write_field_end()?;
3757    o_prot.write_field_begin(&TFieldIdentifier::new("encodings", TType::List, 2))?;
3758    o_prot.write_list_begin(&TListIdentifier::new(TType::I32, self.encodings.len() as i32))?;
3759    for e in &self.encodings {
3760      e.write_to_out_protocol(o_prot)?;
3761    }
3762    o_prot.write_list_end()?;
3763    o_prot.write_field_end()?;
3764    o_prot.write_field_begin(&TFieldIdentifier::new("path_in_schema", TType::List, 3))?;
3765    o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.path_in_schema.len() as i32))?;
3766    for e in &self.path_in_schema {
3767      o_prot.write_string(e)?;
3768    }
3769    o_prot.write_list_end()?;
3770    o_prot.write_field_end()?;
3771    o_prot.write_field_begin(&TFieldIdentifier::new("codec", TType::I32, 4))?;
3772    self.codec.write_to_out_protocol(o_prot)?;
3773    o_prot.write_field_end()?;
3774    o_prot.write_field_begin(&TFieldIdentifier::new("num_values", TType::I64, 5))?;
3775    o_prot.write_i64(self.num_values)?;
3776    o_prot.write_field_end()?;
3777    o_prot.write_field_begin(&TFieldIdentifier::new("total_uncompressed_size", TType::I64, 6))?;
3778    o_prot.write_i64(self.total_uncompressed_size)?;
3779    o_prot.write_field_end()?;
3780    o_prot.write_field_begin(&TFieldIdentifier::new("total_compressed_size", TType::I64, 7))?;
3781    o_prot.write_i64(self.total_compressed_size)?;
3782    o_prot.write_field_end()?;
3783    if let Some(ref fld_var) = self.key_value_metadata {
3784      o_prot.write_field_begin(&TFieldIdentifier::new("key_value_metadata", TType::List, 8))?;
3785      o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
3786      for e in fld_var {
3787        e.write_to_out_protocol(o_prot)?;
3788      }
3789      o_prot.write_list_end()?;
3790      o_prot.write_field_end()?
3791    }
3792    o_prot.write_field_begin(&TFieldIdentifier::new("data_page_offset", TType::I64, 9))?;
3793    o_prot.write_i64(self.data_page_offset)?;
3794    o_prot.write_field_end()?;
3795    if let Some(fld_var) = self.index_page_offset {
3796      o_prot.write_field_begin(&TFieldIdentifier::new("index_page_offset", TType::I64, 10))?;
3797      o_prot.write_i64(fld_var)?;
3798      o_prot.write_field_end()?
3799    }
3800    if let Some(fld_var) = self.dictionary_page_offset {
3801      o_prot.write_field_begin(&TFieldIdentifier::new("dictionary_page_offset", TType::I64, 11))?;
3802      o_prot.write_i64(fld_var)?;
3803      o_prot.write_field_end()?
3804    }
3805    if let Some(ref fld_var) = self.statistics {
3806      o_prot.write_field_begin(&TFieldIdentifier::new("statistics", TType::Struct, 12))?;
3807      fld_var.write_to_out_protocol(o_prot)?;
3808      o_prot.write_field_end()?
3809    }
3810    if let Some(ref fld_var) = self.encoding_stats {
3811      o_prot.write_field_begin(&TFieldIdentifier::new("encoding_stats", TType::List, 13))?;
3812      o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
3813      for e in fld_var {
3814        e.write_to_out_protocol(o_prot)?;
3815      }
3816      o_prot.write_list_end()?;
3817      o_prot.write_field_end()?
3818    }
3819    if let Some(fld_var) = self.bloom_filter_offset {
3820      o_prot.write_field_begin(&TFieldIdentifier::new("bloom_filter_offset", TType::I64, 14))?;
3821      o_prot.write_i64(fld_var)?;
3822      o_prot.write_field_end()?
3823    }
3824    if let Some(fld_var) = self.bloom_filter_length {
3825      o_prot.write_field_begin(&TFieldIdentifier::new("bloom_filter_length", TType::I32, 15))?;
3826      o_prot.write_i32(fld_var)?;
3827      o_prot.write_field_end()?
3828    }
3829    if let Some(ref fld_var) = self.size_statistics {
3830      o_prot.write_field_begin(&TFieldIdentifier::new("size_statistics", TType::Struct, 16))?;
3831      fld_var.write_to_out_protocol(o_prot)?;
3832      o_prot.write_field_end()?
3833    }
3834    o_prot.write_field_stop()?;
3835    o_prot.write_struct_end()
3836  }
3837}
3838
3839//
3840// EncryptionWithFooterKey
3841//
3842
3843#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
3844pub struct EncryptionWithFooterKey {
3845}
3846
3847impl EncryptionWithFooterKey {
3848  pub fn new() -> EncryptionWithFooterKey {
3849    EncryptionWithFooterKey {}
3850  }
3851}
3852
3853impl crate::thrift::TSerializable for EncryptionWithFooterKey {
3854  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<EncryptionWithFooterKey> {
3855    i_prot.read_struct_begin()?;
3856    loop {
3857      let field_ident = i_prot.read_field_begin()?;
3858      if field_ident.field_type == TType::Stop {
3859        break;
3860      }
3861      i_prot.skip(field_ident.field_type)?;
3862      i_prot.read_field_end()?;
3863    }
3864    i_prot.read_struct_end()?;
3865    let ret = EncryptionWithFooterKey {};
3866    Ok(ret)
3867  }
3868  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
3869    let struct_ident = TStructIdentifier::new("EncryptionWithFooterKey");
3870    o_prot.write_struct_begin(&struct_ident)?;
3871    o_prot.write_field_stop()?;
3872    o_prot.write_struct_end()
3873  }
3874}
3875
3876//
3877// EncryptionWithColumnKey
3878//
3879
3880#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3881pub struct EncryptionWithColumnKey {
3882  /// Column path in schema *
3883  pub path_in_schema: Vec<String>,
3884  /// Retrieval metadata of column encryption key *
3885  pub key_metadata: Option<Vec<u8>>,
3886}
3887
3888impl EncryptionWithColumnKey {
3889  pub fn new<F2>(path_in_schema: Vec<String>, key_metadata: F2) -> EncryptionWithColumnKey where F2: Into<Option<Vec<u8>>> {
3890    EncryptionWithColumnKey {
3891      path_in_schema,
3892      key_metadata: key_metadata.into(),
3893    }
3894  }
3895}
3896
3897impl crate::thrift::TSerializable for EncryptionWithColumnKey {
3898  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<EncryptionWithColumnKey> {
3899    i_prot.read_struct_begin()?;
3900    let mut f_1: Option<Vec<String>> = None;
3901    let mut f_2: Option<Vec<u8>> = None;
3902    loop {
3903      let field_ident = i_prot.read_field_begin()?;
3904      if field_ident.field_type == TType::Stop {
3905        break;
3906      }
3907      let field_id = field_id(&field_ident)?;
3908      match field_id {
3909        1 => {
3910          let list_ident = i_prot.read_list_begin()?;
3911          let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
3912          for _ in 0..list_ident.size {
3913            let list_elem_6 = i_prot.read_string()?;
3914            val.push(list_elem_6);
3915          }
3916          i_prot.read_list_end()?;
3917          f_1 = Some(val);
3918        },
3919        2 => {
3920          let val = i_prot.read_bytes()?;
3921          f_2 = Some(val);
3922        },
3923        _ => {
3924          i_prot.skip(field_ident.field_type)?;
3925        },
3926      };
3927      i_prot.read_field_end()?;
3928    }
3929    i_prot.read_struct_end()?;
3930    verify_required_field_exists("EncryptionWithColumnKey.path_in_schema", &f_1)?;
3931    let ret = EncryptionWithColumnKey {
3932      path_in_schema: f_1.expect("auto-generated code should have checked for presence of required fields"),
3933      key_metadata: f_2,
3934    };
3935    Ok(ret)
3936  }
3937  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
3938    let struct_ident = TStructIdentifier::new("EncryptionWithColumnKey");
3939    o_prot.write_struct_begin(&struct_ident)?;
3940    o_prot.write_field_begin(&TFieldIdentifier::new("path_in_schema", TType::List, 1))?;
3941    o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.path_in_schema.len() as i32))?;
3942    for e in &self.path_in_schema {
3943      o_prot.write_string(e)?;
3944    }
3945    o_prot.write_list_end()?;
3946    o_prot.write_field_end()?;
3947    if let Some(ref fld_var) = self.key_metadata {
3948      o_prot.write_field_begin(&TFieldIdentifier::new("key_metadata", TType::String, 2))?;
3949      o_prot.write_bytes(fld_var)?;
3950      o_prot.write_field_end()?
3951    }
3952    o_prot.write_field_stop()?;
3953    o_prot.write_struct_end()
3954  }
3955}
3956
3957//
3958// ColumnCryptoMetaData
3959//
3960
3961#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3962pub enum ColumnCryptoMetaData {
3963  ENCRYPTIONWITHFOOTERKEY(EncryptionWithFooterKey),
3964  ENCRYPTIONWITHCOLUMNKEY(EncryptionWithColumnKey),
3965}
3966
3967impl crate::thrift::TSerializable for ColumnCryptoMetaData {
3968  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ColumnCryptoMetaData> {
3969    let mut ret: Option<ColumnCryptoMetaData> = None;
3970    let mut received_field_count = 0;
3971    i_prot.read_struct_begin()?;
3972    loop {
3973      let field_ident = i_prot.read_field_begin()?;
3974      if field_ident.field_type == TType::Stop {
3975        break;
3976      }
3977      let field_id = field_id(&field_ident)?;
3978      match field_id {
3979        1 => {
3980          let val = EncryptionWithFooterKey::read_from_in_protocol(i_prot)?;
3981          if ret.is_none() {
3982            ret = Some(ColumnCryptoMetaData::ENCRYPTIONWITHFOOTERKEY(val));
3983          }
3984          received_field_count += 1;
3985        },
3986        2 => {
3987          let val = EncryptionWithColumnKey::read_from_in_protocol(i_prot)?;
3988          if ret.is_none() {
3989            ret = Some(ColumnCryptoMetaData::ENCRYPTIONWITHCOLUMNKEY(val));
3990          }
3991          received_field_count += 1;
3992        },
3993        _ => {
3994          i_prot.skip(field_ident.field_type)?;
3995          received_field_count += 1;
3996        },
3997      };
3998      i_prot.read_field_end()?;
3999    }
4000    i_prot.read_struct_end()?;
4001    if received_field_count == 0 {
4002      Err(
4003        thrift::Error::Protocol(
4004          ProtocolError::new(
4005            ProtocolErrorKind::InvalidData,
4006            "received empty union from remote ColumnCryptoMetaData"
4007          )
4008        )
4009      )
4010    } else if received_field_count > 1 {
4011      Err(
4012        thrift::Error::Protocol(
4013          ProtocolError::new(
4014            ProtocolErrorKind::InvalidData,
4015            "received multiple fields for union from remote ColumnCryptoMetaData"
4016          )
4017        )
4018      )
4019    } else {
4020      ret.ok_or_else(|| thrift::Error::Protocol(ProtocolError::new(ProtocolErrorKind::InvalidData, "return value should have been constructed")))
4021    }
4022  }
4023  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
4024    let struct_ident = TStructIdentifier::new("ColumnCryptoMetaData");
4025    o_prot.write_struct_begin(&struct_ident)?;
4026    match *self {
4027      ColumnCryptoMetaData::ENCRYPTIONWITHFOOTERKEY(ref f) => {
4028        o_prot.write_field_begin(&TFieldIdentifier::new("ENCRYPTION_WITH_FOOTER_KEY", TType::Struct, 1))?;
4029        f.write_to_out_protocol(o_prot)?;
4030        o_prot.write_field_end()?;
4031      },
4032      ColumnCryptoMetaData::ENCRYPTIONWITHCOLUMNKEY(ref f) => {
4033        o_prot.write_field_begin(&TFieldIdentifier::new("ENCRYPTION_WITH_COLUMN_KEY", TType::Struct, 2))?;
4034        f.write_to_out_protocol(o_prot)?;
4035        o_prot.write_field_end()?;
4036      },
4037    }
4038    o_prot.write_field_stop()?;
4039    o_prot.write_struct_end()
4040  }
4041}
4042
4043//
4044// ColumnChunk
4045//
4046
4047#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4048pub struct ColumnChunk {
4049  /// File where column data is stored.  If not set, assumed to be same file as
4050  /// metadata.  This path is relative to the current file.
4051  /// 
4052  pub file_path: Option<String>,
4053  /// Deprecated: Byte offset in file_path to the ColumnMetaData
4054  /// 
4055  /// Past use of this field has been inconsistent, with some implementations
4056  /// using it to point to the ColumnMetaData and some using it to point to
4057  /// the first page in the column chunk. In many cases, the ColumnMetaData at this
4058  /// location is wrong. This field is now deprecated and should not be used.
4059  /// Writers should set this field to 0 if no ColumnMetaData has been written outside
4060  /// the footer.
4061  pub file_offset: i64,
4062  /// Column metadata for this chunk. Some writers may also replicate this at the
4063  /// location pointed to by file_path/file_offset.
4064  /// Note: while marked as optional, this field is in fact required by most major
4065  /// Parquet implementations. As such, writers MUST populate this field.
4066  /// 
4067  pub meta_data: Option<ColumnMetaData>,
4068  /// File offset of ColumnChunk's OffsetIndex *
4069  pub offset_index_offset: Option<i64>,
4070  /// Size of ColumnChunk's OffsetIndex, in bytes *
4071  pub offset_index_length: Option<i32>,
4072  /// File offset of ColumnChunk's ColumnIndex *
4073  pub column_index_offset: Option<i64>,
4074  /// Size of ColumnChunk's ColumnIndex, in bytes *
4075  pub column_index_length: Option<i32>,
4076  /// Crypto metadata of encrypted columns *
4077  pub crypto_metadata: Option<ColumnCryptoMetaData>,
4078  /// Encrypted column metadata for this chunk *
4079  pub encrypted_column_metadata: Option<Vec<u8>>,
4080}
4081
4082impl ColumnChunk {
4083  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>>> {
4084    ColumnChunk {
4085      file_path: file_path.into(),
4086      file_offset,
4087      meta_data: meta_data.into(),
4088      offset_index_offset: offset_index_offset.into(),
4089      offset_index_length: offset_index_length.into(),
4090      column_index_offset: column_index_offset.into(),
4091      column_index_length: column_index_length.into(),
4092      crypto_metadata: crypto_metadata.into(),
4093      encrypted_column_metadata: encrypted_column_metadata.into(),
4094    }
4095  }
4096}
4097
4098impl crate::thrift::TSerializable for ColumnChunk {
4099  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ColumnChunk> {
4100    i_prot.read_struct_begin()?;
4101    let mut f_1: Option<String> = None;
4102    let mut f_2: Option<i64> = None;
4103    let mut f_3: Option<ColumnMetaData> = None;
4104    let mut f_4: Option<i64> = None;
4105    let mut f_5: Option<i32> = None;
4106    let mut f_6: Option<i64> = None;
4107    let mut f_7: Option<i32> = None;
4108    let mut f_8: Option<ColumnCryptoMetaData> = None;
4109    let mut f_9: Option<Vec<u8>> = None;
4110    loop {
4111      let field_ident = i_prot.read_field_begin()?;
4112      if field_ident.field_type == TType::Stop {
4113        break;
4114      }
4115      let field_id = field_id(&field_ident)?;
4116      match field_id {
4117        1 => {
4118          let val = i_prot.read_string()?;
4119          f_1 = Some(val);
4120        },
4121        2 => {
4122          let val = i_prot.read_i64()?;
4123          f_2 = Some(val);
4124        },
4125        3 => {
4126          let val = ColumnMetaData::read_from_in_protocol(i_prot)?;
4127          f_3 = Some(val);
4128        },
4129        4 => {
4130          let val = i_prot.read_i64()?;
4131          f_4 = Some(val);
4132        },
4133        5 => {
4134          let val = i_prot.read_i32()?;
4135          f_5 = Some(val);
4136        },
4137        6 => {
4138          let val = i_prot.read_i64()?;
4139          f_6 = Some(val);
4140        },
4141        7 => {
4142          let val = i_prot.read_i32()?;
4143          f_7 = Some(val);
4144        },
4145        8 => {
4146          let val = ColumnCryptoMetaData::read_from_in_protocol(i_prot)?;
4147          f_8 = Some(val);
4148        },
4149        9 => {
4150          let val = i_prot.read_bytes()?;
4151          f_9 = Some(val);
4152        },
4153        _ => {
4154          i_prot.skip(field_ident.field_type)?;
4155        },
4156      };
4157      i_prot.read_field_end()?;
4158    }
4159    i_prot.read_struct_end()?;
4160    verify_required_field_exists("ColumnChunk.file_offset", &f_2)?;
4161    let ret = ColumnChunk {
4162      file_path: f_1,
4163      file_offset: f_2.expect("auto-generated code should have checked for presence of required fields"),
4164      meta_data: f_3,
4165      offset_index_offset: f_4,
4166      offset_index_length: f_5,
4167      column_index_offset: f_6,
4168      column_index_length: f_7,
4169      crypto_metadata: f_8,
4170      encrypted_column_metadata: f_9,
4171    };
4172    Ok(ret)
4173  }
4174  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
4175    let struct_ident = TStructIdentifier::new("ColumnChunk");
4176    o_prot.write_struct_begin(&struct_ident)?;
4177    if let Some(ref fld_var) = self.file_path {
4178      o_prot.write_field_begin(&TFieldIdentifier::new("file_path", TType::String, 1))?;
4179      o_prot.write_string(fld_var)?;
4180      o_prot.write_field_end()?
4181    }
4182    o_prot.write_field_begin(&TFieldIdentifier::new("file_offset", TType::I64, 2))?;
4183    o_prot.write_i64(self.file_offset)?;
4184    o_prot.write_field_end()?;
4185    if let Some(ref fld_var) = self.meta_data {
4186      o_prot.write_field_begin(&TFieldIdentifier::new("meta_data", TType::Struct, 3))?;
4187      fld_var.write_to_out_protocol(o_prot)?;
4188      o_prot.write_field_end()?
4189    }
4190    if let Some(fld_var) = self.offset_index_offset {
4191      o_prot.write_field_begin(&TFieldIdentifier::new("offset_index_offset", TType::I64, 4))?;
4192      o_prot.write_i64(fld_var)?;
4193      o_prot.write_field_end()?
4194    }
4195    if let Some(fld_var) = self.offset_index_length {
4196      o_prot.write_field_begin(&TFieldIdentifier::new("offset_index_length", TType::I32, 5))?;
4197      o_prot.write_i32(fld_var)?;
4198      o_prot.write_field_end()?
4199    }
4200    if let Some(fld_var) = self.column_index_offset {
4201      o_prot.write_field_begin(&TFieldIdentifier::new("column_index_offset", TType::I64, 6))?;
4202      o_prot.write_i64(fld_var)?;
4203      o_prot.write_field_end()?
4204    }
4205    if let Some(fld_var) = self.column_index_length {
4206      o_prot.write_field_begin(&TFieldIdentifier::new("column_index_length", TType::I32, 7))?;
4207      o_prot.write_i32(fld_var)?;
4208      o_prot.write_field_end()?
4209    }
4210    if let Some(ref fld_var) = self.crypto_metadata {
4211      o_prot.write_field_begin(&TFieldIdentifier::new("crypto_metadata", TType::Struct, 8))?;
4212      fld_var.write_to_out_protocol(o_prot)?;
4213      o_prot.write_field_end()?
4214    }
4215    if let Some(ref fld_var) = self.encrypted_column_metadata {
4216      o_prot.write_field_begin(&TFieldIdentifier::new("encrypted_column_metadata", TType::String, 9))?;
4217      o_prot.write_bytes(fld_var)?;
4218      o_prot.write_field_end()?
4219    }
4220    o_prot.write_field_stop()?;
4221    o_prot.write_struct_end()
4222  }
4223}
4224
4225//
4226// RowGroup
4227//
4228
4229#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4230pub struct RowGroup {
4231  /// Metadata for each column chunk in this row group.
4232  /// This list must have the same order as the SchemaElement list in FileMetaData.
4233  /// 
4234  pub columns: Vec<ColumnChunk>,
4235  /// Total byte size of all the uncompressed column data in this row group *
4236  pub total_byte_size: i64,
4237  /// Number of rows in this row group *
4238  pub num_rows: i64,
4239  /// If set, specifies a sort ordering of the rows in this RowGroup.
4240  /// The sorting columns can be a subset of all the columns.
4241  pub sorting_columns: Option<Vec<SortingColumn>>,
4242  /// Byte offset from beginning of file to first page (data or dictionary)
4243  /// in this row group *
4244  pub file_offset: Option<i64>,
4245  /// Total byte size of all compressed (and potentially encrypted) column data
4246  /// in this row group *
4247  pub total_compressed_size: Option<i64>,
4248  /// Row group ordinal in the file *
4249  pub ordinal: Option<i16>,
4250}
4251
4252impl RowGroup {
4253  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>> {
4254    RowGroup {
4255      columns,
4256      total_byte_size,
4257      num_rows,
4258      sorting_columns: sorting_columns.into(),
4259      file_offset: file_offset.into(),
4260      total_compressed_size: total_compressed_size.into(),
4261      ordinal: ordinal.into(),
4262    }
4263  }
4264}
4265
4266impl crate::thrift::TSerializable for RowGroup {
4267  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<RowGroup> {
4268    i_prot.read_struct_begin()?;
4269    let mut f_1: Option<Vec<ColumnChunk>> = None;
4270    let mut f_2: Option<i64> = None;
4271    let mut f_3: Option<i64> = None;
4272    let mut f_4: Option<Vec<SortingColumn>> = None;
4273    let mut f_5: Option<i64> = None;
4274    let mut f_6: Option<i64> = None;
4275    let mut f_7: Option<i16> = None;
4276    loop {
4277      let field_ident = i_prot.read_field_begin()?;
4278      if field_ident.field_type == TType::Stop {
4279        break;
4280      }
4281      let field_id = field_id(&field_ident)?;
4282      match field_id {
4283        1 => {
4284          let list_ident = i_prot.read_list_begin()?;
4285          let mut val: Vec<ColumnChunk> = Vec::with_capacity(list_ident.size as usize);
4286          for _ in 0..list_ident.size {
4287            let list_elem_7 = ColumnChunk::read_from_in_protocol(i_prot)?;
4288            val.push(list_elem_7);
4289          }
4290          i_prot.read_list_end()?;
4291          f_1 = Some(val);
4292        },
4293        2 => {
4294          let val = i_prot.read_i64()?;
4295          f_2 = Some(val);
4296        },
4297        3 => {
4298          let val = i_prot.read_i64()?;
4299          f_3 = Some(val);
4300        },
4301        4 => {
4302          let list_ident = i_prot.read_list_begin()?;
4303          let mut val: Vec<SortingColumn> = Vec::with_capacity(list_ident.size as usize);
4304          for _ in 0..list_ident.size {
4305            let list_elem_8 = SortingColumn::read_from_in_protocol(i_prot)?;
4306            val.push(list_elem_8);
4307          }
4308          i_prot.read_list_end()?;
4309          f_4 = Some(val);
4310        },
4311        5 => {
4312          let val = i_prot.read_i64()?;
4313          f_5 = Some(val);
4314        },
4315        6 => {
4316          let val = i_prot.read_i64()?;
4317          f_6 = Some(val);
4318        },
4319        7 => {
4320          let val = i_prot.read_i16()?;
4321          f_7 = Some(val);
4322        },
4323        _ => {
4324          i_prot.skip(field_ident.field_type)?;
4325        },
4326      };
4327      i_prot.read_field_end()?;
4328    }
4329    i_prot.read_struct_end()?;
4330    verify_required_field_exists("RowGroup.columns", &f_1)?;
4331    verify_required_field_exists("RowGroup.total_byte_size", &f_2)?;
4332    verify_required_field_exists("RowGroup.num_rows", &f_3)?;
4333    let ret = RowGroup {
4334      columns: f_1.expect("auto-generated code should have checked for presence of required fields"),
4335      total_byte_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
4336      num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
4337      sorting_columns: f_4,
4338      file_offset: f_5,
4339      total_compressed_size: f_6,
4340      ordinal: f_7,
4341    };
4342    Ok(ret)
4343  }
4344  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
4345    let struct_ident = TStructIdentifier::new("RowGroup");
4346    o_prot.write_struct_begin(&struct_ident)?;
4347    o_prot.write_field_begin(&TFieldIdentifier::new("columns", TType::List, 1))?;
4348    o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.columns.len() as i32))?;
4349    for e in &self.columns {
4350      e.write_to_out_protocol(o_prot)?;
4351    }
4352    o_prot.write_list_end()?;
4353    o_prot.write_field_end()?;
4354    o_prot.write_field_begin(&TFieldIdentifier::new("total_byte_size", TType::I64, 2))?;
4355    o_prot.write_i64(self.total_byte_size)?;
4356    o_prot.write_field_end()?;
4357    o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I64, 3))?;
4358    o_prot.write_i64(self.num_rows)?;
4359    o_prot.write_field_end()?;
4360    if let Some(ref fld_var) = self.sorting_columns {
4361      o_prot.write_field_begin(&TFieldIdentifier::new("sorting_columns", TType::List, 4))?;
4362      o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
4363      for e in fld_var {
4364        e.write_to_out_protocol(o_prot)?;
4365      }
4366      o_prot.write_list_end()?;
4367      o_prot.write_field_end()?
4368    }
4369    if let Some(fld_var) = self.file_offset {
4370      o_prot.write_field_begin(&TFieldIdentifier::new("file_offset", TType::I64, 5))?;
4371      o_prot.write_i64(fld_var)?;
4372      o_prot.write_field_end()?
4373    }
4374    if let Some(fld_var) = self.total_compressed_size {
4375      o_prot.write_field_begin(&TFieldIdentifier::new("total_compressed_size", TType::I64, 6))?;
4376      o_prot.write_i64(fld_var)?;
4377      o_prot.write_field_end()?
4378    }
4379    if let Some(fld_var) = self.ordinal {
4380      o_prot.write_field_begin(&TFieldIdentifier::new("ordinal", TType::I16, 7))?;
4381      o_prot.write_i16(fld_var)?;
4382      o_prot.write_field_end()?
4383    }
4384    o_prot.write_field_stop()?;
4385    o_prot.write_struct_end()
4386  }
4387}
4388
4389//
4390// TypeDefinedOrder
4391//
4392
4393/// Empty struct to signal the order defined by the physical or logical type
4394#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
4395pub struct TypeDefinedOrder {
4396}
4397
4398impl TypeDefinedOrder {
4399  pub fn new() -> TypeDefinedOrder {
4400    TypeDefinedOrder {}
4401  }
4402}
4403
4404impl crate::thrift::TSerializable for TypeDefinedOrder {
4405  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<TypeDefinedOrder> {
4406    i_prot.read_struct_begin()?;
4407    loop {
4408      let field_ident = i_prot.read_field_begin()?;
4409      if field_ident.field_type == TType::Stop {
4410        break;
4411      }
4412      i_prot.skip(field_ident.field_type)?;
4413      i_prot.read_field_end()?;
4414    }
4415    i_prot.read_struct_end()?;
4416    let ret = TypeDefinedOrder {};
4417    Ok(ret)
4418  }
4419  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
4420    let struct_ident = TStructIdentifier::new("TypeDefinedOrder");
4421    o_prot.write_struct_begin(&struct_ident)?;
4422    o_prot.write_field_stop()?;
4423    o_prot.write_struct_end()
4424  }
4425}
4426
4427//
4428// ColumnOrder
4429//
4430
4431#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4432pub enum ColumnOrder {
4433  TYPEORDER(TypeDefinedOrder),
4434}
4435
4436impl crate::thrift::TSerializable for ColumnOrder {
4437  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ColumnOrder> {
4438    let mut ret: Option<ColumnOrder> = None;
4439    let mut received_field_count = 0;
4440    i_prot.read_struct_begin()?;
4441    loop {
4442      let field_ident = i_prot.read_field_begin()?;
4443      if field_ident.field_type == TType::Stop {
4444        break;
4445      }
4446      let field_id = field_id(&field_ident)?;
4447      match field_id {
4448        1 => {
4449          let val = TypeDefinedOrder::read_from_in_protocol(i_prot)?;
4450          if ret.is_none() {
4451            ret = Some(ColumnOrder::TYPEORDER(val));
4452          }
4453          received_field_count += 1;
4454        },
4455        _ => {
4456          i_prot.skip(field_ident.field_type)?;
4457          received_field_count += 1;
4458        },
4459      };
4460      i_prot.read_field_end()?;
4461    }
4462    i_prot.read_struct_end()?;
4463    if received_field_count == 0 {
4464      Err(
4465        thrift::Error::Protocol(
4466          ProtocolError::new(
4467            ProtocolErrorKind::InvalidData,
4468            "received empty union from remote ColumnOrder"
4469          )
4470        )
4471      )
4472    } else if received_field_count > 1 {
4473      Err(
4474        thrift::Error::Protocol(
4475          ProtocolError::new(
4476            ProtocolErrorKind::InvalidData,
4477            "received multiple fields for union from remote ColumnOrder"
4478          )
4479        )
4480      )
4481    } else {
4482      ret.ok_or_else(|| thrift::Error::Protocol(ProtocolError::new(ProtocolErrorKind::InvalidData, "return value should have been constructed")))
4483    }
4484  }
4485  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
4486    let struct_ident = TStructIdentifier::new("ColumnOrder");
4487    o_prot.write_struct_begin(&struct_ident)?;
4488    match *self {
4489      ColumnOrder::TYPEORDER(ref f) => {
4490        o_prot.write_field_begin(&TFieldIdentifier::new("TYPE_ORDER", TType::Struct, 1))?;
4491        f.write_to_out_protocol(o_prot)?;
4492        o_prot.write_field_end()?;
4493      },
4494    }
4495    o_prot.write_field_stop()?;
4496    o_prot.write_struct_end()
4497  }
4498}
4499
4500//
4501// PageLocation
4502//
4503
4504#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4505pub struct PageLocation {
4506  /// Offset of the page in the file *
4507  pub offset: i64,
4508  /// Size of the page, including header. Sum of compressed_page_size and header
4509  /// length
4510  pub compressed_page_size: i32,
4511  /// Index within the RowGroup of the first row of the page. When an
4512  /// OffsetIndex is present, pages must begin on row boundaries
4513  /// (repetition_level = 0).
4514  pub first_row_index: i64,
4515}
4516
4517impl PageLocation {
4518  pub fn new(offset: i64, compressed_page_size: i32, first_row_index: i64) -> PageLocation {
4519    PageLocation {
4520      offset,
4521      compressed_page_size,
4522      first_row_index,
4523    }
4524  }
4525}
4526
4527impl crate::thrift::TSerializable for PageLocation {
4528  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<PageLocation> {
4529    i_prot.read_struct_begin()?;
4530    let mut f_1: Option<i64> = None;
4531    let mut f_2: Option<i32> = None;
4532    let mut f_3: Option<i64> = None;
4533    loop {
4534      let field_ident = i_prot.read_field_begin()?;
4535      if field_ident.field_type == TType::Stop {
4536        break;
4537      }
4538      let field_id = field_id(&field_ident)?;
4539      match field_id {
4540        1 => {
4541          let val = i_prot.read_i64()?;
4542          f_1 = Some(val);
4543        },
4544        2 => {
4545          let val = i_prot.read_i32()?;
4546          f_2 = Some(val);
4547        },
4548        3 => {
4549          let val = i_prot.read_i64()?;
4550          f_3 = Some(val);
4551        },
4552        _ => {
4553          i_prot.skip(field_ident.field_type)?;
4554        },
4555      };
4556      i_prot.read_field_end()?;
4557    }
4558    i_prot.read_struct_end()?;
4559    verify_required_field_exists("PageLocation.offset", &f_1)?;
4560    verify_required_field_exists("PageLocation.compressed_page_size", &f_2)?;
4561    verify_required_field_exists("PageLocation.first_row_index", &f_3)?;
4562    let ret = PageLocation {
4563      offset: f_1.expect("auto-generated code should have checked for presence of required fields"),
4564      compressed_page_size: f_2.expect("auto-generated code should have checked for presence of required fields"),
4565      first_row_index: f_3.expect("auto-generated code should have checked for presence of required fields"),
4566    };
4567    Ok(ret)
4568  }
4569  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
4570    let struct_ident = TStructIdentifier::new("PageLocation");
4571    o_prot.write_struct_begin(&struct_ident)?;
4572    o_prot.write_field_begin(&TFieldIdentifier::new("offset", TType::I64, 1))?;
4573    o_prot.write_i64(self.offset)?;
4574    o_prot.write_field_end()?;
4575    o_prot.write_field_begin(&TFieldIdentifier::new("compressed_page_size", TType::I32, 2))?;
4576    o_prot.write_i32(self.compressed_page_size)?;
4577    o_prot.write_field_end()?;
4578    o_prot.write_field_begin(&TFieldIdentifier::new("first_row_index", TType::I64, 3))?;
4579    o_prot.write_i64(self.first_row_index)?;
4580    o_prot.write_field_end()?;
4581    o_prot.write_field_stop()?;
4582    o_prot.write_struct_end()
4583  }
4584}
4585
4586//
4587// OffsetIndex
4588//
4589
4590/// Optional offsets for each data page in a ColumnChunk.
4591/// 
4592/// Forms part of the page index, along with ColumnIndex.
4593/// 
4594/// OffsetIndex may be present even if ColumnIndex is not.
4595#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4596pub struct OffsetIndex {
4597  /// PageLocations, ordered by increasing PageLocation.offset. It is required
4598  /// that page_locations\[i\].first_row_index < page_locations\[i+1\].first_row_index.
4599  pub page_locations: Vec<PageLocation>,
4600  /// Unencoded/uncompressed size for BYTE_ARRAY types.
4601  /// 
4602  /// See documention for unencoded_byte_array_data_bytes in SizeStatistics for
4603  /// more details on this field.
4604  pub unencoded_byte_array_data_bytes: Option<Vec<i64>>,
4605}
4606
4607impl OffsetIndex {
4608  pub fn new<F2>(page_locations: Vec<PageLocation>, unencoded_byte_array_data_bytes: F2) -> OffsetIndex where F2: Into<Option<Vec<i64>>> {
4609    OffsetIndex {
4610      page_locations,
4611      unencoded_byte_array_data_bytes: unencoded_byte_array_data_bytes.into(),
4612    }
4613  }
4614}
4615
4616impl crate::thrift::TSerializable for OffsetIndex {
4617  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<OffsetIndex> {
4618    i_prot.read_struct_begin()?;
4619    let mut f_1: Option<Vec<PageLocation>> = None;
4620    let mut f_2: Option<Vec<i64>> = None;
4621    loop {
4622      let field_ident = i_prot.read_field_begin()?;
4623      if field_ident.field_type == TType::Stop {
4624        break;
4625      }
4626      let field_id = field_id(&field_ident)?;
4627      match field_id {
4628        1 => {
4629          let list_ident = i_prot.read_list_begin()?;
4630          let mut val: Vec<PageLocation> = Vec::with_capacity(list_ident.size as usize);
4631          for _ in 0..list_ident.size {
4632            let list_elem_9 = PageLocation::read_from_in_protocol(i_prot)?;
4633            val.push(list_elem_9);
4634          }
4635          i_prot.read_list_end()?;
4636          f_1 = Some(val);
4637        },
4638        2 => {
4639          let list_ident = i_prot.read_list_begin()?;
4640          let mut val: Vec<i64> = Vec::with_capacity(list_ident.size as usize);
4641          for _ in 0..list_ident.size {
4642            let list_elem_10 = i_prot.read_i64()?;
4643            val.push(list_elem_10);
4644          }
4645          i_prot.read_list_end()?;
4646          f_2 = Some(val);
4647        },
4648        _ => {
4649          i_prot.skip(field_ident.field_type)?;
4650        },
4651      };
4652      i_prot.read_field_end()?;
4653    }
4654    i_prot.read_struct_end()?;
4655    verify_required_field_exists("OffsetIndex.page_locations", &f_1)?;
4656    let ret = OffsetIndex {
4657      page_locations: f_1.expect("auto-generated code should have checked for presence of required fields"),
4658      unencoded_byte_array_data_bytes: f_2,
4659    };
4660    Ok(ret)
4661  }
4662  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
4663    let struct_ident = TStructIdentifier::new("OffsetIndex");
4664    o_prot.write_struct_begin(&struct_ident)?;
4665    o_prot.write_field_begin(&TFieldIdentifier::new("page_locations", TType::List, 1))?;
4666    o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.page_locations.len() as i32))?;
4667    for e in &self.page_locations {
4668      e.write_to_out_protocol(o_prot)?;
4669    }
4670    o_prot.write_list_end()?;
4671    o_prot.write_field_end()?;
4672    if let Some(ref fld_var) = self.unencoded_byte_array_data_bytes {
4673      o_prot.write_field_begin(&TFieldIdentifier::new("unencoded_byte_array_data_bytes", TType::List, 2))?;
4674      o_prot.write_list_begin(&TListIdentifier::new(TType::I64, fld_var.len() as i32))?;
4675      for e in fld_var {
4676        o_prot.write_i64(*e)?;
4677      }
4678      o_prot.write_list_end()?;
4679      o_prot.write_field_end()?
4680    }
4681    o_prot.write_field_stop()?;
4682    o_prot.write_struct_end()
4683  }
4684}
4685
4686//
4687// ColumnIndex
4688//
4689
4690/// Optional statistics for each data page in a ColumnChunk.
4691/// 
4692/// Forms part the page index, along with OffsetIndex.
4693/// 
4694/// If this structure is present, OffsetIndex must also be present.
4695/// 
4696/// For each field in this structure, `<field>`\[i\] refers to the page at
4697/// OffsetIndex.page_locations\[i\]
4698#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
4699pub struct ColumnIndex {
4700  /// A list of Boolean values to determine the validity of the corresponding
4701  /// min and max values. If true, a page contains only null values, and writers
4702  /// have to set the corresponding entries in min_values and max_values to
4703  /// byte\[0\], so that all lists have the same length. If false, the
4704  /// corresponding entries in min_values and max_values must be valid.
4705  pub null_pages: Vec<bool>,
4706  /// Two lists containing lower and upper bounds for the values of each page
4707  /// determined by the ColumnOrder of the column. These may be the actual
4708  /// minimum and maximum values found on a page, but can also be (more compact)
4709  /// values that do not exist on a page. For example, instead of storing ""Blart
4710  /// Versenwald III", a writer may set min_values\[i\]="B", max_values\[i\]="C".
4711  /// Such more compact values must still be valid values within the column's
4712  /// logical type. Readers must make sure that list entries are populated before
4713  /// using them by inspecting null_pages.
4714  pub min_values: Vec<Vec<u8>>,
4715  pub max_values: Vec<Vec<u8>>,
4716  /// Stores whether both min_values and max_values are ordered and if so, in
4717  /// which direction. This allows readers to perform binary searches in both
4718  /// lists. Readers cannot assume that max_values\[i\] <= min_values\[i+1\], even
4719  /// if the lists are ordered.
4720  pub boundary_order: BoundaryOrder,
4721  /// A list containing the number of null values for each page *
4722  pub null_counts: Option<Vec<i64>>,
4723  /// Contains repetition level histograms for each page
4724  /// concatenated together.  The repetition_level_histogram field on
4725  /// SizeStatistics contains more details.
4726  /// 
4727  /// When present the length should always be (number of pages *
4728  /// (max_repetition_level + 1)) elements.
4729  /// 
4730  /// Element 0 is the first element of the histogram for the first page.
4731  /// Element (max_repetition_level + 1) is the first element of the histogram
4732  /// for the second page.
4733  /// 
4734  pub repetition_level_histograms: Option<Vec<i64>>,
4735  /// Same as repetition_level_histograms except for definitions levels.
4736  /// 
4737  pub definition_level_histograms: Option<Vec<i64>>,
4738}
4739
4740impl ColumnIndex {
4741  pub fn new<F5, F6, F7>(null_pages: Vec<bool>, min_values: Vec<Vec<u8>>, max_values: Vec<Vec<u8>>, boundary_order: BoundaryOrder, null_counts: F5, repetition_level_histograms: F6, definition_level_histograms: F7) -> ColumnIndex where F5: Into<Option<Vec<i64>>>, F6: Into<Option<Vec<i64>>>, F7: Into<Option<Vec<i64>>> {
4742    ColumnIndex {
4743      null_pages,
4744      min_values,
4745      max_values,
4746      boundary_order,
4747      null_counts: null_counts.into(),
4748      repetition_level_histograms: repetition_level_histograms.into(),
4749      definition_level_histograms: definition_level_histograms.into(),
4750    }
4751  }
4752}
4753
4754impl crate::thrift::TSerializable for ColumnIndex {
4755  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<ColumnIndex> {
4756    i_prot.read_struct_begin()?;
4757    let mut f_1: Option<Vec<bool>> = None;
4758    let mut f_2: Option<Vec<Vec<u8>>> = None;
4759    let mut f_3: Option<Vec<Vec<u8>>> = None;
4760    let mut f_4: Option<BoundaryOrder> = None;
4761    let mut f_5: Option<Vec<i64>> = None;
4762    let mut f_6: Option<Vec<i64>> = None;
4763    let mut f_7: Option<Vec<i64>> = None;
4764    loop {
4765      let field_ident = i_prot.read_field_begin()?;
4766      if field_ident.field_type == TType::Stop {
4767        break;
4768      }
4769      let field_id = field_id(&field_ident)?;
4770      match field_id {
4771        1 => {
4772          let list_ident = i_prot.read_list_begin()?;
4773          let mut val: Vec<bool> = Vec::with_capacity(list_ident.size as usize);
4774          for _ in 0..list_ident.size {
4775            let list_elem_11 = i_prot.read_bool()?;
4776            val.push(list_elem_11);
4777          }
4778          i_prot.read_list_end()?;
4779          f_1 = Some(val);
4780        },
4781        2 => {
4782          let list_ident = i_prot.read_list_begin()?;
4783          let mut val: Vec<Vec<u8>> = Vec::with_capacity(list_ident.size as usize);
4784          for _ in 0..list_ident.size {
4785            let list_elem_12 = i_prot.read_bytes()?;
4786            val.push(list_elem_12);
4787          }
4788          i_prot.read_list_end()?;
4789          f_2 = Some(val);
4790        },
4791        3 => {
4792          let list_ident = i_prot.read_list_begin()?;
4793          let mut val: Vec<Vec<u8>> = Vec::with_capacity(list_ident.size as usize);
4794          for _ in 0..list_ident.size {
4795            let list_elem_13 = i_prot.read_bytes()?;
4796            val.push(list_elem_13);
4797          }
4798          i_prot.read_list_end()?;
4799          f_3 = Some(val);
4800        },
4801        4 => {
4802          let val = BoundaryOrder::read_from_in_protocol(i_prot)?;
4803          f_4 = Some(val);
4804        },
4805        5 => {
4806          let list_ident = i_prot.read_list_begin()?;
4807          let mut val: Vec<i64> = Vec::with_capacity(list_ident.size as usize);
4808          for _ in 0..list_ident.size {
4809            let list_elem_14 = i_prot.read_i64()?;
4810            val.push(list_elem_14);
4811          }
4812          i_prot.read_list_end()?;
4813          f_5 = Some(val);
4814        },
4815        6 => {
4816          let list_ident = i_prot.read_list_begin()?;
4817          let mut val: Vec<i64> = Vec::with_capacity(list_ident.size as usize);
4818          for _ in 0..list_ident.size {
4819            let list_elem_15 = i_prot.read_i64()?;
4820            val.push(list_elem_15);
4821          }
4822          i_prot.read_list_end()?;
4823          f_6 = Some(val);
4824        },
4825        7 => {
4826          let list_ident = i_prot.read_list_begin()?;
4827          let mut val: Vec<i64> = Vec::with_capacity(list_ident.size as usize);
4828          for _ in 0..list_ident.size {
4829            let list_elem_16 = i_prot.read_i64()?;
4830            val.push(list_elem_16);
4831          }
4832          i_prot.read_list_end()?;
4833          f_7 = Some(val);
4834        },
4835        _ => {
4836          i_prot.skip(field_ident.field_type)?;
4837        },
4838      };
4839      i_prot.read_field_end()?;
4840    }
4841    i_prot.read_struct_end()?;
4842    verify_required_field_exists("ColumnIndex.null_pages", &f_1)?;
4843    verify_required_field_exists("ColumnIndex.min_values", &f_2)?;
4844    verify_required_field_exists("ColumnIndex.max_values", &f_3)?;
4845    verify_required_field_exists("ColumnIndex.boundary_order", &f_4)?;
4846    let ret = ColumnIndex {
4847      null_pages: f_1.expect("auto-generated code should have checked for presence of required fields"),
4848      min_values: f_2.expect("auto-generated code should have checked for presence of required fields"),
4849      max_values: f_3.expect("auto-generated code should have checked for presence of required fields"),
4850      boundary_order: f_4.expect("auto-generated code should have checked for presence of required fields"),
4851      null_counts: f_5,
4852      repetition_level_histograms: f_6,
4853      definition_level_histograms: f_7,
4854    };
4855    Ok(ret)
4856  }
4857  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
4858    let struct_ident = TStructIdentifier::new("ColumnIndex");
4859    o_prot.write_struct_begin(&struct_ident)?;
4860    o_prot.write_field_begin(&TFieldIdentifier::new("null_pages", TType::List, 1))?;
4861    o_prot.write_list_begin(&TListIdentifier::new(TType::Bool, self.null_pages.len() as i32))?;
4862    for e in &self.null_pages {
4863      o_prot.write_bool(*e)?;
4864    }
4865    o_prot.write_list_end()?;
4866    o_prot.write_field_end()?;
4867    o_prot.write_field_begin(&TFieldIdentifier::new("min_values", TType::List, 2))?;
4868    o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.min_values.len() as i32))?;
4869    for e in &self.min_values {
4870      o_prot.write_bytes(e)?;
4871    }
4872    o_prot.write_list_end()?;
4873    o_prot.write_field_end()?;
4874    o_prot.write_field_begin(&TFieldIdentifier::new("max_values", TType::List, 3))?;
4875    o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.max_values.len() as i32))?;
4876    for e in &self.max_values {
4877      o_prot.write_bytes(e)?;
4878    }
4879    o_prot.write_list_end()?;
4880    o_prot.write_field_end()?;
4881    o_prot.write_field_begin(&TFieldIdentifier::new("boundary_order", TType::I32, 4))?;
4882    self.boundary_order.write_to_out_protocol(o_prot)?;
4883    o_prot.write_field_end()?;
4884    if let Some(ref fld_var) = self.null_counts {
4885      o_prot.write_field_begin(&TFieldIdentifier::new("null_counts", TType::List, 5))?;
4886      o_prot.write_list_begin(&TListIdentifier::new(TType::I64, fld_var.len() as i32))?;
4887      for e in fld_var {
4888        o_prot.write_i64(*e)?;
4889      }
4890      o_prot.write_list_end()?;
4891      o_prot.write_field_end()?
4892    }
4893    if let Some(ref fld_var) = self.repetition_level_histograms {
4894      o_prot.write_field_begin(&TFieldIdentifier::new("repetition_level_histograms", TType::List, 6))?;
4895      o_prot.write_list_begin(&TListIdentifier::new(TType::I64, fld_var.len() as i32))?;
4896      for e in fld_var {
4897        o_prot.write_i64(*e)?;
4898      }
4899      o_prot.write_list_end()?;
4900      o_prot.write_field_end()?
4901    }
4902    if let Some(ref fld_var) = self.definition_level_histograms {
4903      o_prot.write_field_begin(&TFieldIdentifier::new("definition_level_histograms", TType::List, 7))?;
4904      o_prot.write_list_begin(&TListIdentifier::new(TType::I64, fld_var.len() as i32))?;
4905      for e in fld_var {
4906        o_prot.write_i64(*e)?;
4907      }
4908      o_prot.write_list_end()?;
4909      o_prot.write_field_end()?
4910    }
4911    o_prot.write_field_stop()?;
4912    o_prot.write_struct_end()
4913  }
4914}
4915
4916//
4917// AesGcmV1
4918//
4919
4920#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
4921pub struct AesGcmV1 {
4922  /// AAD prefix *
4923  pub aad_prefix: Option<Vec<u8>>,
4924  /// Unique file identifier part of AAD suffix *
4925  pub aad_file_unique: Option<Vec<u8>>,
4926  /// In files encrypted with AAD prefix without storing it,
4927  /// readers must supply the prefix *
4928  pub supply_aad_prefix: Option<bool>,
4929}
4930
4931impl AesGcmV1 {
4932  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>> {
4933    AesGcmV1 {
4934      aad_prefix: aad_prefix.into(),
4935      aad_file_unique: aad_file_unique.into(),
4936      supply_aad_prefix: supply_aad_prefix.into(),
4937    }
4938  }
4939}
4940
4941impl crate::thrift::TSerializable for AesGcmV1 {
4942  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<AesGcmV1> {
4943    i_prot.read_struct_begin()?;
4944    let mut f_1: Option<Vec<u8>> = None;
4945    let mut f_2: Option<Vec<u8>> = None;
4946    let mut f_3: Option<bool> = None;
4947    loop {
4948      let field_ident = i_prot.read_field_begin()?;
4949      if field_ident.field_type == TType::Stop {
4950        break;
4951      }
4952      let field_id = field_id(&field_ident)?;
4953      match field_id {
4954        1 => {
4955          let val = i_prot.read_bytes()?;
4956          f_1 = Some(val);
4957        },
4958        2 => {
4959          let val = i_prot.read_bytes()?;
4960          f_2 = Some(val);
4961        },
4962        3 => {
4963          let val = i_prot.read_bool()?;
4964          f_3 = Some(val);
4965        },
4966        _ => {
4967          i_prot.skip(field_ident.field_type)?;
4968        },
4969      };
4970      i_prot.read_field_end()?;
4971    }
4972    i_prot.read_struct_end()?;
4973    let ret = AesGcmV1 {
4974      aad_prefix: f_1,
4975      aad_file_unique: f_2,
4976      supply_aad_prefix: f_3,
4977    };
4978    Ok(ret)
4979  }
4980  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
4981    let struct_ident = TStructIdentifier::new("AesGcmV1");
4982    o_prot.write_struct_begin(&struct_ident)?;
4983    if let Some(ref fld_var) = self.aad_prefix {
4984      o_prot.write_field_begin(&TFieldIdentifier::new("aad_prefix", TType::String, 1))?;
4985      o_prot.write_bytes(fld_var)?;
4986      o_prot.write_field_end()?
4987    }
4988    if let Some(ref fld_var) = self.aad_file_unique {
4989      o_prot.write_field_begin(&TFieldIdentifier::new("aad_file_unique", TType::String, 2))?;
4990      o_prot.write_bytes(fld_var)?;
4991      o_prot.write_field_end()?
4992    }
4993    if let Some(fld_var) = self.supply_aad_prefix {
4994      o_prot.write_field_begin(&TFieldIdentifier::new("supply_aad_prefix", TType::Bool, 3))?;
4995      o_prot.write_bool(fld_var)?;
4996      o_prot.write_field_end()?
4997    }
4998    o_prot.write_field_stop()?;
4999    o_prot.write_struct_end()
5000  }
5001}
5002
5003//
5004// AesGcmCtrV1
5005//
5006
5007#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
5008pub struct AesGcmCtrV1 {
5009  /// AAD prefix *
5010  pub aad_prefix: Option<Vec<u8>>,
5011  /// Unique file identifier part of AAD suffix *
5012  pub aad_file_unique: Option<Vec<u8>>,
5013  /// In files encrypted with AAD prefix without storing it,
5014  /// readers must supply the prefix *
5015  pub supply_aad_prefix: Option<bool>,
5016}
5017
5018impl AesGcmCtrV1 {
5019  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>> {
5020    AesGcmCtrV1 {
5021      aad_prefix: aad_prefix.into(),
5022      aad_file_unique: aad_file_unique.into(),
5023      supply_aad_prefix: supply_aad_prefix.into(),
5024    }
5025  }
5026}
5027
5028impl crate::thrift::TSerializable for AesGcmCtrV1 {
5029  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<AesGcmCtrV1> {
5030    i_prot.read_struct_begin()?;
5031    let mut f_1: Option<Vec<u8>> = None;
5032    let mut f_2: Option<Vec<u8>> = None;
5033    let mut f_3: Option<bool> = None;
5034    loop {
5035      let field_ident = i_prot.read_field_begin()?;
5036      if field_ident.field_type == TType::Stop {
5037        break;
5038      }
5039      let field_id = field_id(&field_ident)?;
5040      match field_id {
5041        1 => {
5042          let val = i_prot.read_bytes()?;
5043          f_1 = Some(val);
5044        },
5045        2 => {
5046          let val = i_prot.read_bytes()?;
5047          f_2 = Some(val);
5048        },
5049        3 => {
5050          let val = i_prot.read_bool()?;
5051          f_3 = Some(val);
5052        },
5053        _ => {
5054          i_prot.skip(field_ident.field_type)?;
5055        },
5056      };
5057      i_prot.read_field_end()?;
5058    }
5059    i_prot.read_struct_end()?;
5060    let ret = AesGcmCtrV1 {
5061      aad_prefix: f_1,
5062      aad_file_unique: f_2,
5063      supply_aad_prefix: f_3,
5064    };
5065    Ok(ret)
5066  }
5067  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
5068    let struct_ident = TStructIdentifier::new("AesGcmCtrV1");
5069    o_prot.write_struct_begin(&struct_ident)?;
5070    if let Some(ref fld_var) = self.aad_prefix {
5071      o_prot.write_field_begin(&TFieldIdentifier::new("aad_prefix", TType::String, 1))?;
5072      o_prot.write_bytes(fld_var)?;
5073      o_prot.write_field_end()?
5074    }
5075    if let Some(ref fld_var) = self.aad_file_unique {
5076      o_prot.write_field_begin(&TFieldIdentifier::new("aad_file_unique", TType::String, 2))?;
5077      o_prot.write_bytes(fld_var)?;
5078      o_prot.write_field_end()?
5079    }
5080    if let Some(fld_var) = self.supply_aad_prefix {
5081      o_prot.write_field_begin(&TFieldIdentifier::new("supply_aad_prefix", TType::Bool, 3))?;
5082      o_prot.write_bool(fld_var)?;
5083      o_prot.write_field_end()?
5084    }
5085    o_prot.write_field_stop()?;
5086    o_prot.write_struct_end()
5087  }
5088}
5089
5090//
5091// EncryptionAlgorithm
5092//
5093
5094#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5095pub enum EncryptionAlgorithm {
5096  AESGCMV1(AesGcmV1),
5097  AESGCMCTRV1(AesGcmCtrV1),
5098}
5099
5100impl crate::thrift::TSerializable for EncryptionAlgorithm {
5101  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<EncryptionAlgorithm> {
5102    let mut ret: Option<EncryptionAlgorithm> = None;
5103    let mut received_field_count = 0;
5104    i_prot.read_struct_begin()?;
5105    loop {
5106      let field_ident = i_prot.read_field_begin()?;
5107      if field_ident.field_type == TType::Stop {
5108        break;
5109      }
5110      let field_id = field_id(&field_ident)?;
5111      match field_id {
5112        1 => {
5113          let val = AesGcmV1::read_from_in_protocol(i_prot)?;
5114          if ret.is_none() {
5115            ret = Some(EncryptionAlgorithm::AESGCMV1(val));
5116          }
5117          received_field_count += 1;
5118        },
5119        2 => {
5120          let val = AesGcmCtrV1::read_from_in_protocol(i_prot)?;
5121          if ret.is_none() {
5122            ret = Some(EncryptionAlgorithm::AESGCMCTRV1(val));
5123          }
5124          received_field_count += 1;
5125        },
5126        _ => {
5127          i_prot.skip(field_ident.field_type)?;
5128          received_field_count += 1;
5129        },
5130      };
5131      i_prot.read_field_end()?;
5132    }
5133    i_prot.read_struct_end()?;
5134    if received_field_count == 0 {
5135      Err(
5136        thrift::Error::Protocol(
5137          ProtocolError::new(
5138            ProtocolErrorKind::InvalidData,
5139            "received empty union from remote EncryptionAlgorithm"
5140          )
5141        )
5142      )
5143    } else if received_field_count > 1 {
5144      Err(
5145        thrift::Error::Protocol(
5146          ProtocolError::new(
5147            ProtocolErrorKind::InvalidData,
5148            "received multiple fields for union from remote EncryptionAlgorithm"
5149          )
5150        )
5151      )
5152    } else {
5153      ret.ok_or_else(|| thrift::Error::Protocol(ProtocolError::new(ProtocolErrorKind::InvalidData, "return value should have been constructed")))
5154    }
5155  }
5156  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
5157    let struct_ident = TStructIdentifier::new("EncryptionAlgorithm");
5158    o_prot.write_struct_begin(&struct_ident)?;
5159    match *self {
5160      EncryptionAlgorithm::AESGCMV1(ref f) => {
5161        o_prot.write_field_begin(&TFieldIdentifier::new("AES_GCM_V1", TType::Struct, 1))?;
5162        f.write_to_out_protocol(o_prot)?;
5163        o_prot.write_field_end()?;
5164      },
5165      EncryptionAlgorithm::AESGCMCTRV1(ref f) => {
5166        o_prot.write_field_begin(&TFieldIdentifier::new("AES_GCM_CTR_V1", TType::Struct, 2))?;
5167        f.write_to_out_protocol(o_prot)?;
5168        o_prot.write_field_end()?;
5169      },
5170    }
5171    o_prot.write_field_stop()?;
5172    o_prot.write_struct_end()
5173  }
5174}
5175
5176//
5177// FileMetaData
5178//
5179
5180/// Description for file metadata
5181#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5182pub struct FileMetaData {
5183  /// Version of this file *
5184  pub version: i32,
5185  /// Parquet schema for this file.  This schema contains metadata for all the columns.
5186  /// The schema is represented as a tree with a single root.  The nodes of the tree
5187  /// are flattened to a list by doing a depth-first traversal.
5188  /// The column metadata contains the path in the schema for that column which can be
5189  /// used to map columns to nodes in the schema.
5190  /// The first element is the root *
5191  pub schema: Vec<SchemaElement>,
5192  /// Number of rows in this file *
5193  pub num_rows: i64,
5194  /// Row groups in this file *
5195  pub row_groups: Vec<RowGroup>,
5196  /// Optional key/value metadata *
5197  pub key_value_metadata: Option<Vec<KeyValue>>,
5198  /// String for application that wrote this file.  This should be in the format
5199  /// `<Application>` version `<App Version>` (build `<App Build Hash>`).
5200  /// e.g. impala version 1.0 (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55)
5201  /// 
5202  pub created_by: Option<String>,
5203  /// Sort order used for the min_value and max_value fields in the Statistics
5204  /// objects and the min_values and max_values fields in the ColumnIndex
5205  /// objects of each column in this file. Sort orders are listed in the order
5206  /// matching the columns in the schema. The indexes are not necessary the same
5207  /// though, because only leaf nodes of the schema are represented in the list
5208  /// of sort orders.
5209  /// 
5210  /// Without column_orders, the meaning of the min_value and max_value fields
5211  /// in the Statistics object and the ColumnIndex object is undefined. To ensure
5212  /// well-defined behaviour, if these fields are written to a Parquet file,
5213  /// column_orders must be written as well.
5214  /// 
5215  /// The obsolete min and max fields in the Statistics object are always sorted
5216  /// by signed comparison regardless of column_orders.
5217  pub column_orders: Option<Vec<ColumnOrder>>,
5218  /// Encryption algorithm. This field is set only in encrypted files
5219  /// with plaintext footer. Files with encrypted footer store algorithm id
5220  /// in FileCryptoMetaData structure.
5221  pub encryption_algorithm: Option<EncryptionAlgorithm>,
5222  /// Retrieval metadata of key used for signing the footer.
5223  /// Used only in encrypted files with plaintext footer.
5224  pub footer_signing_key_metadata: Option<Vec<u8>>,
5225}
5226
5227impl FileMetaData {
5228  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>>> {
5229    FileMetaData {
5230      version,
5231      schema,
5232      num_rows,
5233      row_groups,
5234      key_value_metadata: key_value_metadata.into(),
5235      created_by: created_by.into(),
5236      column_orders: column_orders.into(),
5237      encryption_algorithm: encryption_algorithm.into(),
5238      footer_signing_key_metadata: footer_signing_key_metadata.into(),
5239    }
5240  }
5241}
5242
5243impl crate::thrift::TSerializable for FileMetaData {
5244  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<FileMetaData> {
5245    i_prot.read_struct_begin()?;
5246    let mut f_1: Option<i32> = None;
5247    let mut f_2: Option<Vec<SchemaElement>> = None;
5248    let mut f_3: Option<i64> = None;
5249    let mut f_4: Option<Vec<RowGroup>> = None;
5250    let mut f_5: Option<Vec<KeyValue>> = None;
5251    let mut f_6: Option<String> = None;
5252    let mut f_7: Option<Vec<ColumnOrder>> = None;
5253    let mut f_8: Option<EncryptionAlgorithm> = None;
5254    let mut f_9: Option<Vec<u8>> = None;
5255    loop {
5256      let field_ident = i_prot.read_field_begin()?;
5257      if field_ident.field_type == TType::Stop {
5258        break;
5259      }
5260      let field_id = field_id(&field_ident)?;
5261      match field_id {
5262        1 => {
5263          let val = i_prot.read_i32()?;
5264          f_1 = Some(val);
5265        },
5266        2 => {
5267          let list_ident = i_prot.read_list_begin()?;
5268          let mut val: Vec<SchemaElement> = Vec::with_capacity(list_ident.size as usize);
5269          for _ in 0..list_ident.size {
5270            let list_elem_17 = SchemaElement::read_from_in_protocol(i_prot)?;
5271            val.push(list_elem_17);
5272          }
5273          i_prot.read_list_end()?;
5274          f_2 = Some(val);
5275        },
5276        3 => {
5277          let val = i_prot.read_i64()?;
5278          f_3 = Some(val);
5279        },
5280        4 => {
5281          let list_ident = i_prot.read_list_begin()?;
5282          let mut val: Vec<RowGroup> = Vec::with_capacity(list_ident.size as usize);
5283          for _ in 0..list_ident.size {
5284            let list_elem_18 = RowGroup::read_from_in_protocol(i_prot)?;
5285            val.push(list_elem_18);
5286          }
5287          i_prot.read_list_end()?;
5288          f_4 = Some(val);
5289        },
5290        5 => {
5291          let list_ident = i_prot.read_list_begin()?;
5292          let mut val: Vec<KeyValue> = Vec::with_capacity(list_ident.size as usize);
5293          for _ in 0..list_ident.size {
5294            let list_elem_19 = KeyValue::read_from_in_protocol(i_prot)?;
5295            val.push(list_elem_19);
5296          }
5297          i_prot.read_list_end()?;
5298          f_5 = Some(val);
5299        },
5300        6 => {
5301          let val = i_prot.read_string()?;
5302          f_6 = Some(val);
5303        },
5304        7 => {
5305          let list_ident = i_prot.read_list_begin()?;
5306          let mut val: Vec<ColumnOrder> = Vec::with_capacity(list_ident.size as usize);
5307          for _ in 0..list_ident.size {
5308            let list_elem_20 = ColumnOrder::read_from_in_protocol(i_prot)?;
5309            val.push(list_elem_20);
5310          }
5311          i_prot.read_list_end()?;
5312          f_7 = Some(val);
5313        },
5314        8 => {
5315          let val = EncryptionAlgorithm::read_from_in_protocol(i_prot)?;
5316          f_8 = Some(val);
5317        },
5318        9 => {
5319          let val = i_prot.read_bytes()?;
5320          f_9 = Some(val);
5321        },
5322        _ => {
5323          i_prot.skip(field_ident.field_type)?;
5324        },
5325      };
5326      i_prot.read_field_end()?;
5327    }
5328    i_prot.read_struct_end()?;
5329    verify_required_field_exists("FileMetaData.version", &f_1)?;
5330    verify_required_field_exists("FileMetaData.schema", &f_2)?;
5331    verify_required_field_exists("FileMetaData.num_rows", &f_3)?;
5332    verify_required_field_exists("FileMetaData.row_groups", &f_4)?;
5333    let ret = FileMetaData {
5334      version: f_1.expect("auto-generated code should have checked for presence of required fields"),
5335      schema: f_2.expect("auto-generated code should have checked for presence of required fields"),
5336      num_rows: f_3.expect("auto-generated code should have checked for presence of required fields"),
5337      row_groups: f_4.expect("auto-generated code should have checked for presence of required fields"),
5338      key_value_metadata: f_5,
5339      created_by: f_6,
5340      column_orders: f_7,
5341      encryption_algorithm: f_8,
5342      footer_signing_key_metadata: f_9,
5343    };
5344    Ok(ret)
5345  }
5346  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
5347    let struct_ident = TStructIdentifier::new("FileMetaData");
5348    o_prot.write_struct_begin(&struct_ident)?;
5349    o_prot.write_field_begin(&TFieldIdentifier::new("version", TType::I32, 1))?;
5350    o_prot.write_i32(self.version)?;
5351    o_prot.write_field_end()?;
5352    o_prot.write_field_begin(&TFieldIdentifier::new("schema", TType::List, 2))?;
5353    o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.schema.len() as i32))?;
5354    for e in &self.schema {
5355      e.write_to_out_protocol(o_prot)?;
5356    }
5357    o_prot.write_list_end()?;
5358    o_prot.write_field_end()?;
5359    o_prot.write_field_begin(&TFieldIdentifier::new("num_rows", TType::I64, 3))?;
5360    o_prot.write_i64(self.num_rows)?;
5361    o_prot.write_field_end()?;
5362    o_prot.write_field_begin(&TFieldIdentifier::new("row_groups", TType::List, 4))?;
5363    o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.row_groups.len() as i32))?;
5364    for e in &self.row_groups {
5365      e.write_to_out_protocol(o_prot)?;
5366    }
5367    o_prot.write_list_end()?;
5368    o_prot.write_field_end()?;
5369    if let Some(ref fld_var) = self.key_value_metadata {
5370      o_prot.write_field_begin(&TFieldIdentifier::new("key_value_metadata", TType::List, 5))?;
5371      o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
5372      for e in fld_var {
5373        e.write_to_out_protocol(o_prot)?;
5374      }
5375      o_prot.write_list_end()?;
5376      o_prot.write_field_end()?
5377    }
5378    if let Some(ref fld_var) = self.created_by {
5379      o_prot.write_field_begin(&TFieldIdentifier::new("created_by", TType::String, 6))?;
5380      o_prot.write_string(fld_var)?;
5381      o_prot.write_field_end()?
5382    }
5383    if let Some(ref fld_var) = self.column_orders {
5384      o_prot.write_field_begin(&TFieldIdentifier::new("column_orders", TType::List, 7))?;
5385      o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
5386      for e in fld_var {
5387        e.write_to_out_protocol(o_prot)?;
5388      }
5389      o_prot.write_list_end()?;
5390      o_prot.write_field_end()?
5391    }
5392    if let Some(ref fld_var) = self.encryption_algorithm {
5393      o_prot.write_field_begin(&TFieldIdentifier::new("encryption_algorithm", TType::Struct, 8))?;
5394      fld_var.write_to_out_protocol(o_prot)?;
5395      o_prot.write_field_end()?
5396    }
5397    if let Some(ref fld_var) = self.footer_signing_key_metadata {
5398      o_prot.write_field_begin(&TFieldIdentifier::new("footer_signing_key_metadata", TType::String, 9))?;
5399      o_prot.write_bytes(fld_var)?;
5400      o_prot.write_field_end()?
5401    }
5402    o_prot.write_field_stop()?;
5403    o_prot.write_struct_end()
5404  }
5405}
5406
5407//
5408// FileCryptoMetaData
5409//
5410
5411/// Crypto metadata for files with encrypted footer *
5412#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
5413pub struct FileCryptoMetaData {
5414  /// Encryption algorithm. This field is only used for files
5415  /// with encrypted footer. Files with plaintext footer store algorithm id
5416  /// inside footer (FileMetaData structure).
5417  pub encryption_algorithm: EncryptionAlgorithm,
5418  /// Retrieval metadata of key used for encryption of footer,
5419  /// and (possibly) columns *
5420  pub key_metadata: Option<Vec<u8>>,
5421}
5422
5423impl FileCryptoMetaData {
5424  pub fn new<F2>(encryption_algorithm: EncryptionAlgorithm, key_metadata: F2) -> FileCryptoMetaData where F2: Into<Option<Vec<u8>>> {
5425    FileCryptoMetaData {
5426      encryption_algorithm,
5427      key_metadata: key_metadata.into(),
5428    }
5429  }
5430}
5431
5432impl crate::thrift::TSerializable for FileCryptoMetaData {
5433  fn read_from_in_protocol<T: TInputProtocol>(i_prot: &mut T) -> thrift::Result<FileCryptoMetaData> {
5434    i_prot.read_struct_begin()?;
5435    let mut f_1: Option<EncryptionAlgorithm> = None;
5436    let mut f_2: Option<Vec<u8>> = None;
5437    loop {
5438      let field_ident = i_prot.read_field_begin()?;
5439      if field_ident.field_type == TType::Stop {
5440        break;
5441      }
5442      let field_id = field_id(&field_ident)?;
5443      match field_id {
5444        1 => {
5445          let val = EncryptionAlgorithm::read_from_in_protocol(i_prot)?;
5446          f_1 = Some(val);
5447        },
5448        2 => {
5449          let val = i_prot.read_bytes()?;
5450          f_2 = Some(val);
5451        },
5452        _ => {
5453          i_prot.skip(field_ident.field_type)?;
5454        },
5455      };
5456      i_prot.read_field_end()?;
5457    }
5458    i_prot.read_struct_end()?;
5459    verify_required_field_exists("FileCryptoMetaData.encryption_algorithm", &f_1)?;
5460    let ret = FileCryptoMetaData {
5461      encryption_algorithm: f_1.expect("auto-generated code should have checked for presence of required fields"),
5462      key_metadata: f_2,
5463    };
5464    Ok(ret)
5465  }
5466  fn write_to_out_protocol<T: TOutputProtocol>(&self, o_prot: &mut T) -> thrift::Result<()> {
5467    let struct_ident = TStructIdentifier::new("FileCryptoMetaData");
5468    o_prot.write_struct_begin(&struct_ident)?;
5469    o_prot.write_field_begin(&TFieldIdentifier::new("encryption_algorithm", TType::Struct, 1))?;
5470    self.encryption_algorithm.write_to_out_protocol(o_prot)?;
5471    o_prot.write_field_end()?;
5472    if let Some(ref fld_var) = self.key_metadata {
5473      o_prot.write_field_begin(&TFieldIdentifier::new("key_metadata", TType::String, 2))?;
5474      o_prot.write_bytes(fld_var)?;
5475      o_prot.write_field_end()?
5476    }
5477    o_prot.write_field_stop()?;
5478    o_prot.write_struct_end()
5479  }
5480}
5481