You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "charlesdong1991 (via GitHub)" <gi...@apache.org> on 2026/02/15 15:45:11 UTC
[PR] feat(datafusion): support isnan predicate pushdown to Iceberg [iceberg-rust]
charlesdong1991 opened a new pull request, #2142:
URL: https://github.com/apache/iceberg-rust/pull/2142
## Which issue does this PR close?
Part of the ongoing effort to improve predicate pushdown coverage in the DataFusion integration.
- Closes #.
## What changes are included in this PR?
This PR adds support for pushing down `isnan()` predicates from DataFusion to Iceberg's native `IsNan` / `NotNan` predicate operators.
In DataFusion, `isnan()` is represented as a scalar function (`Expr::ScalarFunction`) rather than a dedicated `Expr` variant (unlike `IsNull` / `IsNotNull`). This PR introduces a new `scalar_function_to_iceberg_predicate` helper in `expr_to_predicate.rs` that matches scalar functions by name at runtime and converts `isnan(col)` into `Predicate::Unary(IsNan, col)`.
Negation (`NOT isnan(col)`) is handled automatically: the existing `Expr::Not` arm wraps the result in `Predicate::Not(...)`, and Iceberg's downstream `rewrite_not` visitor normalizes it into `Predicate::Unary(NotNan, col)`.
This enables file pruning using `nan_value_counts` in manifest metadata for float/double columns, as defined in the [Iceberg spec — Manifest Files: field summaries and column statistics](https://iceberg.apache.org/spec/#manifests).
## Are these changes tested?
Yes
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] feat(datafusion): support isnan predicate pushdown to Iceberg [iceberg-rust]
Posted by "CTTY (via GitHub)" <gi...@apache.org>.
CTTY commented on code in PR #2142:
URL: https://github.com/apache/iceberg-rust/pull/2142#discussion_r2830688660
##########
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:
Could you create another issue to track complex numeric expression and left some TODO comments? An unary expression for isnan feels too limited to be useful
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] feat(datafusion): support isnan predicate pushdown to Iceberg [iceberg-rust]
Posted by "charlesdong1991 (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org