ZENOTME commented on code in PR #794: URL: https://github.com/apache/iceberg-rust/pull/794#discussion_r1884874229
########## crates/iceberg/src/spec/manifest.rs: ########## @@ -128,7 +130,61 @@ pub struct ManifestWriter { key_metadata: Vec<u8>, - field_summary: HashMap<i32, FieldSummary>, + partitions: Vec<Struct>, +} + +struct PartitionFieldStats { + partition_type: PrimitiveType, + summary: FieldSummary, +} + +impl PartitionFieldStats { + pub(crate) fn new(partition_type: PrimitiveType) -> Self { + Self { + partition_type, + summary: Default::default(), + } + } + + pub(crate) fn update(&mut self, value: Option<PrimitiveLiteral>) -> Result<()> { + if let Some(value) = value { + if !self.partition_type.compatible(&value) { + return Err(Error::new( + ErrorKind::DataInvalid, + "value is not compatitable with type", + )); + } + let value = Datum::new(self.partition_type.clone(), value); Review Comment: `Copy` is reasonable for me. We can change it and remove all `.clone` in another PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org