bojana-db commented on code in PR #56864:
URL: https://github.com/apache/spark/pull/56864#discussion_r3737047094


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/variant/variantExpressions.scala:
##########
@@ -1490,6 +1490,60 @@ object VariantArrayAppendExpressionBuilder extends 
VariantArrayAppendExpressionB
 // scalastyle:on line.size.limit
 object TryVariantArrayAppendExpressionBuilder
     extends VariantArrayAppendExpressionBuilderBase(false)
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+  usage = "_FUNC_(v[, includeArrays]) - Recursively removes null fields from 
variant objects " +
+    "and null elements from arrays, unless `includeArrays` is false, in which 
case null " +
+    "elements in arrays are kept. Returns NULL if any argument is NULL.",
+  arguments = """
+    Arguments:
+      * v - A variant value to mutate.
+      * includeArrays - An optional boolean (default true).
+  """,
+  examples = """
+    Examples:
+      > SELECT _FUNC_(parse_json('{"a": 1, "b": null, "c": 3}'));
+       {"a":1,"c":3}
+      > SELECT _FUNC_(parse_json('[1, null, 3]'));
+       [1,3]
+      > SELECT _FUNC_(parse_json('{"a": {"b": null, "c": [1, null]}}'));
+       {"a":{"c":[1]}}
+      > SELECT _FUNC_(parse_json('{"a": [1, null], "b": null}'), false);
+       {"a":[1,null]}
+      > SELECT _FUNC_(NULL);
+       NULL
+  """,

Review Comment:
   Added examples and edited null references in usage section.



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