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


##########
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:
   Note that this is `TO_TIMESTAMP`, not `TO_DATE` - so no truncation is 
supposed to occur, and the current implementation in this PR solves ok I think.
   
   For `TO_DATE` you are correct of course.



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