Skip to content

Backport #111604 to 26.3: Set skip index: route NULL-constant atoms to UNKNOWN so granules are not wrongly pruned - #130735

Merged
PedroTadim merged 2 commits into
26.3from
backport/26.3/111604
Nov 12, 2026
Merged

PedroTadim merged 2 commits into
26.3from
backport/26.3/111604

Conversation

@robot-ch-test-poll4

Copy link
Copy Markdown
Contributor

Original pull-request #111604

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

…o UNKNOWN so granules are not wrongly pruned
@robot-ch-test-poll4 robot-ch-test-poll4 added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default labels Nov 11, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [0f5f672]

Summary: ✅

@groeneai

Copy link
Copy Markdown
Collaborator

The build fails in MergeTreeIndexSet.cpp:583-584: the cherry-picked hunk uses the ColumnConstPtr alias and the ActionsDAG::addColumn(column, type, name) overload, both from #104890, which is not on 26.3. Here createColumnConst returns a ColumnPtr and addColumn takes a ColumnWithTypeAndName, so changing the type alone is not enough.

A one-commit fix (2 lines, a fast-forward of backport/26.3/111604) is on my fork. I cannot push to this branch; someone with write access can apply it with:

git fetch https://github.com/groeneai/ClickHouse fix-backport-26.3-111604 && git push origin FETCH_HEAD:backport/26.3/111604
-                    ColumnConstPtr unknown_column = unknown_type->createColumnConst(1, UNKNOWN_FIELD);
-                    const auto & unknown_node = result_dag.addColumn(std::move(unknown_column), std::move(unknown_type), std::move(unknown_name));
+                    ColumnPtr unknown_column = unknown_type->createColumnConst(1, UNKNOWN_FIELD);
+                    const auto & unknown_node = result_dag.addColumn({unknown_column, unknown_type, unknown_name});

Checked on this branch with clang-21 (Debug): it builds, 04627_set_index_null_const_no_prune and 03707_set_index_bad_get_null_bug pass (also 50 times each with randomized settings), and with the MergeTreeIndexSet.cpp hunk reverted both fail.

Merging this alone also brings the pruning loss of #123705 to 26.3: a set index on a Nullable column then keeps every granule whose set contains NULL for IN and = conditions (results are unchanged). #123778 fixed that on master; it is not on 26.3, and its 26.8 and 26.9 cherry-picks (#124411, #124412) were closed automatically.

The backport of #111604 used `ColumnConstPtr` and the three-argument
`ActionsDAG::addColumn(column, type, name)` overload, neither of which exists
in 26.3. Build failed with:
  error: unknown type name 'ColumnConstPtr'
  error: no viable conversion from 'ColumnPtr' to 'ColumnConst'
Rewrite the NULL-mask mapping to build a `ColumnWithTypeAndName` and call the
single-argument `addColumn`, matching the adjacent `else` branch in the same
function.

Build log: https://s3.amazonaws.com/clickhouse-test-reports/PRs/130735/4dc280f0a6520269e1bc114481c6d319f80319d4/build_amd_debug/build_clickhouse/build_clickhouse.log
@PedroTadim
PedroTadim merged commit 4330818 into 26.3 Nov 12, 2026
37 checks passed
@PedroTadim
PedroTadim deleted the backport/26.3/111604 branch November 12, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants