Skip to content

Commit

Permalink
expose _serde::DataFile
Browse files Browse the repository at this point in the history
  • Loading branch information
ZENOTME committed Dec 13, 2024
1 parent 2e0b646 commit 0218dc7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/iceberg/src/spec/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,8 @@ impl std::fmt::Display for DataFileFormat {
}
}

pub use _serde::DataFile as SerializableDataFile;

mod _serde {
use std::collections::HashMap;

Expand Down Expand Up @@ -1299,9 +1301,10 @@ mod _serde {
}
}

/// DataFile representation that can used to be serialize.
#[serde_as]
#[derive(Serialize, Deserialize)]
pub(super) struct DataFile {
pub struct DataFile {
#[serde(default)]
content: i32,
file_path: String,
Expand All @@ -1325,6 +1328,7 @@ mod _serde {
}

impl DataFile {
/// Create a serializable data file from a DataFile
pub fn try_from(
value: super::DataFile,
partition_type: &StructType,
Expand Down Expand Up @@ -1354,6 +1358,8 @@ mod _serde {
sort_order_id: value.sort_order_id,
})
}

/// Convert a serializable data file back to DataFile
pub fn try_into(
self,
partition_type: &StructType,
Expand Down

0 comments on commit 0218dc7

Please sign in to comment.