charlesdong1991 commented on code in PR #2142:
URL: https://github.com/apache/iceberg-rust/pull/2142#discussion_r2835059196
##########
crates/integrations/datafusion/src/physical_plan/expr_to_predicate.rs:
##########
@@ -681,4 +707,35 @@ mod tests {
Reference::new("bar").starts_with(Datum::string("测试"))
);
}
+
+ #[test]
+ fn test_predicate_conversion_with_isnan() {
+ let predicate = convert_to_iceberg_predicate("isnan(qux)").unwrap();
+ assert_eq!(predicate, Reference::new("qux").is_nan());
+ }
+
+ #[test]
+ fn test_predicate_conversion_with_not_isnan() {
+ let predicate = convert_to_iceberg_predicate("NOT
isnan(qux)").unwrap();
+ assert_eq!(predicate, !Reference::new("qux").is_nan());
+ }
+
+ #[test]
+ fn test_predicate_conversion_with_isnan_and_other_condition() {
+ let sql = "isnan(qux) AND foo > 1";
+ let predicate = convert_to_iceberg_predicate(sql).unwrap();
+ let expected_predicate = Predicate::and(
+ Reference::new("qux").is_nan(),
+ Reference::new("foo").greater_than(Datum::long(1)),
+ );
+ assert_eq!(predicate, expected_predicate);
+ }
+
+ #[test]
+ fn test_predicate_conversion_with_isnan_unsupported_arg() {
Review Comment:
Thanks for review! @CTTY
Added a TODO comment in function definition and create an issue:
https://github.com/apache/iceberg-rust/issues/2154
--
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]