[SPARK-27161][SQL] improve the document of SQL keywords#24093
[SPARK-27161][SQL] improve the document of SQL keywords#24093cloud-fan wants to merge 2 commits intoapache:masterfrom
Conversation
| //============================ | ||
| // Start of the keywords list | ||
| //============================ | ||
| SELECT: 'SELECT'; |
There was a problem hiding this comment.
We should sort the keyword list. It's better to do it in a followup to keep the diff small for this PR.
|
|
||
| By default `spark.sql.parser.ansi.enabled` is false. | ||
|
|
||
| Below is a list of all the keywords in Spark SQL. |
There was a problem hiding this comment.
I noticed that this list does not exactly match the keywords in Spark, e.g. ABS is not keyword in Spark, SETMINUS is not in this list.
There was a problem hiding this comment.
@maropu can you take a closer look later?
There was a problem hiding this comment.
ok, I'll check and fix as followup.
|
cc @gatorsmile |
|
Test build #103501 has finished for PR 24093 at commit
|
| column names, column aliases, table aliases) in other contexts. Reserved keywords can't be used as | ||
| table alias, but can be used as other identifiers. | ||
| When `spark.sql.parser.ansi.enabled` is true, Spark SQL has two kinds of keywords: | ||
| * Reserved keywords: Keywords that reserved and can't be used as identifiers for table, view, column, alias, etc. |
There was a problem hiding this comment.
nit: * Reserved keywords: Keywords that are reserved and can't be used as identifiers for tables, views, columns, aliases, etc.?
| table alias, but can be used as other identifiers. | ||
| When `spark.sql.parser.ansi.enabled` is true, Spark SQL has two kinds of keywords: | ||
| * Reserved keywords: Keywords that reserved and can't be used as identifiers for table, view, column, alias, etc. | ||
| * Non-reserved keywords: Keywords that have a special meaning only in particular contexts and can be used as identifiers in other contexts. |
There was a problem hiding this comment.
nit: in other contexts. -> in the other contexts, e.g., SELECT 1 WEEK means interval type data, but WEEK can be used as identifiers?
|
|
||
| By default `spark.sql.parser.ansi.enabled` is false. | ||
|
|
||
| Below is a list of all the keywords in Spark SQL. |
There was a problem hiding this comment.
ok, I'll check and fix as followup.
| //============================ | ||
| // Start of the keywords list | ||
| //============================ | ||
| SELECT: 'SELECT'; |
| title: SQL Reserved/Non-Reserved Keywords | ||
| displayTitle: SQL Reserved/Non-Reserved Keywords | ||
| title: Spark SQL Keywords | ||
| displayTitle: Spark SQL Keywords |
There was a problem hiding this comment.
spark.sql.parser.ansi.enabled affects parsing behaviours, too, e.g., when true, it makes interval optional. In future, we could change the behaivour of overflow handling in execution for the more strict ANSI compliance. These behaivour changes affected by the ANSI option should be documented not in this document but in another document?
There was a problem hiding this comment.
Yea, this document is about keywords, not everything about the ansi mode.
| `spark.sql.parser.ansi.enabled`, which is false by default. | ||
| When `spark.sql.parser.ansi.enabled` is false, Spark SQL has two kinds of keywords: | ||
| * Non-reserved keywords: Keywords that have a special meaning only in particular contexts and can be used as identifiers in other contexts. | ||
| * Strict-non-reserved keywords: A strict version of non-reserved keywords, which can not be used as table alias. |
There was a problem hiding this comment.
Great and this new group is easy-to-understand.
|
retest this please |
1 similar comment
|
retest this please |
|
Test build #103534 has finished for PR 24093 at commit
|
|
retest this please |
|
Test build #103554 has finished for PR 24093 at commit
|
|
Thanks! Merged to master |
|
I'll fix some minor issues in follow-up. |
## What changes were proposed in this pull request? Make it more clear about how Spark categories keywords regarding to the config `spark.sql.parser.ansi.enabled` ## How was this patch tested? existing tests Closes #24093 from cloud-fan/parser. Authored-by: Wenchen Fan <wenchen@databricks.com> Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>
What changes were proposed in this pull request?
Make it more clear about how Spark categories keywords regarding to the config
spark.sql.parser.ansi.enabledHow was this patch tested?
existing tests