Repository navigation
Conversation
Migration query shapes and fingerprints, raw diff query shapes, relation names, fixture star keys and Snowflake's metadata-only CREATE now parse a native dialect's SQL with SQLQuack, and keep Polyglot only on the legacy route. SQL the native parser cannot read whole gets no proof, so the planner takes its conservative path. Cursor types parse unknown warehouse types with SQLQuack's parser. NativeDialect gains parse, and read_whole becomes a provided method over it, as the analysis route's follow-up defines them.
Contributor
Author
|
Superseded by #1363: the same commit on a branch name that passes the metadata check, with a shorter description. |
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.
Draft, stacked: the base is
wip/analysis-route-clickhouse, the ClickHouse analysis-route arm, which is not for merging on its own. This PR moves onto the analysis route's follow-up branch once that branch exists (it carriesNativeDialect::parse, anUnavailableroute and a short re-export).Why
The planner's proofs parse SQL with Polyglot directly, outside model analysis:
To remove Polyglot, each proof has to pick its parser the same way model analysis does, through
analysis_route. Each proof also has to fail safe: SQL the dialect's parser can't read gives no proof, and the planner takes its conservative path. A check is never skipped.Changes
NativeDialectgainsparse, which returns every statement with the parser's named gaps.read_wholebecomes a provided method overparse: one statement, no gap, and not a lone unparsedCommand. The ClickHouse arm implements onlyparse.analysis_route(dialect). On a native route it reads SQLQuack's tree. On the legacy route the Polyglot code is unchanged.query_shape)WITHmoved from its first SELECT onto the set operation, where ClickHouse's parser does not put itsqlquack-tree:prefix (SQLQuack has no SQL generator)None, the existing "cannot parse" answer; empty SQL still gives no relationsOn this branch only ClickHouse takes the native route. Snowflake's native path for the cost check is in place but inactive until Snowflake joins the route.
Differences from the Polyglot path
These come from a before/after run over the 716 compiled ClickHouse model bodies in SQLBuild's e2e projects and seed corpus, plus 137 warehouse type spellings. "Before" is this branch's base with every proof on Polyglot; "after" is this branch.
functioninstead ofupper), and no mutating kind appears or disappears.the clickhouse parser cannot read Empty queryinstead ofExpected 1 statement, found 0.VARCHAR(19)andVARCHAR(23)as the same ClickHouse type and the native tree keeps the length. So a native match is always a pair Polyglot also called equal.Release note
ClickHouse model renames are matched on a new migration fingerprint. A ClickHouse model renamed in the same change as this upgrade is not matched automatically against fingerprints stored by an earlier version. It is planned as a new model, as when no rename is found, and later renames match as before.
Verification
cargo test -p sqlbuild-analysis: 310 passed, 0 failed. This includes new tests for each native proof and for each one's refusal on SQL with a gap (INTO OUTFILE).NormalizedType, family included, against Polyglot's on 99 ClickHouse spellings.cargo clippy -p sqlbuild-analysis -p sqlbuild-python --all-targets -- -D warnings: clean.fensu check: 0 faults. Its Rust custom-rule host times out at 30 s in this environment, and does the same on an untouched checkout.