Repository navigation
Fix inconsistent AST formatting for SAMPLE with query-level OFFSET - #100579
Conversation
|
Workflow [PR], commit [cc83891] Summary: ✅ AI ReviewSummaryThis PR fixes ambiguous AST/query formatting for queries that combine ClickHouse Rules
Final Verdict
|
| /// of a query-level OFFSET. | ||
| bool format_from_first = sampleSize() && limitOffset() && !limitLength(); | ||
|
|
||
| if (format_from_first && tables()) |
There was a problem hiding this comment.
sampleSize() (which calls getFirstTableExpression(*this)) doesn't guarantee tables() already?
| SELECT formatQuery('FROM system.one SAMPLE 0.5 SELECT 1 OFFSET 10'); | ||
|
|
||
| -- When the OFFSET is a SAMPLE offset (SELECT-first), formatting should stay SELECT-first. | ||
| SELECT formatQuery('SELECT 1 FROM system.one SAMPLE 0.5 OFFSET 10'); |
There was a problem hiding this comment.
Could we add some SAMPLE + LIMIT + OFFSET? Something like:
SELECT formatQuery('SELECT 1 FROM system.one SAMPLE 0.5 LIMIT 5 OFFSET 10');
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 100.00% (20/20, 0 noise lines excluded) |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix inconsistent AST formatting for SAMPLE with query-level OFFSET. Closes #100576
Documentation entry for user-facing changes