Skip to content

Cherry pick #118214 to 26.7: A NULL key value is not a definite match of a negated comparison - #118269

Merged
robot-ch-test-poll2 merged 3 commits into
backport/26.7/118214from
cherrypick/26.7/118214
Sep 7, 2026
Merged

robot-ch-test-poll2 merged 3 commits into
backport/26.7/118214from
cherrypick/26.7/118214

Conversation

@robot-ch-test-poll2

Copy link
Copy Markdown
Contributor

Original pull-request #118214

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

alexey-milovidov and others added 2 commits September 5, 2026 05:35
`SELECT count()` answered from the implicit exact-count projection reads a
granule's key range instead of its rows. A NULL key value is analysed as the
`+inf` stand-in of the `NULLS LAST` order, and a comparison against a NULL is
NULL - so `WHERE` rejects the row - which the two-valued range algebra of
`KeyCondition::checkInHyperrectangle` cannot express: "no NULL row lies inside
the range" turns, under negation, into "every row lies outside it". A granule
of NULLs therefore looked like a definite match of `id != ''`, `id NOT IN ('')`
or `id NOT LIKE 'z%'`, and `count()` counted rows that `SELECT *` under the same
`WHERE` does not return. At default settings, on a `Nullable` primary key.

The whole analysis now gives up its `can_be_false` claim as soon as an atom
that answers NULL for a NULL argument reads a `Nullable` key column whose range
reaches the NULL stand-in. `IS NULL` and `IS NOT NULL` are excluded: they answer
true or false for a NULL as well, so the algebra describes them exactly, and the
exact count of `04318_sparse_pk_index_analysis_last_mark_null` keeps working.
`can_be_true`, and with it every pruning decision, is untouched.

Closes: #112641

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…12641

A NULL key value is not a definite match of a negated comparison
@robot-ch-test-poll2 robot-ch-test-poll2 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Sep 5, 2026
@robot-ch-test-poll2
robot-ch-test-poll2 merged commit 719bb88 into backport/26.7/118214 Sep 7, 2026
2 checks passed
@robot-ch-test-poll2
robot-ch-test-poll2 deleted the cherrypick/26.7/118214 branch September 7, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants