davidm-db opened a new pull request, #47272:
URL: https://github.com/apache/spark/pull/47272

   ### What changes were proposed in this pull request?
   `SET` statement is used to set config values and it has a poorly designed 
grammar rule `#setConfiguration` that matches everything after `SET` - `SET 
.*?`. This conflicts with the usage of `SET` for setting session variables, and 
we needed to introduce `SET (VAR | VARIABLE)` grammar rule to make distinction 
between setting the config values and session variables.
   
   However, this is not by SQL standard, so for SQL scripting 
([JIRA](https://issues.apache.org/jira/browse/SPARK-48338)) we are opting to 
disable `SET` for configs and use it only for session variables. Config values 
can still be set from SQL scripts using `EXECUTE IMMEDIATE`.
   
   This change simply reorders grammar rules to achieve above behavior, and 
alters only visitor functions where name of the rule had to be changed or 
completely new rule was added.
   
   ### Why are the changes needed?
   These changes are supposed to resolve the issues poorly designed `SET` 
statement for the case of SQL scripts.
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   This PR is in a series of PRs that will introduce changes to sql() API to 
add support for SQL scripting, but for now, the API remains unchanged.
   In the future, the API will remain the same as well, but it will have new 
possibility to execute SQL scripts.
   
   ### How was this patch tested?
   Already existing tests should cover the changes.
   New tests for SQL scripts were added to:
   - `SqlScriptingParserSuite`
   - `SqlScriptingInterpreterSuite`
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   <!--
   If generative AI tooling has been used in the process of authoring this 
patch, please include the
   phrase: 'Generated-by: ' followed by the name of the tool and its version.
   If no, write 'No'.
   Please refer to the [ASF Generative Tooling 
Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
   -->
   


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