Ganesha S created SPARK-59243:
---------------------------------

             Summary: Splice nested SQL/JSON constructors reached through 
routed or qualified JSON_ARRAY calls
                 Key: SPARK-59243
                 URL: https://issues.apache.org/jira/browse/SPARK-59243
             Project: Spark
          Issue Type: Sub-task
          Components: SQL
    Affects Versions: 4.4.0
            Reporter: Ganesha S


SPARK-59144 routed clause-free JSON_ARRAY / JSON_VALUE / JSON_QUERY / 
JSON_EXISTS calls through routine resolution so a temp/persistent function can 
shadow the built-in. A routed call carries no lexical FORMAT JSON, so 
JsonArrayExpressionBuilder rebuilds every element as a plain (quoted) value. As 
a result, the same built-in produces different output for two spellings of a 
nested constructor:

 - json_array(json_array(1)) (grammar path, format frozen lexically) splices: 
[[1]]
 - builtin.json_array(json_array(1)) (routed path, newly reachable via the 
qualified spelling) quotes: ["[1]"]

The divergence stems from losing the lexical implicit-FORMAT JSON intent at the 
UnresolvedFunction boundary. The fix is to carry that intent as argument 
metadata through normal resolution (e.g. via a tree-node tag read through the 
analyzer-inserted recoloring casts) so nested constructors reached through a 
routed/qualified call splice like the grammar path, and object-level collation 
recoloring stays consistent.

The behavior is pinned by a test in JsonArraySuite in the parent PR. Scoped out 
of SPARK-59144 because the qualified spelling is newly reachable (no 
regression) and shadowing does not depend on it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to