alamb opened a new pull request, #27922: URL: https://github.com/apache/datafusion/pull/27922
## Which issue does this PR close? - Follow on to https://github.com/apache/datafusion/pull/27063#issuecomment-6963152453 - Related to https://github.com/apache/datafusion/issues/17802 ## Rationale for this change While testing the sqlparser upgrade in https://github.com/apache/datafusion/pull/27063, @blaginin found that `SELECT * FROM only` stopped working for a table named `only`. No test on `main` covered that query, so the regression was only found by hand. Whether an unquoted keyword is accepted as a table or column name is decided by sqlparser, and it changes between sqlparser releases. This PR records the current behavior so that the next upgrade shows the differences in CI. ## What changes are included in this PR? A new `keyword_identifiers.slt` file. It has no code changes. To choose the queries, I parsed every sqlparser keyword as an unquoted identifier in about 70 query shapes with `GenericDialect`, using sqlparser 0.63.0 (what `main` uses), 0.64.0 and sqlparser `main` (`20a8c47a`), and kept the keywords and shapes whose result changed: | Keywords | Position | 0.63.0 | 0.64.0 | sqlparser `main` | | --- | --- | --- | --- | --- | | `only` | table name | works | parse error | works (fixed by https://github.com/apache/datafusion-sqlparser-rs/pull/3003) | | `on`, `where`, `limit`, `into`, `having` | table name | works | parse error | parse error (https://github.com/apache/datafusion-sqlparser-rs/pull/2633) | | `where`, `limit`, `into`, `having`, `window`, `union`, `order`, `offset`, `intersect`, `group`, `for`, `fetch`, `except` | column name in the `SELECT` list | works | parse error or different parse | parse error or different parse | For each table name keyword the file queries the table unquoted, with and without an alias, with a `WHERE` clause, in a comma join, in a `JOIN` and as a CTE name. For each column name keyword it selects the column alone, first in a list and in an expression. ## What is the testing strategy for this PR? This PR only adds tests. They pass on `main`: ```shell cargo test --profile ci -p datafusion-sqllogictest --test sqllogictests -- keyword_identifiers ``` I also ran the new file against the head of https://github.com/apache/datafusion/pull/27063 (sqlparser `ba850faf`). The `only` queries pass there, and the `on`, `where`, `limit`, `into` and `having` table name queries fail with errors like `Expected: table name, found: on`. ## Are there any user-facing changes? No. -- 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]
