Skip to main content

genegraph_storage/lancefmt/pb/
lance.file.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 file descriptor that describes the contents of a Lance file
7#[derive(Clone, PartialEq, ::prost::Message)]
8pub struct FileDescriptor {
9    /// The schema of the file
10    #[prost(message, optional, tag = "1")]
11    pub schema: ::core::option::Option<Schema>,
12    /// The number of rows in the file
13    #[prost(uint64, tag = "2")]
14    pub length: u64,
15}
16/// A schema which describes the data type of each of the columns
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct Schema {
19    /// All fields in this file, including the nested fields.
20    #[prost(message, repeated, tag = "1")]
21    pub fields: ::prost::alloc::vec::Vec<Field>,
22    /// Schema metadata.
23    #[prost(map = "string, bytes", tag = "5")]
24    pub metadata: ::std::collections::HashMap<
25        ::prost::alloc::string::String,
26        ::prost::alloc::vec::Vec<u8>,
27    >,
28}
29/// Metadata of one Lance file.
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct Metadata {
32    /// Position of the manifest in the file. If it is zero, the manifest is stored
33    /// externally.
34    #[prost(uint64, tag = "1")]
35    pub manifest_position: u64,
36    /// Logical offsets of each chunk group, i.e., number of the rows in each
37    /// chunk.
38    #[prost(int32, repeated, tag = "2")]
39    pub batch_offsets: ::prost::alloc::vec::Vec<i32>,
40    /// The file position that page table is stored.
41    ///
42    /// A page table is a matrix of N x M x 2, where N = num_fields, and M =
43    /// num_batches. Each cell in the table is a pair of <position:int64,
44    /// length:int64> of the page. Both position and length are int64 values. The
45    /// <position, length> of all the pages in the same column are then
46    /// contiguously stored.
47    ///
48    /// Every field that is a part of the file will have a run in the page table.
49    /// This includes struct columns, which will have a run of length 0 since
50    /// they don't store any actual data.
51    ///
52    /// For example, for the column 5 and batch 4, we have:
53    /// ```text
54    ///    position = page_table[5][4][0];
55    ///    length = page_table[5][4][1];
56    /// ```
57    #[prost(uint64, tag = "3")]
58    pub page_table_position: u64,
59    #[prost(message, optional, tag = "5")]
60    pub statistics: ::core::option::Option<metadata::StatisticsMetadata>,
61}
62/// Nested message and enum types in `Metadata`.
63pub mod metadata {
64    #[derive(Clone, PartialEq, ::prost::Message)]
65    pub struct StatisticsMetadata {
66        /// The schema of the statistics.
67        ///
68        /// This might be empty, meaning there are no statistics. It also might not
69        /// contain statistics for every field.
70        #[prost(message, repeated, tag = "1")]
71        pub schema: ::prost::alloc::vec::Vec<super::Field>,
72        /// The field ids of the statistics leaf fields.
73        ///
74        /// This plays a similar role to the `fields` field in the DataFile message.
75        /// Each of these field ids corresponds to a field in the stats_schema. There
76        /// is one per column in the stats page table.
77        #[prost(int32, repeated, tag = "2")]
78        pub fields: ::prost::alloc::vec::Vec<i32>,
79        /// The file position of the statistics page table
80        ///
81        /// The page table is a matrix of N x 2, where N = length of stats_fields.
82        /// This is the same layout as the main page table, except there is always
83        /// only one batch.
84        ///
85        /// For example, to get the stats column 5, we have:
86        /// ```text
87        ///    position = stats_page_table[5][0];
88        ///    length = stats_page_table[5][1];
89        /// ```
90        #[prost(uint64, tag = "3")]
91        pub page_table_position: u64,
92    }
93}
94/// Dictionary field metadata
95#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
96pub struct Dictionary {
97    /// / The file offset for storing the dictionary value.
98    /// / It is only valid if encoding is DICTIONARY.
99    /// /
100    /// / The logic type presents the value type of the column, i.e., string value.
101    #[prost(int64, tag = "1")]
102    pub offset: i64,
103    /// / The length of dictionary values.
104    #[prost(int64, tag = "2")]
105    pub length: i64,
106}
107/// Field metadata for a column.
108#[derive(Clone, PartialEq, ::prost::Message)]
109pub struct Field {
110    #[prost(enumeration = "field::Type", tag = "1")]
111    pub r#type: i32,
112    /// Fully qualified name.
113    #[prost(string, tag = "2")]
114    pub name: ::prost::alloc::string::String,
115    /// / Field Id.
116    /// /
117    /// / See the comment in `DataFile.fields` for how field ids are assigned.
118    #[prost(int32, tag = "3")]
119    pub id: i32,
120    /// / Parent Field ID. If not set, this is a top-level column.
121    #[prost(int32, tag = "4")]
122    pub parent_id: i32,
123    /// Logical types, support parameterized Arrow Type.
124    ///
125    /// PARENT types will always have logical type "struct".
126    ///
127    /// REPEATED types may have logical types:
128    /// * "list"
129    /// * "large_list"
130    /// * "list.struct"
131    /// * "large_list.struct"
132    /// The final two are used if the list values are structs, and therefore the
133    /// field is both implicitly REPEATED and PARENT.
134    ///
135    /// LEAF types may have logical types:
136    /// * "null"
137    /// * "bool"
138    /// * "int8" / "uint8"
139    /// * "int16" / "uint16"
140    /// * "int32" / "uint32"
141    /// * "int64" / "uint64"
142    /// * "halffloat" / "float" / "double"
143    /// * "string" / "large_string"
144    /// * "binary" / "large_binary"
145    /// * "date32:day"
146    /// * "date64:ms"
147    /// * "decimal:128:{precision}:{scale}" / "decimal:256:{precision}:{scale}"
148    /// * "time:{unit}" / "timestamp:{unit}" / "duration:{unit}", where unit is
149    /// "s", "ms", "us", "ns"
150    /// * "dict:{value_type}:{index_type}:false"
151    #[prost(string, tag = "5")]
152    pub logical_type: ::prost::alloc::string::String,
153    /// If this field is nullable.
154    #[prost(bool, tag = "6")]
155    pub nullable: bool,
156    /// optional field metadata (e.g. extension type name/parameters)
157    #[prost(map = "string, bytes", tag = "10")]
158    pub metadata: ::std::collections::HashMap<
159        ::prost::alloc::string::String,
160        ::prost::alloc::vec::Vec<u8>,
161    >,
162    #[prost(bool, tag = "12")]
163    pub unenforced_primary_key: bool,
164    /// Position of this field in the primary key (1-based).
165    /// 0 means the field is part of the primary key but uses schema field id for ordering.
166    /// When set to a positive value, primary key fields are ordered by this position.
167    #[prost(uint32, tag = "13")]
168    pub unenforced_primary_key_position: u32,
169    /// Reserved for future use. Use unenforced_clustering_key_position instead.
170    #[prost(bool, tag = "14")]
171    pub unenforced_clustering_key: bool,
172    /// Position of this field in the clustering key (1-based).
173    /// 0 means the field is not part of the clustering key.
174    #[prost(uint32, tag = "15")]
175    pub unenforced_clustering_key_position: u32,
176    /// Deprecated: Only used in V1 file format. V2 uses variable encodings defined
177    /// per page.
178    ///
179    /// The global encoding to use for this field.
180    #[prost(enumeration = "Encoding", tag = "7")]
181    pub encoding: i32,
182    /// Deprecated: Only used in V1 file format. V2 dynamically chooses when to
183    /// do dictionary encoding and keeps the dictionary in the data files.
184    ///
185    /// The file offset for storing the dictionary value.
186    /// It is only valid if encoding is DICTIONARY.
187    ///
188    /// The logic type presents the value type of the column, i.e., string value.
189    #[prost(message, optional, tag = "8")]
190    pub dictionary: ::core::option::Option<Dictionary>,
191    /// Deprecated: optional extension type name, use metadata field
192    /// ARROW:extension:name
193    #[prost(string, tag = "9")]
194    pub extension_name: ::prost::alloc::string::String,
195}
196/// Nested message and enum types in `Field`.
197pub mod field {
198    #[derive(
199        Clone,
200        Copy,
201        Debug,
202        PartialEq,
203        Eq,
204        Hash,
205        PartialOrd,
206        Ord,
207        ::prost::Enumeration
208    )]
209    #[repr(i32)]
210    pub enum Type {
211        Parent = 0,
212        Repeated = 1,
213        Leaf = 2,
214    }
215    impl Type {
216        /// String value of the enum field names used in the ProtoBuf definition.
217        ///
218        /// The values are not transformed in any way and thus are considered stable
219        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
220        pub fn as_str_name(&self) -> &'static str {
221            match self {
222                Self::Parent => "PARENT",
223                Self::Repeated => "REPEATED",
224                Self::Leaf => "LEAF",
225            }
226        }
227        /// Creates an enum from field names used in the ProtoBuf definition.
228        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
229            match value {
230                "PARENT" => Some(Self::Parent),
231                "REPEATED" => Some(Self::Repeated),
232                "LEAF" => Some(Self::Leaf),
233                _ => None,
234            }
235        }
236    }
237}
238/// Supported encodings.
239#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
240#[repr(i32)]
241pub enum Encoding {
242    /// Invalid encoding.
243    None = 0,
244    /// Plain encoding.
245    Plain = 1,
246    /// Var-length binary encoding.
247    VarBinary = 2,
248    /// Dictionary encoding.
249    Dictionary = 3,
250    /// Run-length encoding.
251    Rle = 4,
252}
253impl Encoding {
254    /// String value of the enum field names used in the ProtoBuf definition.
255    ///
256    /// The values are not transformed in any way and thus are considered stable
257    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
258    pub fn as_str_name(&self) -> &'static str {
259        match self {
260            Self::None => "NONE",
261            Self::Plain => "PLAIN",
262            Self::VarBinary => "VAR_BINARY",
263            Self::Dictionary => "DICTIONARY",
264            Self::Rle => "RLE",
265        }
266    }
267    /// Creates an enum from field names used in the ProtoBuf definition.
268    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
269        match value {
270            "NONE" => Some(Self::None),
271            "PLAIN" => Some(Self::Plain),
272            "VAR_BINARY" => Some(Self::VarBinary),
273            "DICTIONARY" => Some(Self::Dictionary),
274            "RLE" => Some(Self::Rle),
275            _ => None,
276        }
277    }
278}