cloud-fan commented on code in PR #58005:
URL: https://github.com/apache/spark/pull/58005#discussion_r3897673844


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -4268,6 +4268,60 @@ class AstBuilder extends DataTypeAstBuilder
     JsonQuery(jsonExpr, path, returning, wrapper, quotes, onEmpty, onError)
   }
 
+  /**
+   * Resolve a `jsonConstructorNullBehavior` clause (`NULL` / `ABSENT`) into a
+   * [[JsonConstructorNullBehavior]].
+   */
+  private def buildJsonConstructorNullBehavior(
+      ctx: JsonConstructorNullBehaviorContext): JsonConstructorNullBehavior =
+    ctx match {
+      case _: JsonConstructorNullBehaviorNullContext =>
+        JsonConstructorNullBehavior.Null
+      case _: JsonConstructorNullBehaviorAbsentContext =>
+        JsonConstructorNullBehavior.Absent
+    }
+
+  /**
+   * Create a [[JsonArray]] expression for the SQL:2016 `JSON_ARRAY` 
constructor function.
+   * The `ON NULL` clause defaults to `ABSENT ON NULL` (drops NULL elements), 
and RETURNING
+   * defaults to STRING.
+   */
+  override def visitJsonArray(ctx: JsonArrayContext): Expression = 
withOrigin(ctx) {

Review Comment:
   **Blocking (P1):** This visitor is also selected for plain `JSON_ARRAY(1)` 
calls, so those calls no longer go through ordinary routine resolution. That 
breaks configured shadowing: with `system.session` before `system.builtin` in 
`SET PATH` and a temporary `json_array(x)` returning `x + 100`, this query used 
to return `101` but now constructs the string `[1]`. Please keep the plain 
argument-list form on normal routine lookup (registering the built-in there if 
needed), reserve the dedicated syntax path for constructor-only clauses, and 
add a `SET PATH` regression test with a shadowing temporary routine.



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