diff --git a/rust/src/errors.rs b/rust/src/errors.rs index 7b982b3cc3..fed0e823f8 100644 --- a/rust/src/errors.rs +++ b/rust/src/errors.rs @@ -228,6 +228,12 @@ impl From for DeltaTableError { } } +impl From for DeltaTableError { + fn from(value: serde_json::Error) -> Self { + DeltaTableError::InvalidStatsJson { json_err: value } + } +} + impl DeltaTableError { /// Crate a NotATable Error with message for given path. pub fn not_a_table(path: impl AsRef) -> Self { diff --git a/rust/src/writer/mod.rs b/rust/src/writer/mod.rs index e7dc5a38c5..74ea353181 100644 --- a/rust/src/writer/mod.rs +++ b/rust/src/writer/mod.rs @@ -13,6 +13,7 @@ use crate::DeltaTable; pub use json::JsonWriter; pub use record_batch::RecordBatchWriter; +pub use stats::create_add; pub mod json; pub mod record_batch; diff --git a/rust/src/writer/stats.rs b/rust/src/writer/stats.rs index 2e0878c6d6..5db22c7936 100644 --- a/rust/src/writer/stats.rs +++ b/rust/src/writer/stats.rs @@ -13,12 +13,13 @@ use parquet::{ use super::*; use crate::action::{Add, ColumnValueStat, Stats}; -pub(crate) fn create_add( +/// Creates an [`Add`] log action struct. +pub fn create_add( partition_values: &HashMap>, path: String, size: i64, file_metadata: &FileMetaData, -) -> Result { +) -> Result { let stats = stats_from_file_metadata(partition_values, file_metadata)?; let stats_string = serde_json::to_string(&stats)?;