Repository navigation
Add test: ORDER BY <expression> (non-plain-column) skip branch in pushOrderByIntoView is untested - #109600
Conversation
|
Pre-PR Validation Gate (per ClickGap pipeline): a) Deterministic repro? ✅ b) Root cause explained? ✅ c) Fix matches root cause? ✅ d) Test intent preserved? / New tests added? ✅ e) Both directions demonstrated? ✅ f) Fix is general, not a narrow patch? ✅ |
|
Workflow [PR], commit [5a436ea] Summary: ✅ AI ReviewSummaryThis PR adds a focused stateless regression test for the Final VerdictStatus: ✅ Approve |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 120 line(s), 3 function(s) across 53 file(s) · Details Top files
|
1d27e24
…pr94102 Add test: `ORDER BY <expression>` (non-plain-column) skip branch in `pushOrderByIntoView` is untested
Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.
This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.
Adds test coverage for 1 untested code path(s), found during automated review of PR #94102.
That PR The PR adds
pushOrderByIntoViewinsrc/Planner/PlannerJoinTree.cpp, a Planner-stage rewrite that pushes an outer query'sORDER BY/LIMITinto a simple VIEW's inner query AST so that a VIEW over aDistributedtable can use the merge-sorted-streams optimization instead of a full coordinator s1.
ORDER BY <expression>(non-plain-column) skip branch inpushOrderByIntoViewis untestedsrc/Planner/PlannerJoinTree.cpp:1031Risk:
PlannerJoinTree.cpp:1029-1031 computescol = sort->getExpression()->as<ColumnNode>()and returns when!col. If this!colguard were dropped or broken, execution would continue tocol->getColumnSource()(line 1030) and latercol->getColumnName()(lines 1137/1168) on a null pointer, causing a SIGSEGV during planning of a very common query shape (SELECT ... FROM view ORDER BY <expr> LIMIT n); alternatively an incorrectly-pushed expression sort could truncate the wrong rows per shard …What's unique vs PR tests: The PR's 04241 test covers ~25 disable/enable cases but every
ORDER BYin it is a plain column (ts,id,x,v.ts). None exercises theORDER BY <expression>guard at line 1030-1031. This test is the only one that drives an expressionORDER BY(id % 10) throughpushOrderByIntoViewand asserts the pushdown is skipped.Tags:
-- Tags: no-random-settings—no-random-settings: the assertion counts 'Sorting for ORDER BY' plan steps, which is only deterministic under fixed plan-optimization settings; random settings could alter the plan shape and flake the referenceTry it on ClickHouse Fiddle
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not applicable — test-only change.
Documentation entry for user-facing changes
Version info
26.7.1.775(included in26.7and later)