Ganesha S created SPARK-58729:
---------------------------------

             Summary: Support the ANSI SQL/JSON JSON_OBJECT constructor function
                 Key: SPARK-58729
                 URL: https://issues.apache.org/jira/browse/SPARK-58729
             Project: Spark
          Issue Type: Sub-task
          Components: SQL
    Affects Versions: 4.3.0
            Reporter: Ganesha S


Add the SQL:2016 JSON_OBJECT constructor (feature T811). It builds a JSON 
object from key/value pairs written as key VALUE value or key : value, controls 
null-valued keys via (NULL | ABSENT) ON NULL (default NULL ON NULL, i.e. null 
values are emitted as "k": null), and supports an optional RETURNING type 
(STRING default). Keys must be non-null strings; a null/non-string key raises 
an error. Nested JSON_OBJECT / JSON_ARRAY compose.

Today the only workaround is to_json(named_struct(...)), which cannot express 
ABSENT ON NULL and does not match the standard name used by Oracle, SQL Server 
(2022+), MySQL, Trino, BigQuery, and DuckDB, forcing manual rewrites when 
migrating.

Scope: add reserved tokens and a dedicated SqlBaseParser production (the 
argument list carries non-expression syntax), an AstBuilder visitor, a new 
Catalyst constructor expression reusing the existing Jackson JSON-generation 
path (to_json / StructsToJsonEvaluator), a nullBehavior enum, error conditions 
for null-key handling, docs, and golden-file + unit test coverage. VARIANT 
RETURNING is deferred (STRING-only v1).



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