genegraph-storage 0.20.0

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