[ 
https://issues.apache.org/jira/browse/SPARK-59144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ganesha S updated SPARK-59144:
------------------------------
        Parent: SPARK-58686
    Issue Type: Sub-task  (was: Improvement)

> Plain SQL/JSON constructor function calls bypass routine resolution
> -------------------------------------------------------------------
>
>                 Key: SPARK-59144
>                 URL: https://issues.apache.org/jira/browse/SPARK-59144
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 4.4.0
>            Reporter: Ganesha S
>            Priority: Major
>
> {\{JSON_VALUE}}, \{{JSON_QUERY}}, \{{JSON_EXISTS}}, and \{{JSON_ARRAY}} each 
> have a dedicated \{{primaryExpression}} grammar branch placed before 
> \{{#functionCall}}. A plain call with no constructor clause is syntactically 
> identical to an ordinary function call, but the parser builds it straight 
> into the constructor expression, so it never goes through function 
> resolution. This bypasses the SQL PATH -- a same-named routine cannot shadow 
> it -- and none of these names are registered in \{{FunctionRegistry}}.
> Example:
> {code:sql}
> SET spark.sql.path.enabled=true;
> CREATE TEMPORARY FUNCTION json_value(a STRING, b STRING) RETURNS STRING 
> RETURN 'shadowed';
> SET PATH = system.session, system.builtin;
> SELECT json_value('\{"a":1}', '$.a');
> --  before: 1          (built-in constructor; the temporary routine is 
> ignored)
> --  after : shadowed   (the routine on the session path shadows the built-in)
> {code}
> Fix: route the clause-free form through normal function resolution (emit 
> \{{UnresolvedFunction}}) and register the four names as built-ins that 
> rebuild the expression with the standard clause defaults when unshadowed. 
> Clause-bearing and nested-constructor forms stay on the direct-construction 
> path. Mirrors how \{{EXTRACT}} defers to its registered \{{extract}} 
> built-in. 



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