Repository navigation
Restore short-circuit of a filter on an empty IN set over a Nullable column - #116538
Conversation
|
yariks5s seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Workflow [PR], commit [94532e4] Summary: ✅
AI ReviewSummaryThis PR restores the empty-set short-circuit in Final Verdict✅ No review findings in the current patch. LLVM Coverage ReportMeasured on commit 94532e4.
Changed lines: Changed C/C++ lines covered: 28/31 (90.32%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units7 translation units recompiled, 9 s compile time in total, 7 of them have a recent master baseline. |
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=29 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
Cherry pick #116538 to 26.6: Restore short-circuit of a filter on an empty IN set over a Nullable column
…ty IN set over a Nullable column
Cherry pick #116538 to 26.7: Restore short-circuit of a filter on an empty IN set over a Nullable column
…ty IN set over a Nullable column
Cherry pick #116538 to 26.8: Restore short-circuit of a filter on an empty IN set over a Nullable column
…ty IN set over a Nullable column
Backport #116538 to 26.6: Restore short-circuit of a filter on an empty IN set over a Nullable column
Backport #116538 to 26.8: Restore short-circuit of a filter on an empty IN set over a Nullable column
Backport #116538 to 26.7: Restore short-circuit of a filter on an empty IN set over a Nullable column
…iled FilterTransform::prepare ends the read when the filter is false for every row once the sets are built. isAlwaysFalseByEmptySet (ClickHouse#116538) finds an `in`/`globalIn` over an empty set by following `and` nodes by name. With compile_expressions, ActionsDAG::compileFunctions replaces a compilable `and` with an LLVMFunction whose name is the CompileDAG dump and whose children are the INPUT nodes of the compiled DAG. The `in` (not compilable) becomes one of those children, but the walk stops at the compiled node because it is not named `and`. The updateHeader dry run does not fold it either: a 0-row `in` over a Nullable column is not constant, and LLVMExecutableFunction folds only when all arguments are constant. So the source is read to the end of the key range and every row is filtered out afterwards (ClickHouse#131133: 14 ms -> 203 ms on the synthetic repro, 29.7 s -> 214.6 s on the original query). ActionsDAG::getCompiledConjuncts, next to getCompiledFunctions, maps the i-th INPUT of the compiled DAG to the i-th child of the node (the order getCompilableDAG appends them in and compileFunctions swaps them in) and returns the children reached from the root through `and` FUNCTION nodes only. isAlwaysFalseByEmptySet recurses into them for a compiled node. Any other shape (non-LLVM function, a root that is not `and`, an input count mismatch) returns nothing, which is the previous behaviour. With query_plan_merge_filters (default), FilterStep splits AND atoms into separate filters, so a flat `a > 10 AND x IN (...)` leaves `and(<input>, in)` with no compilable child and is never compiled. The `and` is compiled when the remainder keeps a nested `and` (the issue's shape) or with query_plan_merge_filters = 0; the test covers both. Closes ClickHouse#131133 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a performance regression since 26.6: a query filtering a
Nullablecolumn withIN (subquery)read the whole table instead of skipping the read when the subquery returned no rows. Closes #116450Workflow [PR]
Sync PR [sync-upstream/pr/116538]
Version info
26.8.1.2038,26.7.6.48,26.6.4.48