tsreaper commented on code in PR #21759:
URL: https://github.com/apache/flink/pull/21759#discussion_r1089701066


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/SearchOperatorGen.scala:
##########
@@ -97,6 +97,9 @@ object SearchOperatorGen {
            |if (!${needle.nullTerm}) {
            |  $resultTerm = $negation$setTerm.contains(${needle.resultTerm});
            |  $nullTerm = !$resultTerm && $setTerm.containsNull();
+           |} else if (${sarg.nullAs == RexUnknownAs.TRUE}) {
+           |  $resultTerm = $negation$setTerm.containsNull();
+           |  $nullTerm = !$resultTerm && $setTerm.containsNull();

Review Comment:
   This is incorrect. Try `SELECT * FROM myTable WHERE a NOT IN (1, 2) or a IS 
NULL`.
   
   `sarg.nullAs` will be `RexUnknownAs.TRUE`, however `negation` will be `!` so 
if `a` is `NULL` this expression will be false. This is obviously incorrect.
   
   I guess `sarg.nullAs` defines what to return for `NULL`s, regardless of 
`sarg.isComplementedPoints`. As currently I'm mainly working on Flink Table 
Store I can't guarantee this guess is correct. You need to check for yourself. 
Please also show us where you get the information with your changes.
   
   I suggest you try different combinations of `(NOT) IN` and `IS (NOT) NULL`. 
Also try to add more test cases in `CalcITCase` to verify your changes for 
different expressions.



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

Reply via email to