Repository navigation
fix(rules): end the SQLCLEAN053 ON scan at a PIVOT USING list - #24
Merged
Merged
Conversation
A DuckDB PIVOT ... ON list is followed by USING aggregates, which the ON clause scan treated as aggregates inside a join condition.
The null comparison check scanned backwards from every comparison to find its clause, which is quadratic in long queries.
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
SQLBuild now runs the SQLClean Rules by default. Two engine issues surfaced in its compiler corpus and cold compile benchmarks:
PIVOT ... ON status USING MAX(amount)as an aggregate inside a join condition. TheONclause scan did not stop atUSING, so it ran into the pivot aggregates.Changes
USINGends the clause in the SQLCLEAN053 scan. A real aggregate in a joinONbeside a pivot still reports.assignment_operatorsfindsSETassignments in one forward pass that tracks the latest clause opener per depth. Same stop set and same-depth rule as before.Verification
ONaggregate next to a pivot still reports.cargo fmt --check, clippy-D warnings,cargo test --all, ruff, ty,fensu check(0 faults), the docs skill check and the hygiene scan pass.BEGIN_COMMIT_OVERRIDE
fix(rules): end the SQLCLEAN053 ON scan at a PIVOT USING list
perf(rules): find SET assignments in one forward pass
END_COMMIT_OVERRIDE