JingsongLi commented on code in PR #8395:
URL: https://github.com/apache/paimon/pull/8395#discussion_r3503098572
##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/PredicateConverter.java:
##########
@@ -194,10 +194,49 @@ public Predicate visit(CallExpression call) {
FieldReferenceExpression fieldRefExpr =
extractFieldReference(children.get(0)).orElseThrow(UnsupportedExpression::new);
return builder.equal(builder.indexOf(fieldRefExpr.getName()),
Boolean.FALSE);
+ } else if (func == BuiltInFunctionDefinitions.NOT) {
+ // NOT predicate - negate the inner predicate
+ Predicate innerPredicate = children.get(0).accept(this);
+ return
innerPredicate.negate().orElseThrow(UnsupportedExpression::new);
+ } else if (func == BuiltInFunctionDefinitions.IS_NOT_TRUE) {
+ FieldReferenceExpression fieldRefExpr =
+
extractFieldReference(children.get(0)).orElseThrow(UnsupportedExpression::new);
+ return builder.notEqual(builder.indexOf(fieldRefExpr.getName()),
Boolean.TRUE);
Review Comment:
This changes the NULL semantics of `IS NOT TRUE`. In SQL, `x IS NOT TRUE` is
true for both `FALSE` and `NULL`, but Paimon `NotEqual` returns false when the
field value is null (`PredicateTest.testNotEqual` covers this). With this
conversion, a filter like `WHERE bool_col IS NOT TRUE` can incorrectly prune
rows where `bool_col` is NULL. This needs to be represented as `isNull(field)
OR equal(field, false)` (or left unsupported) and should have a test for the
NULL row case.
--
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]