jopdorp commented on code in PR #3432:
URL: https://github.com/apache/iceberg-rust/pull/3432#discussion_r4422129598


##########
crates/iceberg/src/transaction/snapshot.rs:
##########
@@ -658,6 +664,78 @@ mod tests {
         assert_eq!(properties.get("removed-files-size").unwrap(), "100");
     }
 
+    #[test]
+    fn test_summary_keeps_decimal_scale_of_dropped_partition_source() {
+        let table = make_v2_minimal_table();
+        let without_d = table.metadata().current_schema().as_ref().clone();
+        let d = NestedField::required(
+            4,
+            "d",
+            Type::Primitive(PrimitiveType::Decimal {
+                precision: 9,
+                scale: 2,
+            }),
+        );
+        let x = NestedField::required(1, "x", 
Type::Primitive(PrimitiveType::Int));

Review Comment:
   Rebuilt the test in 5510b0b37 the way a real table gets there: `{d: 
decimal(9,2), x: int}` under the original spec, then `x` promoted to long, then 
`d` dropped, with the deleted file carrying `Literal::int(5)` so it hits 
`(Long, Int)`. Still expects `partitions.d=1.23/x=5`.



##########
crates/iceberg/src/transaction/snapshot.rs:
##########
@@ -431,11 +431,17 @@ impl<'a> SnapshotProducer<'a> {
                 .ok_or_else(|| {
                     invalid_data!("Unknown partition spec id {}", 
data_file.partition_spec_id)
                 })?;
-            summary_collector.remove_file(
-                data_file,
-                table_metadata.current_schema().clone(),
-                partition_spec.clone(),
-            );
+            // A dropped source column keeps its type, such as a decimal's 
scale, only in an
+            // older schema.
+            let schema = table_metadata
+                .schemas_iter()

Review Comment:
   Good point, 1c126a2dd resolves the schema once per `partition_spec_id` and 
reuses it for every removed file of that spec.



-- 
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