marvinlanhenke commented on code in PR #309:
URL: https://github.com/apache/iceberg-rust/pull/309#discussion_r1547667177
##########
crates/iceberg/src/spec/transform.rs:
##########
@@ -261,6 +269,300 @@ impl Transform {
_ => self == other,
}
}
+
+ /// Projects a given predicate according to the transformation
+ /// specified by the `Transform` instance.
+ ///
+ /// This allows predicates to be effectively applied to data
+ /// that has undergone transformation, enabling efficient querying
+ /// and filtering based on the original, untransformed data.
+ ///
+ /// # Example
+ /// Suppose, we have row filter `a = 10`, and a partition spec
+ /// `bucket(a, 37) as bs`, if one row matches `a = 10`, then its partition
+ /// value should match `bucket(10, 37) as bs`, and we project `a = 10` to
+ /// `bs = bucket(10, 37)`
+ pub fn project(&self, name: String, predicate: &BoundPredicate) ->
Result<Option<Predicate>> {
+ let func = create_transform_function(self)?;
+
+ let projection = match predicate {
+ BoundPredicate::Unary(expr) => match self {
Review Comment:
I had the structure you suggested in an earlier version. I changed it the
other way around since `predicate` has the smaller cardinality, which allows me
to group more transforms into a single predicate match arm. I can change it
back, however this would introduce more match arms and some code duplication?
--
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]