sabir-akhadov-localstack commented on code in PR #2633:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2633#discussion_r4313008469
##########
src/parser/mod.rs:
##########
@@ -17008,6 +16934,16 @@ impl<'a> Parser<'a> {
// Stage reference: @mystage or @namespace.stage (e.g. Snowflake)
self.parse_snowflake_stage_table_factor()
} else {
+ // Unquoted reserved keywords, e.g. `ON`, are not table names.
+ let peek_keyword = if let Token::Word(w) =
&self.peek_token_ref().token {
+ w.keyword
+ } else {
+ Keyword::NoKeyword
+ };
+ if !self.dialect.is_table_factor(&peek_keyword, self) {
Review Comment:
This calls `is_table_factor` before the keyword is consumed, while the
trailing-comma caller in `parse_table_with_joins` calls it after
`next_token()`. Snowflake's override peeks past the keyword for `LIMIT <n>` and
`TABLE(`, so both arms are no-ops here. It still works because `TABLE(` is
handled earlier and `LIMIT` is not in Snowflake's list. Worth either consuming
and `prev_token()` like the comma site, or documenting the expected position on
the trait, so the next lookahead override does not diverge.
##########
tests/sqlparser_common.rs:
##########
@@ -1219,10 +1207,10 @@ fn parse_select_wildcard() {
#[test]
fn parse_count_wildcard() {
- verified_only_select("SELECT COUNT(*) FROM Order WHERE id = 10");
+ verified_only_select("SELECT COUNT(*) FROM orders WHERE id = 10");
Review Comment:
This rename shows the change goes beyond `ON`: Snowflake's whole
table-factor list now applies at the table position, and Generic rejects the
five words too. Both match the docs, but they should be called out as breaking
in the description/changelog.
--
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]