Repository navigation
Use ARRAY JOIN element conditions for index analysis - #118582
Conversation
|
Workflow [PR], commit [5e72c85] Summary: ✅
AI ReviewSummaryThis PR extends Final VerdictStatus: ✅ Approve LLVM Coverage ReportMeasured on commit 5e72c85.
Changed lines: Changed C/C++ lines covered: 44/45 (97.78%) · Uncovered code |
…s-through-array-join
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units19 translation units recompiled, 110 s compile time in total, 19 of them have a recent master baseline. |
…ColumnsPass The pass set the type of every reference to an ARRAY JOIN column (the first argument of `tupleElement`) to the type of the ARRAY JOIN expression, for every expression, pruned or not. The analyzer can give a reference a different type than the definition: `join_use_nulls` (ARRAY JOIN on the nullified side of a RIGHT/FULL JOIN) and `group_by_use_nulls` (the column is a ROLLUP/CUBE key) make it `Nullable`, and a `USING` key gives it the common supertype. After the overwrite `tupleElement` was re-resolved to the narrower type while its parent function still expected the old one, so the query tree validator of debug and sanitizer builds threw `LOGICAL_ERROR` "Function tupleElement(__array_join_exp_1, 'a') > 0 expects argument 1 to have Nullable(Int64) type but receives Int64 after running PruneArrayJoinColumns pass". Release builds were not affected: the planner rebuilds a function whose argument types do not match. Now `pruned_type` is set only when `pruneNestedFunctionArguments` actually pruned the expression, so references of other expressions keep their type, and a reference of a pruned expression keeps its own `Nullable`. A `USING` key or a matcher column is a direct reference, which marks the expression fully used, so it is never pruned. Found by the server-side AST fuzzer in Stress tests (PR ClickHouse#126991, ClickHouse#118582, ClickHouse#115763). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #117882
Related: #112241
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
A condition on an
ARRAY JOINelement, such asARRAY JOIN tags AS t WHERE t IN (...), is now used for skip index analysis the same wayarrayJoin(tags) IN (...)already isWorkflow [PR]
Sync PR [sync-upstream/pr/118582]