Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-parquet/src/parquet/metadata/column_order.rs
6940 views
1
#[cfg(feature = "serde")]
2
use serde::{Deserialize, Serialize};
3
4
use super::sort::SortOrder;
5
6
/// Column order that specifies what method was used to aggregate min/max values for
7
/// statistics.
8
///
9
/// If column order is undefined, then it is the legacy behaviour and all values should
10
/// be compared as signed values/bytes.
11
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
13
pub enum ColumnOrder {
14
/// Column uses the order defined by its logical or physical type
15
/// (if there is no logical type), parquet-format 2.4.0+.
16
TypeDefinedOrder(SortOrder),
17
/// Undefined column order, means legacy behaviour before parquet-format 2.4.0.
18
/// Sort order is always SIGNED.
19
Undefined,
20
}
21
22
impl ColumnOrder {
23
/// Returns sort order associated with this column order.
24
pub fn sort_order(&self) -> SortOrder {
25
match *self {
26
ColumnOrder::TypeDefinedOrder(order) => order,
27
ColumnOrder::Undefined => SortOrder::Signed,
28
}
29
}
30
}
31
32