omerhadari commented on code in PR #945:
URL: https://github.com/apache/iceberg-rust/pull/945#discussion_r1954099783


##########
crates/integrations/datafusion/src/physical_plan/expr_to_predicate.rs:
##########
@@ -119,7 +122,53 @@ fn to_iceberg_predicate(expr: &Expr) -> TransformedResult {
                 _ => TransformedResult::NotTransformed,
             }
         }
-        Expr::Cast(c) => to_iceberg_predicate(&c.expr),
+        Expr::Cast(c) => {
+            if DataType::Date32 == c.data_type || DataType::Date64 == 
c.data_type {

Review Comment:
   Constant folding is being done I think, (e.g. `TO_TIMESTAMP(2+2)` `=>` 
`TO_TIMESTAMP(4)`) but I am not sure it makes sense to turn 
`TO_TIMESTAMP(<date_str>)` to `CAST(date_str AS TIMESTAMP)` as a simplification 
in Datafusion. Currently the implementation of `CAST` and `TO_TIMESTAMP` is the 
same with no parameters, but I don't think turning `TO_TIMESTAMP` to `CAST` is 
a "simplification" necessarily. It may even be counter intuitive and effect 
errors in some weird ways, with no gains to readability or performance.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to