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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to