anoopj commented on code in PR #3483:
URL: https://github.com/apache/iceberg-rust/pull/3483#discussion_r4361159790


##########
crates/iceberg/src/scan/context.rs:
##########
@@ -95,7 +118,33 @@ impl ManifestFileContext {
 
         let manifest = object_cache.get_manifest(&manifest_file).await?;
 
+        // A manifest written under an older schema stores partition values in 
that
+        // schema's (narrower) types. When the current partition type widens 
the one the
+        // manifest was written with (e.g. an int source column promoted to 
long), widen
+        // each entry's partition tuple here so the pruning evaluator and the 
delete-file
+        // index compare like-typed values. The gate compares the partition 
types
+        // themselves, not schema ids, since v1 may omit them (defaulting to 
0). Column
+        // bounds are widened lazily where the metrics evaluator compares them.
+        let promotion_target: Option<(StructType, StructType)> = match 
partition_spec.as_ref() {
+            Some(spec) => {
+                let current = spec.partition_type(&snapshot_schema)?;
+                let written = 
spec.partition_type(manifest.metadata().schema())?;
+                partition_types_differ(&current, &written).then_some((current, 
written))
+            }
+            None => None,
+        };
+
         for manifest_entry in manifest.entries() {
+            let manifest_entry = match promotion_target.as_ref() {
+                Some((current, written)) => {
+                    let mut entry = manifest_entry.as_ref().clone();

Review Comment:
   yes, that is a good idea. 



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