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


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/SearchOperatorGen.scala:
##########
@@ -112,7 +114,7 @@ object SearchOperatorGen {
       var rangeChecks: Seq[GeneratedExpression] = 
sarg.rangeSet.asRanges.asScala.toSeq
         .map(RangeSets.map(_, rangeToExpression))
 
-      if (sarg.containsNull) {
+      if (sarg.nullAs == RexUnknownAs.TRUE) {
         rangeChecks =
           Seq(generateIsNull(target, new 
BooleanType(target.resultType.isNullable))) ++ rangeChecks
       }

Review Comment:
   I was confused about checking `needle` here...
   I updated it in a way like 
   ```
         // Based on https://issues.apache.org/jira/browse/CALCITE-4446 
description it is calculated as
         // for sarg.nullAs == RexUnknownAs.TRUE: X IS NULL OR X IN (...)
         // for sarg.nullAs == RexUnknownAs.FALSE: X IS NOT NULL AND (X IN 
(...))
         // for sarg.nullAs == RexUnknownAs.UNKNOWN: X IN (...)
   ```



-- 
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...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to