sandeep-katta0102 commented on code in PR #38874:
URL: https://github.com/apache/spark/pull/38874#discussion_r1038061244


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala:
##########
@@ -4600,3 +4600,51 @@ case class ArrayExcept(left: Expression, right: 
Expression) extends ArrayBinaryL
   override protected def withNewChildrenInternal(
     newLeft: Expression, newRight: Expression): ArrayExcept = copy(left = 
newLeft, right = newRight)
 }
+
+@ExpressionDescription(
+  usage = "_FUNC_(array) - Removes null values from the array.",
+  examples = """
+    Examples:
+      > SELECT _FUNC_(array(1, 2, 3, null));
+       [1,2,3]
+  """,
+  group = "array_funcs",
+  since = "3.4.0")
+case class ArrayCompact(child: Expression)

Review Comment:
   ```
   scala>     val df_test = Seq(Seq(Array[Integer](1, null, 3), null, 
Array[Integer](null, 2, 3))).toDF("a")
   df_test: org.apache.spark.sql.DataFrame = [a: array<array<int>>]
   
   scala>     df_test.select(array_compact($"a")).show(false)
   +----------------------------+
   |array_compact(a)            |
   +----------------------------+
   |[[1, null, 3], [null, 2, 3]]|
   +----------------------------+
   
   ```
   I guess it is wrong, I believe I also need to traverse the element if it is 
of type Array. Great find!!!



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