You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/09/23 15:21:17 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #34077: [SPARK-36829][SQL] Refactor NULL check for collectionOperators

cloud-fan commented on a change in pull request #34077:
URL: https://github.com/apache/spark/pull/34077#discussion_r714907048



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
##########
@@ -3532,22 +3509,29 @@ case class ArrayDistinct(child: Expression)
              |}
            """.stripMargin
 
-        val processArray = withArrayNullAssignment(
-          s"$jt $value = ${genGetValue(array, i)};" +
-            SQLOpenHashSet.withNaNCheckCode(elementType, value, hashSet, body,
-              (valueNaN: String) =>
-                s"""
-                   |$size++;
-                   |$builder.$$plus$$eq($valueNaN);
-                   |""".stripMargin))
+        val processArray = SQLOpenHashSet.withNullCheckCode(dataType, dataType, hashSet,

Review comment:
       can we follow the code style of the interpreted code path?
   ```
   val withNaNCheckCodeGenerator = (array: String, index: String) => ...
   val processArray = SQLOpenHashSet.withNullCheckCode(..., array => withNaNCheckCodeGenerator(array, _), ...)
   ```




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