genegraph-storage 0.26.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
// 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 pointer to a buffer in a Lance file
///
/// A writer can place a buffer in three different locations.  The buffer
/// can go in the data page, in the column metadata, or in the file metadata.
/// The writer is free to choose whatever is most appropriate (for example, a dictionary
/// that is shared across all pages in a column will probably go in the column
/// metadata).  This specification does not dictate where the buffer should go.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Buffer {
    /// The index of the buffer in the collection of buffers
    #[prost(uint32, tag = "1")]
    pub buffer_index: u32,
    #[prost(enumeration = "buffer::BufferType", tag = "2")]
    pub buffer_type: i32,
}
/// Nested message and enum types in `Buffer`.
pub mod buffer {
    /// The collection holding the buffer
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum BufferType {
        /// The buffer is stored in the data page itself
        Page = 0,
        /// The buffer is stored in the column metadata
        Column = 1,
        /// The buffer is stored in the file metadata
        File = 2,
    }
    impl BufferType {
        /// 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::Page => "page",
                Self::Column => "column",
                Self::File => "file",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "page" => Some(Self::Page),
                "column" => Some(Self::Column),
                "file" => Some(Self::File),
                _ => None,
            }
        }
    }
}
/// An encoding that adds nullability to another array encoding
///
/// This can wrap any array encoding and add nullability information
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Nullable {
    #[prost(oneof = "nullable::Nullability", tags = "1, 2, 3")]
    pub nullability: ::core::option::Option<nullable::Nullability>,
}
/// Nested message and enum types in `Nullable`.
pub mod nullable {
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct NoNull {
        #[prost(message, optional, boxed, tag = "1")]
        pub values: ::core::option::Option<
            ::prost::alloc::boxed::Box<super::ArrayEncoding>,
        >,
    }
    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct AllNull {}
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct SomeNull {
        #[prost(message, optional, boxed, tag = "1")]
        pub validity: ::core::option::Option<
            ::prost::alloc::boxed::Box<super::ArrayEncoding>,
        >,
        #[prost(message, optional, boxed, tag = "2")]
        pub values: ::core::option::Option<
            ::prost::alloc::boxed::Box<super::ArrayEncoding>,
        >,
    }
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Nullability {
        /// The array has no nulls and there is a single buffer needed
        #[prost(message, tag = "1")]
        NoNulls(::prost::alloc::boxed::Box<NoNull>),
        /// The array may have nulls and we need two buffers
        #[prost(message, tag = "2")]
        SomeNulls(::prost::alloc::boxed::Box<SomeNull>),
        /// All values are null (no buffers needed)
        #[prost(message, tag = "3")]
        AllNulls(AllNull),
    }
}
/// An array encoding for variable-length list fields
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct List {
    /// An array containing the offsets into an items array.
    ///
    /// This array will have num_rows items and will never
    /// have nulls.
    ///
    /// If the list at index i is not null then offsets\[i\] will
    /// contain `base + len(list)` where `base` is defined as:
    ///    i == 0: 0
    ///    i >  0: (offsets\[i-1\] % null_offset_adjustment)
    ///
    /// To help understand we can consider the following example list:
    /// \[ [A, B\], null, \[\], \[C, D, E\] ]
    ///
    /// The offsets will be \[2, ?, 2, 5\]
    ///
    /// If the incoming list at index i IS null then offsets\[i\] will
    /// contain `base + len(list) + null_offset_adjustment` where `base`
    /// is defined the same as above.
    ///
    /// To complete the above example let's assume that `null_offset_adjustment`
    /// is 7.  Then the offsets will be \[2, 9, 2, 5\]
    ///
    /// If there are no nulls then the offsets we write here are exactly the
    /// same as the offsets in an Arrow list array (except we omit the leading
    /// 0 which is redundant)
    ///
    /// The reason we do this is so that reading a single list at index i only
    /// requires us to load the indices at i and i-1.
    ///
    /// If the offset at index i is greater than `null_offset_adjustment``
    /// then the list at index i is null.
    ///
    /// Otherwise the length of the list is `offsets\[i\] - base` where
    /// base is defined the same as above.
    ///
    /// Let's consider our example offsets: \[2, 9, 2, 5\]
    ///
    /// We can take any range of lists and determine how many list items are
    /// referenced by the sublist.
    ///
    /// 0..3: \[_, 5\] -> items 0..5 (base = 0* and end is 5)
    /// 0..2: \[_, 2\] -> items 0..2 (base = 0* and end is 2)
    /// 0..1: \[_, 9\] -> items 0..2 (base = 0* and end is 9 % 7)
    /// 1..3: \[2, 5\] -> items 2..5 (base = 2 and end is 5)
    /// 1..2: \[2, 2\] -> items 2..2 (base = 2 and end is 2)
    /// 2..3: \[9, 5\] -> items 2..5 (base = 9 % 7 and end is 5)
    ///
    /// * When the start of our range is the 0th item the base is always 0 and we only
    ///    need to load a single index from disk to determine the range.
    ///
    /// The data type of the offsets array is flexible and does not need
    /// to match the data type of the destination array.  Please note that the offsets
    /// array is very likely to be efficiently encoded by bit packing deltas.
    #[prost(message, optional, boxed, tag = "1")]
    pub offsets: ::core::option::Option<::prost::alloc::boxed::Box<ArrayEncoding>>,
    /// If a list is null then we add this value to the offset
    ///
    /// This value must be greater than the length of the items so that
    /// (offset + null_offset_adjustment) is never used by a non-null list.
    ///
    /// Note that this value cannot be equal to the length of the items
    /// because then a page with a single list would store \[ X \] and we
    /// couldn't know if that is a null list or a list with X items.
    ///
    /// Therefore, the best choice for this value is 1 + # of items.
    /// Choosing this will maximize the bit packing that we can apply to the offsets.
    #[prost(uint64, tag = "2")]
    pub null_offset_adjustment: u64,
    /// How many items are referenced by these offsets.  This is needed in
    /// order to determine which items pages map to this offsets page.
    #[prost(uint64, tag = "3")]
    pub num_items: u64,
}
/// An array encoding for fixed-size list fields
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FixedSizeList {
    /// / The number of items in each list
    #[prost(uint32, tag = "1")]
    pub dimension: u32,
    /// / True if the list is nullable
    #[prost(bool, tag = "3")]
    pub has_validity: bool,
    /// / The items in the list
    #[prost(message, optional, boxed, tag = "2")]
    pub items: ::core::option::Option<::prost::alloc::boxed::Box<ArrayEncoding>>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Compression {
    #[prost(string, tag = "1")]
    pub scheme: ::prost::alloc::string::String,
    #[prost(int32, optional, tag = "2")]
    pub level: ::core::option::Option<i32>,
}
/// Fixed width items placed contiguously in a buffer
#[derive(Clone, 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 buffer of values
    #[prost(message, optional, tag = "2")]
    pub buffer: ::core::option::Option<Buffer>,
    /// The Compression message can specify the compression scheme (e.g. zstd) and any
    /// other information that is needed for decompression.
    ///
    /// If this array is compressed then the bits_per_value refers to the uncompressed
    /// data.
    #[prost(message, optional, tag = "3")]
    pub compression: ::core::option::Option<Compression>,
}
/// Compression algorithm where all values have a constant value
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Constant {
    /// The value (TODO: define encoding for literals?)
    #[prost(bytes = "vec", tag = "1")]
    pub value: ::prost::alloc::vec::Vec<u8>,
}
/// Items are bitpacked in a buffer
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Bitpacked {
    /// the number of bits used for a value in the buffer
    #[prost(uint64, tag = "1")]
    pub compressed_bits_per_value: u64,
    /// the number of bits of the uncompressed value. e.g. for a u32, this will be 32
    #[prost(uint64, tag = "2")]
    pub uncompressed_bits_per_value: u64,
    /// The items in the list
    #[prost(message, optional, tag = "3")]
    pub buffer: ::core::option::Option<Buffer>,
    /// Whether or not a sign bit is included in the bitpacked value
    #[prost(bool, tag = "4")]
    pub signed: bool,
}
/// Items are bitpacked in a buffer
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BitpackedForNonNeg {
    /// the number of bits used for a value in the buffer
    #[prost(uint64, tag = "1")]
    pub compressed_bits_per_value: u64,
    /// the number of bits of the uncompressed value. e.g. for a u32, this will be 32
    #[prost(uint64, tag = "2")]
    pub uncompressed_bits_per_value: u64,
    /// The items in the list
    #[prost(message, optional, tag = "3")]
    pub buffer: ::core::option::Option<Buffer>,
}
/// Opaque bitpacking variant where the bits per value are stored inline in the chunks themselves
#[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 = "2")]
    pub uncompressed_bits_per_value: u64,
}
/// Transparent bitpacking variant where the number of bits per value is fixed through the whole buffer
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::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 = "2")]
    pub uncompressed_bits_per_value: u64,
    /// The number of compressed bits per value, fixed across the entire buffer
    #[prost(uint64, tag = "3")]
    pub compressed_bits_per_value: u64,
}
/// An array encoding for shredded structs that will never be null
///
/// There is no actual data in this column.
///
/// TODO: Struct validity bitmaps will be placed here.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SimpleStruct {}
/// An array encoding for binary fields
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Binary {
    #[prost(message, optional, boxed, tag = "1")]
    pub indices: ::core::option::Option<::prost::alloc::boxed::Box<ArrayEncoding>>,
    #[prost(message, optional, boxed, tag = "2")]
    pub bytes: ::core::option::Option<::prost::alloc::boxed::Box<ArrayEncoding>>,
    #[prost(uint64, tag = "3")]
    pub null_adjustment: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Variable {
    #[prost(uint32, tag = "1")]
    pub bits_per_offset: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Fsst {
    #[prost(message, optional, boxed, tag = "1")]
    pub binary: ::core::option::Option<::prost::alloc::boxed::Box<ArrayEncoding>>,
    #[prost(bytes = "vec", tag = "2")]
    pub symbol_table: ::prost::alloc::vec::Vec<u8>,
}
/// An array encoding for dictionary-encoded fields
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Dictionary {
    #[prost(message, optional, boxed, tag = "1")]
    pub indices: ::core::option::Option<::prost::alloc::boxed::Box<ArrayEncoding>>,
    #[prost(message, optional, boxed, tag = "2")]
    pub items: ::core::option::Option<::prost::alloc::boxed::Box<ArrayEncoding>>,
    #[prost(uint32, tag = "3")]
    pub num_dictionary_items: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PackedStruct {
    #[prost(message, repeated, tag = "1")]
    pub inner: ::prost::alloc::vec::Vec<ArrayEncoding>,
    #[prost(message, optional, tag = "2")]
    pub buffer: ::core::option::Option<Buffer>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PackedStructFixedWidthMiniBlock {
    #[prost(message, optional, boxed, tag = "1")]
    pub flat: ::core::option::Option<::prost::alloc::boxed::Box<ArrayEncoding>>,
    #[prost(uint32, repeated, tag = "2")]
    pub bits_per_values: ::prost::alloc::vec::Vec<u32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FixedSizeBinary {
    #[prost(message, optional, boxed, tag = "1")]
    pub bytes: ::core::option::Option<::prost::alloc::boxed::Box<ArrayEncoding>>,
    #[prost(uint32, tag = "2")]
    pub byte_width: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Block {
    #[prost(string, tag = "1")]
    pub scheme: ::prost::alloc::string::String,
}
/// Run-Length Encoding for miniblock format
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Rle {
    /// Number of bits per value (8, 16, 32, 64, or 128)
    #[prost(uint64, tag = "1")]
    pub bits_per_value: u64,
}
/// Byte Stream Split encoding for floating point values
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ByteStreamSplit {
    /// Number of bits per value (32 for float, 64 for double)
    #[prost(uint64, tag = "1")]
    pub bits_per_value: u64,
}
/// General miniblock encoding - wraps another miniblock encoding with compression
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GeneralMiniBlock {
    /// The inner miniblock encoding (e.g., Rle, Bitpacked, etc.)
    #[prost(message, optional, boxed, tag = "1")]
    pub inner: ::core::option::Option<::prost::alloc::boxed::Box<ArrayEncoding>>,
    /// The compression scheme to apply to the miniblock buffers
    #[prost(message, optional, tag = "2")]
    pub compression: ::core::option::Option<Compression>,
}
/// Encodings that decode into an Arrow array
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ArrayEncoding {
    #[prost(
        oneof = "array_encoding::ArrayEncoding",
        tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21"
    )]
    pub array_encoding: ::core::option::Option<array_encoding::ArrayEncoding>,
}
/// Nested message and enum types in `ArrayEncoding`.
pub mod array_encoding {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum ArrayEncoding {
        #[prost(message, tag = "1")]
        Flat(super::Flat),
        #[prost(message, tag = "2")]
        Nullable(::prost::alloc::boxed::Box<super::Nullable>),
        #[prost(message, tag = "3")]
        FixedSizeList(::prost::alloc::boxed::Box<super::FixedSizeList>),
        #[prost(message, tag = "4")]
        List(::prost::alloc::boxed::Box<super::List>),
        #[prost(message, tag = "5")]
        Struct(super::SimpleStruct),
        #[prost(message, tag = "6")]
        Binary(::prost::alloc::boxed::Box<super::Binary>),
        #[prost(message, tag = "7")]
        Dictionary(::prost::alloc::boxed::Box<super::Dictionary>),
        #[prost(message, tag = "8")]
        Fsst(::prost::alloc::boxed::Box<super::Fsst>),
        #[prost(message, tag = "9")]
        PackedStruct(super::PackedStruct),
        #[prost(message, tag = "10")]
        Bitpacked(super::Bitpacked),
        #[prost(message, tag = "11")]
        FixedSizeBinary(::prost::alloc::boxed::Box<super::FixedSizeBinary>),
        #[prost(message, tag = "12")]
        BitpackedForNonNeg(super::BitpackedForNonNeg),
        #[prost(message, tag = "13")]
        Constant(super::Constant),
        #[prost(message, tag = "14")]
        InlineBitpacking(super::InlineBitpacking),
        #[prost(message, tag = "15")]
        OutOfLineBitpacking(super::OutOfLineBitpacking),
        #[prost(message, tag = "16")]
        Variable(super::Variable),
        #[prost(message, tag = "17")]
        PackedStructFixedWidthMiniBlock(
            ::prost::alloc::boxed::Box<super::PackedStructFixedWidthMiniBlock>,
        ),
        #[prost(message, tag = "18")]
        Block(super::Block),
        #[prost(message, tag = "19")]
        Rle(super::Rle),
        #[prost(message, tag = "20")]
        GeneralMiniBlock(::prost::alloc::boxed::Box<super::GeneralMiniBlock>),
        #[prost(message, tag = "21")]
        ByteStreamSplit(super::ByteStreamSplit),
    }
}
/// Wraps a column with a zone map index that can be used
/// to apply pushdown filters
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ZoneIndex {
    #[prost(uint32, tag = "1")]
    pub rows_per_zone: u32,
    #[prost(message, optional, tag = "2")]
    pub zone_map_buffer: ::core::option::Option<Buffer>,
    #[prost(message, optional, boxed, tag = "3")]
    pub inner: ::core::option::Option<::prost::alloc::boxed::Box<ColumnEncoding>>,
}
/// Marks a column as blob data.  It will contain a packed struct
/// with fields position and size (u64)
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Blob {
    #[prost(message, optional, boxed, tag = "1")]
    pub inner: ::core::option::Option<::prost::alloc::boxed::Box<ColumnEncoding>>,
}
/// Encodings that describe a column of values
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ColumnEncoding {
    #[prost(oneof = "column_encoding::ColumnEncoding", tags = "1, 2, 3")]
    pub column_encoding: ::core::option::Option<column_encoding::ColumnEncoding>,
}
/// Nested message and enum types in `ColumnEncoding`.
pub mod column_encoding {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum ColumnEncoding {
        /// No special encoding, just column values
        #[prost(message, tag = "1")]
        Values(()),
        #[prost(message, tag = "2")]
        ZoneIndex(::prost::alloc::boxed::Box<super::ZoneIndex>),
        #[prost(message, tag = "3")]
        Blob(::prost::alloc::boxed::Box<super::Blob>),
    }
}