Fokko commented on code in PR #945:
URL: https://github.com/apache/iceberg-rust/pull/945#discussion_r1944794188
##########
crates/integrations/datafusion/src/physical_plan/expr_to_predicate.rs:
##########
@@ -403,4 +419,39 @@ mod tests {
Reference::new("ts").greater_than_or_equal_to(Datum::string("2023-01-05T00:00:00"));
assert_eq!(predicate, expected_predicate);
}
+
+ #[test]
+ fn test_to_timestamp_comparison_creates_predicate() {
+ let sql = "TO_TIMESTAMP(ts) >= timestamp '2023-01-05T00:00:00'";
+ let predicate = convert_to_iceberg_predicate(sql).unwrap();
+ let expected_predicate =
+
Reference::new("ts").greater_than_or_equal_to(Datum::string("2023-01-05T00:00:00"));
+ assert_eq!(predicate, expected_predicate);
+ }
+
+ #[test]
+ fn test_to_timestamp_comparison_to_cast_creates_predicate() {
+ let sql = "TO_TIMESTAMP(ts) >= CAST('2023-01-05T00:00:00' AS
TIMESTAMP)";
Review Comment:
What are you trying to achieve in this PR? The following is far easier to
solve:
```suggestion
let sql = "ts >= CAST('2023-01-05T00:00:00' AS TIMESTAMP)";
```
As mentioned in the other comment, we don't want to transform all the values
in `ts`, so we want to do something smart there see
https://github.com/apache/iceberg-rust/pull/945#issuecomment-2639926317
--
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]