Repository navigation
Conversation
…e once A chain of one set operator converted to one nested, parenthesised level per branch, so every later pass over the output (above all the layout) did work proportional to the number of branches times the statement's length. A left operand that continues the chain with the same operator and needs no cast now prints without its parentheses, which DuckDB reads left to right as the nesting did, so the chain stays one level deep and each further branch adds the same laid-out output. The Snowflake parser sliced its source by character offsets by walking the whole text from the start on every call once the text held any non-ASCII character. It now builds the character-to-byte offsets once per parse, which also takes 2.6% off the strict-parsing instruction count; the baseline records the gain. Converted SQL loses the brackets, so the SQL size baseline records 5225 smaller cases and none larger.
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 25, 2026
Contributor
Author
|
Superseded: the flat chain printing landed with #279, and the parser change is carried, with two more conversion speed fixes, in a follow-up PR from feat/convert-bind-opt-out. |
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.
Why
Converting a long chain of one set operator (
a UNION ALL b UNION ALL c ..., typical of inline test fixtures) produced one nested, parenthesised level per branch, so later passes, the layout above all, did work proportional to branches times statement length. Separately, the Snowflake parser re-walked the whole text on every slice once it held a non-ASCII character.Changes
crates/sqlquack/tests/cli/test_set_chains.rs): nesting depth is constant at 4 and 64 branches; a work-count guard asserts each extra branch adds the same laid-out output; converted chains (mixed UNION / UNION ALL, EXCEPT, non-ASCII text) return the right rows on DuckDB.Verification
make check-ciandmake test-crate CRATE=sqlquackpass.sql-benchmark, which fails identically onmainon the same machine (decimal_divide~81x vs a recorded 37.4x); CI runs it on its own runners.