feat(parser): add BIGQUERY, DATABRICKS and SNOWFLAKE dialect presets - #2515
Open
fudianchn wants to merge 6 commits into
Open
feat(parser): add BIGQUERY, DATABRICKS and SNOWFLAKE dialect presets#2515fudianchn wants to merge 6 commits into
fudianchn wants to merge 6 commits into
Conversation
…ingLiterals Three readings of two neighboring string literals: alias (MySQL, SQL Server, the current behavior), concatenated across a newline (the SQL standard and PostgreSQL), concatenated across any whitespace (GoogleSQL, Spark/Databricks). The mode lives in a String valued Feature like Feature.dialect, the merge is one guarded loop in PrimaryExpression using the token line numbers for the newline rule, producing a single merged StringValue. ANSI_SQL and POSTGRESQL presets carry NEWLINE. Implements item 3 of JSQLParser#2512.
The FeatureConfiguration seeds every configurable Feature with its declared default, so the mode is never null today; the guard keeps the predicate locally correct regardless.
Contributor
|
Nice work, please consider my one comment on the Feature and then I would merge prompt. Thank you much for your contribution! |
Contributor
Author
|
@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. |
manticore-projects
requested changes
Aug 27, 2026
Contributor
|
Sorry for asking, are those 2 PRs not additive or redundant? |
…, true = NEWLINE stores the AdjacentStringLiterals enum constant itself as the feature value
fudianchn
force-pushed
the
warehouse-presets
branch
from
August 27, 2026 07:43
d1d15f7 to
22f22ed
Compare
Contributor
Author
|
@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. |
… reattaching its javadoc
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.
fudianchn
force-pushed
the
warehouse-presets
branch
from
August 27, 2026 08:08
22f22ed to
c143951
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.