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



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
##########
@@ -133,6 +133,53 @@ object Size {
   def apply(child: Expression): Size = new Size(child)
 }
 
+
+/**
+ * Given an array, returns total number of elements in it.
+ */
+@ExpressionDescription(
+  usage = """
+    _FUNC_(expr) - Returns the size of an array.
+    The function returns null for null input if spark.sql.legacy.sizeOfNull is 
set to false or
+    spark.sql.ansi.enabled is set to true. Otherwise, the function returns -1 
for null input.
+    With the default settings, the function returns -1 for null input.
+  """,
+  examples = """
+    Examples:
+      > SELECT _FUNC_(array('b', 'd', 'c', 'a'));
+       4
+  """,
+  since = "3.3.0",
+  group = "collection_funcs")
+case class ArraySize(expr: Expression, legacySizeOfNull: Option[Boolean]) 
extends RuntimeReplaceable

Review comment:
       it's a new function, do we need to keep the legacy behavior?




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