You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "ZENOTME (via GitHub)" <gi...@apache.org> on 2025/04/02 05:14:56 UTC
Re: [PR] feat: Infer partition values from statistics [iceberg-rust]
ZENOTME commented on code in PR #1079:
URL: https://github.com/apache/iceberg-rust/pull/1079#discussion_r2024083268
##########
crates/iceberg/src/writer/file_writer/parquet_writer.rs:
##########
@@ -458,6 +459,54 @@ impl ParquetWriter {
Ok(builder)
}
+
+ #[allow(dead_code)]
+ fn partition_value_from_statistics(
+ table_spec: Arc<PartitionSpec>,
+ lower_bounds: &HashMap<i32, Datum>,
+ upper_bounds: &HashMap<i32, Datum>,
+ ) -> Result<Struct> {
+ let mut partition_literals: Vec<Option<Literal>> = Vec::new();
+
+ for field in table_spec.fields() {
+ if let (Some(lower), Some(upper)) = (
+ lower_bounds.get(&field.field_id),
+ upper_bounds.get(&field.field_id),
+ ) {
+ if !field.transform.preserves_order() {
+ return Err(Error::new(
+ ErrorKind::DataInvalid,
+ format!(
+ "cannot infer partition value for non linear partition field (needs to preserve order): {} with transform {}",
+ field.name, field.transform
+ ),
+ ));
+ }
+
+ if lower != upper {
Review Comment:
CMIIW, it looks like the possible lower upper can be different, and their partitions are the same. So we need to check `transform(lower) != transform(upper)`? iceberg-python has the same logic, should we fix it? cc @kevinjqliu @Fokko
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org