AngersZhuuuu commented on code in PR #37436:
URL: https://github.com/apache/spark/pull/37436#discussion_r941259665


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/util/SQLOpenHashSet.scala:
##########
@@ -85,12 +85,13 @@ object SQLOpenHashSet {
       index: String,
       hashSet: String,
       handleNotNull: (String, String) => String,
-      handleNull: String): String = {
+      handleNull: String,
+      nullConditions: Seq[String] = Seq.empty): String = {
     if (arrayContainsNull) {
       if (setContainsNull) {
         s"""
            |if ($array.isNullAt($index)) {
-           |  if (!$hashSet.containsNull()) {
+           |  if (!$hashSet.containsNull()${nullConditions.map(" &&" + 
_).mkString("")}) {

Review Comment:
   The whole stage codegen's code seems wrong ....in origins code it's ok seems 
it use a flag foundNullElement to flag if array2 contains null.
   
   ```
           def withArray1NullAssignment(body: String) =
             if (left.dataType.asInstanceOf[ArrayType].containsNull) {
               if (right.dataType.asInstanceOf[ArrayType].containsNull) {
                 s"""
                    |if ($array1.isNullAt($i)) {
                    |  if ($foundNullElement) {
                    |    $nullElementIndex = $size;
                    |    $foundNullElement = false;
                    |    $size++;
                    |    $builder.$$plus$$eq($nullValueHolder);
                    |  }
                    |} else {
                    |  $body
                    |}
                  """.stripMargin
               } else {
                 s"""
                    |if (!$array1.isNullAt($i)) {
                    |  $body
                    |}
                  """.stripMargin
               }
             } else {
               body
             }
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to