From ff11801b5eb0f36f211d46924988c87052debc4a Mon Sep 17 00:00:00 2001 From: Scott Donnelly Date: Thu, 4 Apr 2024 20:53:48 +0100 Subject: [PATCH] feat: add some misc getters required for manifest evaluation --- Cargo.toml | 2 +- crates/iceberg/src/expr/predicate.rs | 2 +- crates/iceberg/src/spec/manifest.rs | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 054fcc67f5..7c02b5eb9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ aws-sdk-glue = "1.21.0" bimap = "0.6" bitvec = "1.0.1" bytes = "1.5" -chrono = "0.4.34" +chrono = "~0.4.34" derive_builder = "0.20.0" either = "1" env_logger = "0.11.0" diff --git a/crates/iceberg/src/expr/predicate.rs b/crates/iceberg/src/expr/predicate.rs index da8a863d29..45e67200ce 100644 --- a/crates/iceberg/src/expr/predicate.rs +++ b/crates/iceberg/src/expr/predicate.rs @@ -46,7 +46,7 @@ impl Debug for LogicalExpression { } impl LogicalExpression { - fn new(inputs: [Box; N]) -> Self { + pub(crate) fn new(inputs: [Box; N]) -> Self { Self { inputs } } diff --git a/crates/iceberg/src/spec/manifest.rs b/crates/iceberg/src/spec/manifest.rs index 3daa5c2880..3ab584b63d 100644 --- a/crates/iceberg/src/spec/manifest.rs +++ b/crates/iceberg/src/spec/manifest.rs @@ -101,6 +101,11 @@ impl Manifest { entries: entries.into_iter().map(Arc::new).collect(), } } + + /// Get the ID for this Manifest's partition_spec [`PartitionSpec`] + pub fn partition_spec_id(&self) -> i32 { + self.metadata.partition_spec.spec_id + } } /// A manifest writer. @@ -868,6 +873,11 @@ impl ManifestEntry { &self.data_file.file_path } + /// Get a reference to the Partition Struct of the data file of this manifest entry + pub fn get_partition_struct(&self) -> &Struct { + &self.data_file.partition + } + /// Inherit data from manifest list, such as snapshot id, sequence number. pub(crate) fn inherit_data(&mut self, snapshot_entry: &ManifestFile) { if self.snapshot_id.is_none() {