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


##########
crates/iceberg/src/spec/values/datum.rs:
##########
@@ -1229,6 +1229,19 @@ impl Datum {
         &self.r#type
     }
 
+    /// Returns a copy whose literal is widened to `target` for the value
+    /// promotions `int` -> `long` and `float` -> `double`, so a value written
+    /// under the narrower type compares against a predicate bound to the wider
+    /// one. Any other `target` returns an unchanged copy; decimals already
+    /// compare across precisions.
+    pub(crate) fn promote_to(&self, target: &PrimitiveType) -> Datum {
+        match (&self.literal, target) {
+            (PrimitiveLiteral::Int(value), PrimitiveType::Long) => 
Datum::long(*value),
+            (PrimitiveLiteral::Float(value), PrimitiveType::Double) => 
Datum::double(value.0),
+            _ => self.clone(),
+        }
+    }

Review Comment:
   > I ended up doing the reader-side widening in this PR rather than a 
follow-up
   
   Thanks, that makes sense given the delete matching. Column bounds are still 
widened inside `InclusiveMetricsEvaluator` 
([`promote_bound`](https://github.com/apache/iceberg-rust/blob/642d8dd66a7b75e0ba3f61bd74863e340e91d93d/crates/iceberg/src/expr/visitors/inclusive_metrics_evaluator.rs#L134-L142)),
 while partition tuples are now widened once per entry in 
[`fetch_manifest_and_stream_manifest_entries`](https://github.com/apache/iceberg-rust/blob/642d8dd66a7b75e0ba3f61bd74863e340e91d93d/crates/iceberg/src/scan/context.rs#L118-L135).
 Should bounds move there too? If not in this PR, could you open an issue for 
it so the rest of @Fokko's suggestion stays tracked?



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