uros-b commented on code in PR #58450:
URL: https://github.com/apache/spark/pull/58450#discussion_r3927321648


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/jsonExpressions.scala:
##########
@@ -1651,6 +1651,129 @@ object JsonArray {
   }
 }
 
+// Built-in forms for the plain SQL/JSON constructor and path-function calls 
that `AstBuilder`
+// routes through function resolution. Each rebuilds its expression with the 
standard clause
+// defaults when unshadowed.
+
+@ExpressionDescription(
+  usage = "_FUNC_([expr[, ...]]) - Returns a JSON array string with NULL 
elements dropped.",
+  arguments = """
+    Arguments:
+      * expr - the elements to place in the array.
+  """,
+  examples = """
+    Examples:
+      > SELECT _FUNC_(1, 'x', true);
+       [1,"x",true]
+      > SELECT _FUNC_(1, NULL, 3);
+       [1,3]
+      > SELECT _FUNC_();
+       []
+  """,
+  since = "4.4.0",
+  group = "json_funcs")
+object JsonArrayExpressionBuilder extends ExpressionBuilder {
+  override def build(funcName: String, expressions: Seq[Expression]): 
Expression = {
+    // A routed call carries no lexical FORMAT JSON, so every element is a 
plain value (quoted).
+    // Splicing a nested constructor is only reachable via `JSON_ARRAY(...)` 
syntax (which freezes

Review Comment:
   Worth making the user-visible consequence explicit: after this change 
json_array(json_array(1)) returns [[1]] (grammar path, spliced) but the 
newly-reachable builtin.json_array(json_array(1)) returns ["[1]"] (routed path, 
quoted), same built-in, two spellings, different output. You've pinned it with 
a test and called it out as a follow-up, which is the right call since the 
qualified spelling is new. Could you please link the tracking JIRA here so the 
divergence isn't lost after merge?



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