Skip to content

Add NaN-in-PK index range test with multi-row granule (PR #98964) - #99716

Merged
zlareb1 merged 2 commits into
ClickHouse:masterfrom
zlareb1:qa/pr98964-nan-pk-multi-granule-coverage
Mar 18, 2026
Merged

zlareb1 merged 2 commits into
ClickHouse:masterfrom
zlareb1:qa/pr98964-nan-pk-multi-granule-coverage

Conversation

@zlareb1

@zlareb1 zlareb1 commented Mar 17, 2026 •

Copy link
Copy Markdown
Member

Add a NaN-in-PK index range test exercising the right.isNaN() branch at KeyCondition.cpp:4205 (PR #98964). The PR's own test (04031) uses index_granularity = 1; with index_granularity = 8192 all values fall in a single granule whose right bound is NaN, exercising the previously-untested branch. Also adds a Nullable(Float32) variant.

Created with Claude.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.3.1.785

…98964)

PR ClickHouse#98964 fixed `checkInHyperrectangle` in `KeyCondition.cpp` to handle NaN
correctly in index range analysis. The PR's own test (`04031`) uses
`index_granularity = 1`, so each value is in its own granule and the
`left.isNaN()` branch (first granule boundary) is hit for the NaN granule.

With `index_granularity = 8192` all values land in a single granule whose
right bound is NaN. This exercises the `key_range.right.isNaN()` branch at
`KeyCondition.cpp:4205` that was not covered by the PR's own test.

Also adds a `Nullable(Float32)` variant with NaN and NULL in the same granule.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@zlareb1 zlareb1 added the pr-not-for-changelog This PR should not be mentioned in the changelog label Mar 17, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d29d43d]

Summary: ✅


AI Review

Summary

This PR adds a focused stateless regression test (04042_nan_pk_multi_row_granule) for NaN handling in MergeTree primary-key range checks when many rows share one granule (index_granularity = 8192), including a nullable-key variant. I did not find correctness, safety, or performance issues in the patch itself.

Missing context

  • ⚠️ No CI job results/logs were provided in this review context, so I could not verify runtime test outcomes.

ClickHouse Rules

Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsHistory.cpp ➖
Safe rollout ✅
Compilation time ✅

Final Verdict

  • Status: ✅ Approve

NaN in primary key is a core `MergeTree` feature available in fasttest.
The existing `04031_nan_in_pk_index_binary_search.sql` only carries
`no-random-merge-tree-settings`, not `no-fasttest`. Keep the latter tag.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good test, ready to merge!

@alexey-milovidov alexey-milovidov self-assigned this Mar 18, 2026
@zlareb1
zlareb1 marked this pull request as ready for review March 18, 2026 10:17
@zlareb1
zlareb1 enabled auto-merge March 18, 2026 10:17
@zlareb1
zlareb1 added this pull request to the merge queue Mar 18, 2026
Merged via the queue into ClickHouse:master with commit b9fba63 Mar 18, 2026
159 checks passed
@zlareb1
zlareb1 deleted the qa/pr98964-nan-pk-multi-granule-coverage branch March 18, 2026 10:35
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants