[
https://issues.apache.org/jira/browse/SPARK-59728?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan resolved SPARK-59728.
---------------------------------
Fix Version/s: 4.4.0
Resolution: Fixed
Issue resolved by pull request 60336
[https://github.com/apache/spark/pull/60336]
> Keep canonical JSON_ARRAY SQL on the direct grammar path
> --------------------------------------------------------
>
> Key: SPARK-59728
> URL: https://issues.apache.org/jira/browse/SPARK-59728
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 4.4.0
> Reporter: Ganesha S
> Assignee: Ganesha S
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.4.0
>
>
> SPARK-58729 made `JsonObjectExpr.sql` always render an explicit ON NULL
> clause so a resolved built-in's canonical SQL reparses on the direct
> JSON_OBJECT grammar path instead of through routine resolution (where a
> same-named temp/persistent function could shadow it). JsonArray has the same
> latent gap but was left unchanged: JsonArray.sql omits its default ABSENT ON
> NULL clause, so a resolved built-in renders clause-free SQL that reparses as
> a routine-resolvable call.
> With a shadowing routine on the path:
> - json_array(1) (user text, clause-free) routes and is shadowed (intended).
> - JsonArray(...).sql renders JSON_ARRAY(1) (clause-free), which likewise
> reparses to the shadowable routine rather than the built-in, so the canonical
> SQL of a resolved built-in does not round-trip to the same built-in.
> The fix is to render an unambiguous direct-path marker (e.g. always emit the
> ON NULL clause) in JsonArray.sql, mirroring JsonObjectExpr, so a resolved
> JSON_ARRAY built-in round-trips to the built-in. There is a TODO at
> JsonObjectExpr.sql pointing here.
> Notes / scope:
> - Parse-time routing and shadowing of user-typed queries is unchanged; only
> .sql rendering is affected.
> - Column names for unaliased expressions derive from .sql (toPrettySQL), so
> this makes every default-behavior json_array column name carry an explicit
> clause (e.g. JSON_ARRAY(1 ABSENT ON NULL)). Golden files
> (sql-expression-schema.md, json-functions.sql.out) will need regeneration.
> - This is a consistency-with-JSON_OBJECT / round-trip-fidelity change rather
> than a clear bug fix, and it shares the universal shadowable-built-in
> behavior — weigh the column-name noise when deciding whether to proceed.
> - Distinct from SPARK-59243, which is about splicing nested constructors
> reached through routed/qualified input calls (carrying FORMAT JSON intent
> through resolution), not .sql rendering
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]