You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "wzhfy (via GitHub)" <gi...@apache.org> on 2023/05/18 01:43:24 UTC

[GitHub] [spark] wzhfy commented on a diff in pull request #41162: [SPARK-43491][SQL] In expression should act as same as EqualTo when elements in IN expression have same DataType.

wzhfy commented on code in PR #41162:
URL: https://github.com/apache/spark/pull/41162#discussion_r1197253055


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala:
##########
@@ -509,16 +509,25 @@ case class In(value: Expression, list: Seq[Expression]) extends Predicate {
     val valueArg = ctx.freshName("valueArg")
     // All the blocks are meant to be inside a do { ... } while (false); loop.
     // The evaluation of variables can be stopped when we find a matching value.
-    val listCode = listGen.map(x =>
-      s"""
-         |${x.code}
-         |if (${x.isNull}) {
-         |  $tmpResult = $HAS_NULL; // ${ev.isNull} = true;
-         |} else if (${ctx.genEqual(value.dataType, valueArg, x.value)}) {
-         |  $tmpResult = $MATCHED; // ${ev.isNull} = false; ${ev.value} = true;
-         |  continue;
-         |}
-       """.stripMargin)
+    val listCode = listGen.map { x =>
+      val codeIf =
+        s"""
+           |${x.code}
+           |if (${x.isNull}) {
+           |  $tmpResult = $HAS_NULL; // ${ev.isNull} = true;
+           |}
+         """.stripMargin
+      val codeElseIf =
+        if (!java.lang.Boolean.parseBoolean(x.isNull.toString)) {

Review Comment:
   better to add a comment here



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org