feat(parser): add BIGQUERY, DATABRICKS and SNOWFLAKE dialect presets - #2515
feat(parser): add BIGQUERY, DATABRICKS and SNOWFLAKE dialect presets#2515fudianchn wants to merge 1 commit into
Conversation
|
Nice work, please consider my one comment on the Feature and then I would merge prompt. Thank you much for your contribution! |
|
@manticore-projects The comment on the Feature has not arrived on my side: the review still shows as pending (unsubmitted). Could you submit it? I will address it right away. |
|
Sorry for asking, are those 2 PRs not additive or redundant? |
d1d15f7 to
22f22ed
Compare
|
@manticore-projects Additive by design: #2514 carries the feature, this PR only the presets on top (the first four commits here are #2514's), and the description notes the same. Once #2514 merges, this diff shrinks to the presets commit. The boolean overload landed in #2514, with this PR rebased on it. |
22f22ed to
c143951
Compare
|
Thank you much! |
|
Please I will need a break for a few days to catch up with the massive wave of improvements and changes you have provided. |
Three warehouse presets for the lexer feature switches, each row taken from the vendor docs: BIGQUERY carries double quoted strings, # line comments, backslash escapes and the any-whitespace adjacent literal rule (GoogleSQL lexical structure; identifiers are backticked); DATABRICKS the same minus # comments (Spark literals; the double quoted identifiers switch is a non-default conf); SNOWFLAKE backslash escape sequences only, double quotes stay quoted identifiers (string and binary data types). Redshift was surveyed too and stays with the defaults on every switch, so it gains no preset entry. Follows up on the four warehouses named in JSQLParser#2512.
f2de173 to
0f40b3b
Compare
|
Rebased onto master Enjoy the break, there is no rush on this one; it will be ready whenever you are back. |
AI disclosure: this change was prepared with AI coding agents, reviewed and revised line by line by me.
What
Three warehouse presets, following up on the four warehouses named in #2512:
"#\Why
Every row is taken from the vendor docs, and Redshift, the fourth warehouse surveyed, matches the defaults on every switch and gains no entry.
') or double (\") quotation marks",#single-line comments, "Backslashes (\) introduce escape sequences", literal chunking where "the literal value is the concatenation of all these parts" across any whitespace ("Quoted identifiers don't concatenate"); identifiers are backticked.[ r ] { 'char [ ... ]' | "char [ ... ]" } [ ... ], the escape table, "Chains of string literals are coalesced into a single string literal". The Databricks KB adds that double quoted identifiers need the non-defaultdoubleQuotedIdentifiersconf, so the default reading is the string one, the same preset decision as MySQL and its ANSI_QUOTES mode in feat(parser): support double quoted string literals behind allowDoubleQuotedStrings #2513.#is not a Spark comment.\)", the double quote "is used (as needed) for delimiting object identifiers"; no adjacent-literal concatenation documented.", PG-style--comments, and no AWS docs sentence found for backslash escapes or adjacent literals (community evidence points to escapes, unverified), so every row stays with the default and no empty preset entry is added.Sources: GoogleSQL lexical structure, Spark literals, Databricks KB, double quoted identifiers, Snowflake string and binary data types, Redshift names.
How
Enum entries only;
withDialectis data driven since #2511 and unchanged. Stacked on #2514 for the WHITESPACE mode, the diff shrinks automatically once it merges.Testing
CCJSqlParserUtilTest:testDialectPresetsWarehouses(BigQuery backticks + escape +42#24swallowed as comment, Databricks double quoted string + escape +#stays the operator, Snowflake escape +#stays the operator),testDoubleQuotedStringsPresetextended (string reading for BigQuery and Databricks, identifier guard for Snowflake),testAdjacentStringLiteralsWhitespaceextended (the warehouse presets carry the mode, Snowflake stays the alias reading). All verified failing with a wrong row added or a right row removed (Databricks#on, Snowflake"on, BigQuery#off, WHITESPACE turned into NEWLINE); full suite green.