Skip to main content

genegraph_storage/lancefmt/pb/
lance.encodings21.rs

1// Vendored from the Lance v2.1 spec (lance crate v11.0.0), generated with
2// prost 0.14 from the .proto files in src/lancefmt/protos/ (Apache-2.0,
3// Copyright The Lance Authors). Regenerate rather than hand-editing; see
4// src/lancefmt/protos/README.md.
5// This file is @generated by prost-build.
6/// A layout used for pages where the data is small
7///
8/// In this case we can fit many values into a single disk sector and transposing buffers is
9/// expensive.  As a result, we do not transpose the buffers but compress the data into small
10/// chunks (called mini blocks) which are roughly the size of a disk sector.
11///
12/// The end result is a small amount of read amplification (since we must read an entire page
13/// at a time) but we have more flexibility in compression and do less work per value when
14/// compressing and decompressing in bulk.
15#[derive(Clone, PartialEq, ::prost::Message)]
16pub struct MiniBlockLayout {
17    /// Description of the compression of repetition levels (e.g. how many bits per rep)
18    ///
19    /// Optional, if there is no repetition then this field is not present
20    #[prost(message, optional, tag = "1")]
21    pub rep_compression: ::core::option::Option<CompressiveEncoding>,
22    /// Description of the compression of definition levels (e.g. how many bits per def)
23    ///
24    /// Optional, if there is no definition then this field is not present
25    #[prost(message, optional, tag = "2")]
26    pub def_compression: ::core::option::Option<CompressiveEncoding>,
27    /// Description of the compression of values
28    #[prost(message, optional, tag = "3")]
29    pub value_compression: ::core::option::Option<CompressiveEncoding>,
30    /// Description of the compression of the dictionary data
31    ///
32    /// Optional, if there is no dictionary then this field is not present
33    #[prost(message, optional, tag = "4")]
34    pub dictionary: ::core::option::Option<CompressiveEncoding>,
35    /// Number of items in the dictionary
36    #[prost(uint64, tag = "5")]
37    pub num_dictionary_items: u64,
38    /// The meaning of each repdef layer, used to interpret repdef buffers correctly
39    #[prost(enumeration = "RepDefLayer", repeated, tag = "6")]
40    pub layers: ::prost::alloc::vec::Vec<i32>,
41    /// The number of buffers in each mini-block, this is determined by the compression and does
42    /// NOT include the repetition or definition buffers (the presence of these buffers can be determined
43    /// by looking at the rep_compression and def_compression fields)
44    #[prost(uint64, tag = "7")]
45    pub num_buffers: u64,
46    /// The depth of the repetition index.
47    ///
48    /// If there is repetition then the depth must be at least 1.  If there are many layers
49    /// of repetition then deeper repetition indices will support deeper nested random access.  For
50    /// example, given 5 layers of repetition then the repetition index depth must be at least
51    /// 3 to support access like `rows[50][17][3]`.
52    ///
53    /// We require `repetition_index_depth + 1` u64 values per mini-block to store the repetition
54    /// index if the `repetition_index_depth` is greater than 0.  The +1 is because we need to store
55    /// the number of "leftover items" at the end of the chunk.  Otherwise, we wouldn't have any way
56    /// to know if the final item in a chunk is valid or not.
57    #[prost(uint32, tag = "8")]
58    pub repetition_index_depth: u32,
59    /// The page already records how many rows are in the page.  For mini-block we also need to know how
60    /// many "items" are in the page.  A row and an item are the same thing unless the page has lists.
61    #[prost(uint64, tag = "9")]
62    pub num_items: u64,
63    /// Since Lance 2.2, miniblocks have larger chunk sizes (>= 64KB)
64    #[prost(bool, tag = "10")]
65    pub has_large_chunk: bool,
66}
67/// A layout used for pages where the data is large
68///
69/// In this case the cost of transposing the data is relatively small (compared to the cost of writing the data)
70/// and so we just zip the buffers together
71#[derive(Clone, PartialEq, ::prost::Message)]
72pub struct FullZipLayout {
73    /// The number of bits of repetition info (0 if there is no repetition)
74    #[prost(uint32, tag = "1")]
75    pub bits_rep: u32,
76    /// The number of bits of definition info (0 if there is no definition)
77    #[prost(uint32, tag = "2")]
78    pub bits_def: u32,
79    /// The number of items in the page
80    #[prost(uint32, tag = "5")]
81    pub num_items: u32,
82    /// The number of visible items in the page
83    #[prost(uint32, tag = "6")]
84    pub num_visible_items: u32,
85    /// Description of the compression of values
86    #[prost(message, optional, tag = "7")]
87    pub value_compression: ::core::option::Option<CompressiveEncoding>,
88    /// The meaning of each repdef layer, used to interpret repdef buffers correctly
89    #[prost(enumeration = "RepDefLayer", repeated, tag = "8")]
90    pub layers: ::prost::alloc::vec::Vec<i32>,
91    /// The number of bits of value info
92    ///
93    /// Note: we use bits here (and not bytes) for consistency with other encodings.  However, in practice,
94    /// there is never a reason to use a bits per value that is not a multiple of 8.  The complexity is not
95    /// worth the small savings in space since this encoding is typically used with large values already.
96    #[prost(oneof = "full_zip_layout::Details", tags = "3, 4")]
97    pub details: ::core::option::Option<full_zip_layout::Details>,
98}
99/// Nested message and enum types in `FullZipLayout`.
100pub mod full_zip_layout {
101    /// The number of bits of value info
102    ///
103    /// Note: we use bits here (and not bytes) for consistency with other encodings.  However, in practice,
104    /// there is never a reason to use a bits per value that is not a multiple of 8.  The complexity is not
105    /// worth the small savings in space since this encoding is typically used with large values already.
106    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
107    pub enum Details {
108        /// If this is a fixed width block then we need to have a fixed number of bits per value
109        #[prost(uint32, tag = "3")]
110        BitsPerValue(u32),
111        /// If this is a variable width block then we need to have a fixed number of bits per offset
112        #[prost(uint32, tag = "4")]
113        BitsPerOffset(u32),
114    }
115}
116/// A layout used for sparse flat or nested pages where Arrow structure is represented directly
117/// in layer-local slot domains instead of as dense repetition / definition events.
118///
119/// Structural layers are ordered from outer-most to inner-most. Values remain mini-block
120/// compressed and are split into independently readable chunks.
121#[derive(Clone, PartialEq, ::prost::Message)]
122pub struct SparseLayout {
123    /// Description of the compression of values.
124    #[prost(message, optional, tag = "1")]
125    pub value_compression: ::core::option::Option<CompressiveEncoding>,
126    /// Number of value buffers in each mini-block chunk. This does not include structural buffers.
127    #[prost(uint64, tag = "2")]
128    pub num_buffers: u64,
129    /// Number of entries in the equivalent dense repetition / definition stream. This equals
130    /// num_visible_items plus one structural placeholder for every list slot without children.
131    /// Null leaf slots count as visible items because they still occupy positions in Arrow's
132    /// leaf value buffer. For example, a nullable primitive with 100 slots, 30 of them null,
133    /// has num_items = num_visible_items = 100.
134    #[prost(uint64, tag = "3")]
135    pub num_items: u64,
136    /// Number of leaf value slots encoded in the value chunks, including null leaf slots.
137    #[prost(uint64, tag = "4")]
138    pub num_visible_items: u64,
139    /// If true, chunk-local value buffer sizes use u32. Otherwise they use u16.
140    #[prost(bool, tag = "5")]
141    pub has_large_chunk: bool,
142    /// Structural layers ordered from outer-most to inner-most. This may be empty for a flat,
143    /// non-nullable leaf page whose scheduling domain equals num_visible_items.
144    #[prost(message, repeated, tag = "6")]
145    pub structural_layers: ::prost::alloc::vec::Vec<SparseStructuralLayer>,
146}
147/// A domain is a layer-local integer coordinate space [0, num_slots). A slot is one
148/// element in that space. The outer-most domain is the page's top-level rows; each
149/// layer's child domain is the next layer's parent domain, and the terminal child
150/// domain contains num_visible_items leaf value slots.
151#[derive(Clone, PartialEq, ::prost::Message)]
152pub struct SparseStructuralLayer {
153    /// Exactly one layer kind is required.
154    #[prost(oneof = "sparse_structural_layer::Layer", tags = "1, 2, 3")]
155    pub layer: ::core::option::Option<sparse_structural_layer::Layer>,
156}
157/// Nested message and enum types in `SparseStructuralLayer`.
158pub mod sparse_structural_layer {
159    /// Exactly one layer kind is required.
160    #[derive(Clone, PartialEq, ::prost::Oneof)]
161    pub enum Layer {
162        #[prost(message, tag = "1")]
163        Validity(super::SparseValidityLayer),
164        #[prost(message, tag = "2")]
165        List(super::SparseListLayer),
166        #[prost(message, tag = "3")]
167        FixedSizeList(super::SparseFixedSizeListLayer),
168    }
169}
170#[derive(Clone, PartialEq, ::prost::Message)]
171pub struct SparseValidityLayer {
172    /// Number of nullable item or struct slots in this layer's parent and child domain.
173    #[prost(uint64, tag = "1")]
174    pub num_slots: u64,
175    /// Validity for the slots in this layer.
176    #[prost(message, optional, tag = "2")]
177    pub validity: ::core::option::Option<SparseValiditySet>,
178}
179#[derive(Clone, PartialEq, ::prost::Message)]
180pub struct SparseListLayer {
181    /// Number of list, large-list, or map slots in this layer's parent domain.
182    #[prost(uint64, tag = "1")]
183    pub num_slots: u64,
184    /// Number of slots in this layer's child domain.
185    #[prost(uint64, tag = "2")]
186    pub num_child_slots: u64,
187    /// Non-empty parent slots. Valid parent slots absent from this set are empty lists.
188    #[prost(message, optional, tag = "3")]
189    pub non_empty_positions: ::core::option::Option<SparsePositionSet>,
190    /// Positive child counts corresponding one-for-one with non_empty_positions.
191    #[prost(message, optional, tag = "4")]
192    pub counts: ::core::option::Option<SparseCountSet>,
193    /// Validity for the parent slots in this layer.
194    #[prost(message, optional, tag = "5")]
195    pub validity: ::core::option::Option<SparseValiditySet>,
196}
197#[derive(Clone, PartialEq, ::prost::Message)]
198pub struct SparseFixedSizeListLayer {
199    /// Number of fixed-size-list slots in this layer's parent domain.
200    #[prost(uint64, tag = "1")]
201    pub num_slots: u64,
202    /// Number of children per parent slot. The child domain has num_slots * dimension slots.
203    #[prost(uint64, tag = "2")]
204    pub dimension: u64,
205    /// Validity for the parent slots in this layer.
206    #[prost(message, optional, tag = "3")]
207    pub validity: ::core::option::Option<SparseValiditySet>,
208}
209#[derive(Clone, PartialEq, ::prost::Message)]
210pub struct SparseValiditySet {
211    #[prost(enumeration = "sparse_validity_set::Meaning", tag = "1")]
212    pub meaning: i32,
213    #[prost(message, optional, tag = "2")]
214    pub positions: ::core::option::Option<SparsePositionSet>,
215}
216/// Nested message and enum types in `SparseValiditySet`.
217pub mod sparse_validity_set {
218    #[derive(
219        Clone,
220        Copy,
221        Debug,
222        PartialEq,
223        Eq,
224        Hash,
225        PartialOrd,
226        Ord,
227        ::prost::Enumeration
228    )]
229    #[repr(i32)]
230    pub enum Meaning {
231        SparseValidityUnspecified = 0,
232        /// Stored positions are null; all other positions are valid.
233        SparseValidityNullPositions = 1,
234        /// Stored positions are valid; all other positions are null.
235        SparseValidityValidPositions = 2,
236    }
237    impl Meaning {
238        /// String value of the enum field names used in the ProtoBuf definition.
239        ///
240        /// The values are not transformed in any way and thus are considered stable
241        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
242        pub fn as_str_name(&self) -> &'static str {
243            match self {
244                Self::SparseValidityUnspecified => "SPARSE_VALIDITY_UNSPECIFIED",
245                Self::SparseValidityNullPositions => "SPARSE_VALIDITY_NULL_POSITIONS",
246                Self::SparseValidityValidPositions => "SPARSE_VALIDITY_VALID_POSITIONS",
247            }
248        }
249        /// Creates an enum from field names used in the ProtoBuf definition.
250        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
251            match value {
252                "SPARSE_VALIDITY_UNSPECIFIED" => Some(Self::SparseValidityUnspecified),
253                "SPARSE_VALIDITY_NULL_POSITIONS" => {
254                    Some(Self::SparseValidityNullPositions)
255                }
256                "SPARSE_VALIDITY_VALID_POSITIONS" => {
257                    Some(Self::SparseValidityValidPositions)
258                }
259                _ => None,
260            }
261        }
262    }
263}
264#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
265pub struct SparsePositionEmpty {}
266#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
267pub struct SparsePositionAll {}
268#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
269pub struct SparsePositionRange {
270    #[prost(uint64, tag = "1")]
271    pub start: u64,
272    #[prost(uint64, tag = "2")]
273    pub length: u64,
274}
275#[derive(Clone, PartialEq, ::prost::Message)]
276pub struct SparsePositionSet {
277    /// Semantic cardinality of this set.
278    #[prost(uint64, tag = "5")]
279    pub num_positions: u64,
280    #[prost(oneof = "sparse_position_set::Positions", tags = "1, 2, 3, 4")]
281    pub positions: ::core::option::Option<sparse_position_set::Positions>,
282}
283/// Nested message and enum types in `SparsePositionSet`.
284pub mod sparse_position_set {
285    #[derive(Clone, PartialEq, ::prost::Oneof)]
286    pub enum Positions {
287        /// Delta-compressed u64 positions. Cardinality is num_positions.
288        #[prost(message, tag = "1")]
289        Explicit(super::CompressiveEncoding),
290        /// One contiguous, non-empty range.
291        #[prost(message, tag = "2")]
292        Range(super::SparsePositionRange),
293        /// Every position in the domain.
294        #[prost(message, tag = "3")]
295        All(super::SparsePositionAll),
296        /// No positions in the domain.
297        #[prost(message, tag = "4")]
298        Empty(super::SparsePositionEmpty),
299    }
300}
301#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
302pub struct SparseCountEmpty {}
303#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
304pub struct SparseCountConstant {
305    /// Child count shared by every non-empty list slot.
306    #[prost(uint64, tag = "1")]
307    pub value: u64,
308}
309#[derive(Clone, PartialEq, ::prost::Message)]
310pub struct SparseCountSet {
311    #[prost(oneof = "sparse_count_set::Counts", tags = "1, 2, 3")]
312    pub counts: ::core::option::Option<sparse_count_set::Counts>,
313}
314/// Nested message and enum types in `SparseCountSet`.
315pub mod sparse_count_set {
316    #[derive(Clone, PartialEq, ::prost::Oneof)]
317    pub enum Counts {
318        /// Compressed u64 child counts. Cardinality comes from the containing position set.
319        #[prost(message, tag = "1")]
320        Explicit(super::CompressiveEncoding),
321        /// One positive child count shared by every non-empty list slot.
322        #[prost(message, tag = "2")]
323        Constant(super::SparseCountConstant),
324        /// No counts; valid only when there are no non-empty list slots.
325        #[prost(message, tag = "3")]
326        Empty(super::SparseCountEmpty),
327    }
328}
329/// A layout used for pages where all (visible) values are the same scalar value.
330///
331/// This generalizes the prior AllNullLayout semantics for file_version >= 2.2.
332///
333/// There may be buffers of repetition and definition information if required in order
334/// to interpret what kind of nulls are present / which items are visible.
335#[derive(Clone, PartialEq, ::prost::Message)]
336pub struct ConstantLayout {
337    /// The meaning of each repdef layer, used to interpret repdef buffers correctly
338    #[prost(enumeration = "RepDefLayer", repeated, tag = "5")]
339    pub layers: ::prost::alloc::vec::Vec<i32>,
340    /// Inline fixed-width scalar value bytes.
341    ///
342    /// This MUST only be used for types where a single non-null element is represented by a single
343    /// fixed-width Arrow value buffer (i.e. no offsets buffer, no child data).
344    ///
345    /// Constraints:
346    /// - MUST be absent for an all-null page
347    /// - MUST be <= 32 bytes if present
348    #[prost(bytes = "vec", optional, tag = "6")]
349    pub inline_value: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
350    /// Optional compression algorithm used for the repetition buffer.
351    /// If absent, repetition levels are stored as raw u16 values.
352    #[prost(message, optional, tag = "7")]
353    pub rep_compression: ::core::option::Option<CompressiveEncoding>,
354    /// Optional compression algorithm used for the definition buffer.
355    /// If absent, definition levels are stored as raw u16 values.
356    #[prost(message, optional, tag = "8")]
357    pub def_compression: ::core::option::Option<CompressiveEncoding>,
358    /// Number of values in repetition buffer after decompression.
359    #[prost(uint64, tag = "9")]
360    pub num_rep_values: u64,
361    /// Number of values in definition buffer after decompression.
362    #[prost(uint64, tag = "10")]
363    pub num_def_values: u64,
364}
365/// A layout where large binary data is encoded externally and only
366/// the descriptions (position + size) are placed in the page
367///
368/// Repdef information is stored in the descriptions.  A description with a size of
369/// 0 and a position of 0 is an empty value.  A description with a size of 0 and a
370/// non-zero position is a null value and the position is the repdef value.
371#[derive(Clone, PartialEq, ::prost::Message)]
372pub struct BlobLayout {
373    /// The inner layout used to store the descriptions
374    #[prost(message, optional, boxed, tag = "1")]
375    pub inner_layout: ::core::option::Option<::prost::alloc::boxed::Box<PageLayout>>,
376    /// The meaning of each repdef layer, used to interpret repdef buffers correctly
377    ///
378    /// The inner layout's repdef layers will always be 1 all valid item layer
379    #[prost(enumeration = "RepDefLayer", repeated, tag = "2")]
380    pub layers: ::prost::alloc::vec::Vec<i32>,
381}
382/// Describes the structural encoding of a page
383#[derive(Clone, PartialEq, ::prost::Message)]
384pub struct PageLayout {
385    #[prost(oneof = "page_layout::Layout", tags = "1, 2, 3, 4, 5")]
386    pub layout: ::core::option::Option<page_layout::Layout>,
387}
388/// Nested message and enum types in `PageLayout`.
389pub mod page_layout {
390    #[derive(Clone, PartialEq, ::prost::Oneof)]
391    pub enum Layout {
392        /// A layout used for pages where the data is small
393        #[prost(message, tag = "1")]
394        MiniBlockLayout(super::MiniBlockLayout),
395        /// A layout used for pages where all (visible) values are the same scalar value or null.
396        #[prost(message, tag = "2")]
397        ConstantLayout(super::ConstantLayout),
398        /// A layout used for pages where the data is large
399        #[prost(message, tag = "3")]
400        FullZipLayout(super::FullZipLayout),
401        /// A layout where large binary data is encoded externally
402        /// and only the descriptions are put in the page
403        #[prost(message, tag = "4")]
404        BlobLayout(::prost::alloc::boxed::Box<super::BlobLayout>),
405        /// A sparse structural layout. This variant requires file version 2.3 or later.
406        #[prost(message, tag = "5")]
407        SparseLayout(super::SparseLayout),
408    }
409}
410/// Compression applied to a single buffer of data
411///
412/// A buffer is the leaf of the compression tree.  Unlike data blocks, which can
413/// be further compressed with a variety of techniques, a buffer cannot be understood
414/// in any particular way.
415///
416/// A general compression scheme may be applied to a buffer.  This is something like
417/// zstd, lz4, etc.  The entire buffer is compressed as a single unit.  If this happens
418/// then any parent encoding becomes opaque, even if it would normally be transparent.
419///
420/// This is a leaf, no further compression is applied to the data.
421#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
422pub struct BufferCompression {
423    /// A general compression scheme to apply to the buffer
424    #[prost(enumeration = "CompressionScheme", tag = "1")]
425    pub scheme: i32,
426    /// The compression level
427    ///
428    /// Optional, if not present a scheme-specific default value will be used.
429    ///
430    /// Interpretation of this value depends on the compression scheme.  Generally, larger
431    /// values indicate more compression at the expense of more CPU time.
432    #[prost(int32, optional, tag = "2")]
433    pub level: ::core::option::Option<i32>,
434}
435/// Fixed width items placed contiguously in a single buffer
436///
437/// This is a leaf encoding, there is no compression applied to the data.
438///
439/// This is a transparent encoding by definition.
440///
441/// The input is a fixed-width data block.
442/// The output is a single buffer.
443#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
444pub struct Flat {
445    /// the number of bits per value, must be greater than 0, does
446    /// not need to be a multiple of 8
447    #[prost(uint64, tag = "1")]
448    pub bits_per_value: u64,
449    /// The compression applied to the data
450    #[prost(message, optional, tag = "2")]
451    pub data: ::core::option::Option<BufferCompression>,
452}
453/// Variable width items have the values stored in one buffer and the
454/// offsets are output as a data block that may be further compressed.
455///
456/// This is a partial leaf encoding.  Values are not compressed but
457/// the offsets may be further compressed.
458///
459/// This is a transparent encoding by definition.
460///
461/// The input is a variable-width data block.
462/// The output is a single fixed-width data block (the offsets) and
463/// a single buffer (the values)
464#[derive(Clone, PartialEq, ::prost::Message)]
465pub struct Variable {
466    /// Describes how the offsets data block is compressed
467    #[prost(message, optional, boxed, tag = "1")]
468    pub offsets: ::core::option::Option<::prost::alloc::boxed::Box<CompressiveEncoding>>,
469    /// The compression applied to the values
470    #[prost(message, optional, tag = "2")]
471    pub values: ::core::option::Option<BufferCompression>,
472}
473/// Compression algorithm where all values have a constant value (encoded in the description)
474///
475/// This is a leaf encoding, there is no compression applied to the data.
476///
477/// The input can be any kind of data block.
478/// There is no output.
479#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
480pub struct Constant {
481    /// The value (TODO: define encoding for literals?)
482    #[prost(bytes = "vec", optional, tag = "1")]
483    pub value: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
484}
485/// A compression scheme in which a single fixed-width block is "packed" into
486/// a smaller fixed-width block values where each value has fewer bits.
487///
488/// This is typically done by throwing away the most significant bits of each value when
489/// those bits are all the same.
490///
491/// In this scheme the number of bits per value is fixed across the entire buffer and stored
492/// in this message.
493///
494/// This is a transparent encoding.
495///
496/// The input is a fixed-width data block.
497/// The output is a single fixed-width data block.
498#[derive(Clone, PartialEq, ::prost::Message)]
499pub struct OutOfLineBitpacking {
500    /// the number of bits of the uncompressed value. e.g. for a u32, this will be 32
501    #[prost(uint64, tag = "1")]
502    pub uncompressed_bits_per_value: u64,
503    /// The compression used to store the bitpacked values data block
504    #[prost(message, optional, boxed, tag = "3")]
505    pub values: ::core::option::Option<::prost::alloc::boxed::Box<CompressiveEncoding>>,
506}
507/// Bitpacking variant where the bits per value are stored inline in the chunks themselves
508///
509/// This variation of bitpacking allows for the number of bits per value to change throughout the
510/// buffer, which makes the compression more robust to outliers.
511///
512/// This is an opaque encoding.
513///
514/// The input is a fixed-width data block.
515/// The output is a single buffer.
516#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
517pub struct InlineBitpacking {
518    /// the number of bits of the uncompressed value. e.g. for a u32, this will be 32
519    #[prost(uint64, tag = "1")]
520    pub uncompressed_bits_per_value: u64,
521    /// The compression applied to the values
522    #[prost(message, optional, tag = "2")]
523    pub values: ::core::option::Option<BufferCompression>,
524}
525/// A compression scheme for variable-width data
526///
527/// A small dictionary (referred to as a "symbol table") is used to compress the values.
528/// In this scheme there is a single symbol table for the entire page and it is stored in the
529/// encoding description itself.
530///
531/// This is a transparent encoding.
532///
533/// The input is a variable-width data block.
534/// The output is a single variable-width data block.
535#[derive(Clone, PartialEq, ::prost::Message)]
536pub struct Fsst {
537    /// The FSST symbol table
538    #[prost(bytes = "vec", tag = "1")]
539    pub symbol_table: ::prost::alloc::vec::Vec<u8>,
540    /// The compression used to store the compressed values data block
541    #[prost(message, optional, boxed, tag = "2")]
542    pub values: ::core::option::Option<::prost::alloc::boxed::Box<CompressiveEncoding>>,
543}
544/// A compression scheme where common values are stored in a dictionary and the values are
545/// encoded as indices into the dictionary.
546///
547/// This is an opaque encoding unless the dictionary is considered metadata.
548///
549/// The input is a any kind of data block.
550/// There are two outputs:
551/// - A data block of the same kind as the input (the dictionary)
552/// - A fixed-width data block containing the indices into the dictionary.
553#[derive(Clone, PartialEq, ::prost::Message)]
554pub struct Dictionary {
555    /// The compression used to store the indices data block
556    #[prost(message, optional, boxed, tag = "1")]
557    pub indices: ::core::option::Option<::prost::alloc::boxed::Box<CompressiveEncoding>>,
558    /// The compression used to store the dictionary items data block
559    #[prost(message, optional, boxed, tag = "2")]
560    pub items: ::core::option::Option<::prost::alloc::boxed::Box<CompressiveEncoding>>,
561    /// The number of items in the dictionary
562    #[prost(uint32, tag = "3")]
563    pub num_dictionary_items: u32,
564}
565/// A compression scheme where runs of common values are encoded as a single value and a count
566///
567/// This is an opaque encoding unless the run lengths are considered metadata.
568///
569/// The input is a single data block of any kind.
570/// There are two outputs:
571/// - A data block of the same kind as the input (the run values)
572/// - A fixed-width data block containing the lengths of the runs
573#[derive(Clone, PartialEq, ::prost::Message)]
574pub struct Rle {
575    /// The compression used to store the run values data block
576    #[prost(message, optional, boxed, tag = "1")]
577    pub values: ::core::option::Option<::prost::alloc::boxed::Box<CompressiveEncoding>>,
578    /// The compression used to store the run lengths data block
579    #[prost(message, optional, boxed, tag = "2")]
580    pub run_lengths: ::core::option::Option<
581        ::prost::alloc::boxed::Box<CompressiveEncoding>,
582    >,
583}
584/// Converts a fixed-size-list of values into a flattened list of values
585///
586/// This encoding does not actually compress the data, it just flattens out the FSL layers.
587///
588/// This is a transparent encoding.
589///
590/// The input is a single block of fixed-width data (with a wide width and few items)
591/// The output is a single block of fixed-width data (with a narrow width and many items)
592#[derive(Clone, PartialEq, ::prost::Message)]
593pub struct FixedSizeList {
594    /// The number of items in this layer of FSL
595    #[prost(uint64, tag = "1")]
596    pub items_per_value: u64,
597    /// Whether or not there is a validity buffer
598    #[prost(bool, tag = "3")]
599    pub has_validity: bool,
600    /// The compression used to store the flattened values data block
601    #[prost(message, optional, boxed, tag = "2")]
602    pub values: ::core::option::Option<::prost::alloc::boxed::Box<CompressiveEncoding>>,
603}
604/// Packs a struct containing only fixed-width children into a single fixed-width data block
605///
606/// The children are concatenated row by row and stored as a single fixed-width buffer. This is
607/// the legacy packed struct representation and remains available for backwards compatibility.
608#[derive(Clone, PartialEq, ::prost::Message)]
609pub struct PackedStruct {
610    /// The number of bits contributed by each child field in the packed row
611    #[prost(uint64, repeated, tag = "1")]
612    pub bits_per_value: ::prost::alloc::vec::Vec<u64>,
613    /// The compression used to store the packed fixed-width values
614    #[prost(message, optional, boxed, tag = "2")]
615    pub values: ::core::option::Option<::prost::alloc::boxed::Box<CompressiveEncoding>>,
616}
617/// Variable-width packed struct encoding (2.2 extension)
618///
619/// Each child value is compressed independently before being transposed into
620/// a row-major layout. This preserves per-field compression boundaries at the
621/// cost of disabling mini-block compression. Readers must prefer this field
622/// when present and fall back to the legacy encoding otherwise.
623#[derive(Clone, PartialEq, ::prost::Message)]
624pub struct VariablePackedStruct {
625    /// Per-field encoding metadata in struct order
626    #[prost(message, repeated, tag = "1")]
627    pub fields: ::prost::alloc::vec::Vec<variable_packed_struct::FieldEncoding>,
628}
629/// Nested message and enum types in `VariablePackedStruct`.
630pub mod variable_packed_struct {
631    /// Encoding description for a single child field
632    #[derive(Clone, PartialEq, ::prost::Message)]
633    pub struct FieldEncoding {
634        /// Compression applied to individual field values before transposition
635        #[prost(message, optional, tag = "1")]
636        pub value: ::core::option::Option<super::CompressiveEncoding>,
637        #[prost(oneof = "field_encoding::Layout", tags = "2, 3")]
638        pub layout: ::core::option::Option<field_encoding::Layout>,
639    }
640    /// Nested message and enum types in `FieldEncoding`.
641    pub mod field_encoding {
642        #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
643        pub enum Layout {
644            /// Bit width of each compressed value (when fixed width)
645            #[prost(uint64, tag = "2")]
646            BitsPerValue(u64),
647            /// Bit width of the length prefix for variable-width compressed values
648            #[prost(uint64, tag = "3")]
649            BitsPerLength(u64),
650        }
651    }
652}
653/// A compression scheme that wraps the underlying data with general compression
654///
655/// Note: The application of wrapped compression will depend on the layout of the data.
656/// If we apply it to mini-block data then we compress entire mini-blocks.  If we apply
657/// it to full-zip data then we compress each value individually.
658///
659/// Note: Wrapped compression is somewhat unique at the moment as it is applied to the
660/// output of the inner encoding and not the input like all other compressive encodings.
661///
662/// Note: General compression can usually be applied in two spots.  We can apply
663/// it to individual buffers or we can apply it here, to the entire array.
664///
665/// For example, let's say we are storing mini-blocks of strings and we are using
666/// FSST and bitpacking the offsets.  We have something like this...
667///
668/// WRAPPED(†3) -> FSST -> VARIABLE -(offsets)-> INLINE_BITPACKING -(data)-> FLAT -> BUFFER (†1)
669///                                  -(data)-> BUFFER (†2)
670///
671/// General compression can be applied at †1, †2, or †3 (or any combination of these).
672///
673/// If we apply it at †1 then we apply it just to the bitpacked offsets
674/// If we apply it at †2 then we apply it just to the FSST compressed data
675/// If we apply it at †3 then we apply it to the entire mini-block (both offsets and data)
676///
677/// The input is a single data block of any kind.
678/// The output is a single data block of the same kind as the input.
679#[derive(Clone, PartialEq, ::prost::Message)]
680pub struct General {
681    /// The compression to apply to the values
682    #[prost(message, optional, tag = "1")]
683    pub compression: ::core::option::Option<BufferCompression>,
684    /// The compression used to store the output data block
685    #[prost(message, optional, boxed, tag = "3")]
686    pub values: ::core::option::Option<::prost::alloc::boxed::Box<CompressiveEncoding>>,
687}
688/// A compression scheme where fixed-width values are transposed into a series of byte streams
689///
690/// This is commonly used for floating point values where the upper bits (the mantissa) have a
691/// significantly different meaning than the lower bits.  By splitting the values into byte streams
692/// we group the mantissa bits together and the exponent bits together.  The end result is typically
693/// more compressible.
694///
695/// Note that this encoding is mostly useful when combined with other encodings.  It does not do any
696/// compression on its own.
697///
698/// This is an opaque encoding.
699///
700/// The input is a fixed-width data block
701/// The output is a single fixed-width data block
702#[derive(Clone, PartialEq, ::prost::Message)]
703pub struct ByteStreamSplit {
704    /// The compression used to store the values
705    #[prost(message, optional, boxed, tag = "1")]
706    pub values: ::core::option::Option<::prost::alloc::boxed::Box<CompressiveEncoding>>,
707}
708/// An encoding that compresses a data block into buffers
709#[derive(Clone, PartialEq, ::prost::Message)]
710pub struct CompressiveEncoding {
711    #[prost(
712        oneof = "compressive_encoding::Compression",
713        tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13"
714    )]
715    pub compression: ::core::option::Option<compressive_encoding::Compression>,
716}
717/// Nested message and enum types in `CompressiveEncoding`.
718pub mod compressive_encoding {
719    #[derive(Clone, PartialEq, ::prost::Oneof)]
720    pub enum Compression {
721        #[prost(message, tag = "1")]
722        Flat(super::Flat),
723        #[prost(message, tag = "2")]
724        Variable(::prost::alloc::boxed::Box<super::Variable>),
725        #[prost(message, tag = "3")]
726        Constant(super::Constant),
727        #[prost(message, tag = "4")]
728        OutOfLineBitpacking(::prost::alloc::boxed::Box<super::OutOfLineBitpacking>),
729        #[prost(message, tag = "5")]
730        InlineBitpacking(super::InlineBitpacking),
731        #[prost(message, tag = "6")]
732        Fsst(::prost::alloc::boxed::Box<super::Fsst>),
733        #[prost(message, tag = "7")]
734        Dictionary(::prost::alloc::boxed::Box<super::Dictionary>),
735        #[prost(message, tag = "8")]
736        Rle(::prost::alloc::boxed::Box<super::Rle>),
737        #[prost(message, tag = "9")]
738        ByteStreamSplit(::prost::alloc::boxed::Box<super::ByteStreamSplit>),
739        #[prost(message, tag = "10")]
740        General(::prost::alloc::boxed::Box<super::General>),
741        #[prost(message, tag = "11")]
742        FixedSizeList(::prost::alloc::boxed::Box<super::FixedSizeList>),
743        #[prost(message, tag = "12")]
744        PackedStruct(::prost::alloc::boxed::Box<super::PackedStruct>),
745        #[prost(message, tag = "13")]
746        VariablePackedStruct(super::VariablePackedStruct),
747    }
748}
749/// Repetition and definition levels are described in more detail elsewhere.  As we peel through
750/// the structure of an array we will encounter layers of struct and list.  Each of these layers
751/// potentially adds a new level to the repetition and definition levels.  This message describes
752/// the meaning of each layer.
753#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
754#[repr(i32)]
755pub enum RepDefLayer {
756    /// Should never be used, included for debugging purporses and general protobuf best practice
757    RepdefUnspecified = 0,
758    /// All values are valid (can be primitive or struct)
759    RepdefAllValidItem = 1,
760    /// All list values are valid
761    RepdefAllValidList = 2,
762    /// There are one or more null items (can be primitive or struct)
763    RepdefNullableItem = 3,
764    /// A list layer with null lists but no empty lists
765    RepdefNullableList = 4,
766    /// A list layer with empty lists but no null lists
767    RepdefEmptyableList = 5,
768    /// A list layer with both empty lists and null lists
769    RepdefNullAndEmptyList = 6,
770}
771impl RepDefLayer {
772    /// String value of the enum field names used in the ProtoBuf definition.
773    ///
774    /// The values are not transformed in any way and thus are considered stable
775    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
776    pub fn as_str_name(&self) -> &'static str {
777        match self {
778            Self::RepdefUnspecified => "REPDEF_UNSPECIFIED",
779            Self::RepdefAllValidItem => "REPDEF_ALL_VALID_ITEM",
780            Self::RepdefAllValidList => "REPDEF_ALL_VALID_LIST",
781            Self::RepdefNullableItem => "REPDEF_NULLABLE_ITEM",
782            Self::RepdefNullableList => "REPDEF_NULLABLE_LIST",
783            Self::RepdefEmptyableList => "REPDEF_EMPTYABLE_LIST",
784            Self::RepdefNullAndEmptyList => "REPDEF_NULL_AND_EMPTY_LIST",
785        }
786    }
787    /// Creates an enum from field names used in the ProtoBuf definition.
788    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
789        match value {
790            "REPDEF_UNSPECIFIED" => Some(Self::RepdefUnspecified),
791            "REPDEF_ALL_VALID_ITEM" => Some(Self::RepdefAllValidItem),
792            "REPDEF_ALL_VALID_LIST" => Some(Self::RepdefAllValidList),
793            "REPDEF_NULLABLE_ITEM" => Some(Self::RepdefNullableItem),
794            "REPDEF_NULLABLE_LIST" => Some(Self::RepdefNullableList),
795            "REPDEF_EMPTYABLE_LIST" => Some(Self::RepdefEmptyableList),
796            "REPDEF_NULL_AND_EMPTY_LIST" => Some(Self::RepdefNullAndEmptyList),
797            _ => None,
798        }
799    }
800}
801#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
802#[repr(i32)]
803pub enum CompressionScheme {
804    CompressionAlgorithmUnspecified = 0,
805    CompressionAlgorithmLz4 = 1,
806    CompressionAlgorithmZstd = 2,
807}
808impl CompressionScheme {
809    /// String value of the enum field names used in the ProtoBuf definition.
810    ///
811    /// The values are not transformed in any way and thus are considered stable
812    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
813    pub fn as_str_name(&self) -> &'static str {
814        match self {
815            Self::CompressionAlgorithmUnspecified => "COMPRESSION_ALGORITHM_UNSPECIFIED",
816            Self::CompressionAlgorithmLz4 => "COMPRESSION_ALGORITHM_LZ4",
817            Self::CompressionAlgorithmZstd => "COMPRESSION_ALGORITHM_ZSTD",
818        }
819    }
820    /// Creates an enum from field names used in the ProtoBuf definition.
821    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
822        match value {
823            "COMPRESSION_ALGORITHM_UNSPECIFIED" => {
824                Some(Self::CompressionAlgorithmUnspecified)
825            }
826            "COMPRESSION_ALGORITHM_LZ4" => Some(Self::CompressionAlgorithmLz4),
827            "COMPRESSION_ALGORITHM_ZSTD" => Some(Self::CompressionAlgorithmZstd),
828            _ => None,
829        }
830    }
831}