Fix flaky test 03800_assume_not_null_coalesce_if_null_monotonicity_key_condition by groeneai · Pull Request #101316 · ClickHouse/ClickHouse · GitHub
Skip to content

Fix flaky test 03800_assume_not_null_coalesce_if_null_monotonicity_key_condition#101316

Merged
nikitamikhaylov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-flaky-03800-assume-not-null-monotonicity
Mar 31, 2026
Merged

Fix flaky test 03800_assume_not_null_coalesce_if_null_monotonicity_key_condition#101316
nikitamikhaylov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-flaky-03800-assume-not-null-monotonicity

Conversation

@groeneai

@groeneai groeneai commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a]notation for the changelog):

  • none

Summary

Pin query_plan_merge_expressions = 1 in the test to prevent EXPLAIN output mismatches when CI randomizes this setting to 0.

  • The test verifies that assumeNotNull/coalesce/ifNull monotonicity is correctly used by KeyCondition for MinMax index and primary key condition optimization
  • query_plan_merge_expressions only controls cosmetic merging of adjacent expression steps in the query plan — it does not affect index analysis or granule pruning
  • When randomized to 0, all 10+ EXPLAIN blocks produce structurally different output (unmerged expression nodes), breaking the reference comparison

CIDB evidence

13 failures across 6 unrelated PRs in 30 days (zero master failures — only triggered by CI randomization in PR runs):

Reproduction

Deterministic reproduction:

CLICKHOUSE_CLIENT_OPT="--query_plan_merge_expressions 0" \
  tests/clickhouse-test --no-random-settings --no-random-merge-tree-settings \
  03800_assume_not_null_coalesce_if_null_monotonicity_key_condition
# → FAIL every time without fix
# → OK every time with fix

Verified 50/50 passes with full randomization after fix.

Version info

  • Merged into: 26.4.1.457

…y_condition

Pin query_plan_merge_expressions=1 to prevent EXPLAIN output mismatch when CI
randomizes this setting to 0. The test verifies key condition monotonicity for
assumeNotNull/coalesce/ifNull — expression merging is cosmetic and irrelevant
to the tested optimization.

Reproduces deterministically with --query_plan_merge_expressions 0.
Verified 50/50 passes with full randomization after fix.
@groeneai

Copy link
Copy Markdown
Contributor Author

@groeneai

Copy link
Copy Markdown
Contributor Author

cc @CurtizJ — could you review this? Simple test fix — pins query_plan_merge_expressions=1 to prevent EXPLAIN output mismatch from CI randomization. The test checks assumeNotNull/coalesce/ifNull monotonicity in KeyCondition, which is unaffected by expression merging.

@nikitamikhaylov nikitamikhaylov added the can be tested Allows running workflows for external contributors label Mar 31, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2f4923c]

Summary:

job_name test_name status info comment
Integration tests (amd_llvm_coverage, 2/5) failure
test_overcommit_tracker/test.py::test_user_overcommit FAIL cidb
Stress test (arm_ubsan) failure
Hung check failed, possible deadlock found FAIL cidb, issue

AI Review

Summary

This PR stabilizes 03800_assume_not_null_coalesce_if_null_monotonicity_key_condition by pinning query_plan_merge_expressions = 1 in both .sql and .reference, preventing random-setting-induced EXPLAIN formatting drift. I found no correctness, safety, performance, or compatibility problems in the proposed change, and no duplicate inline concerns from clickhouse-gh[bot] to account for.

ClickHouse Rules
Item Status Notes
Deletion logging
Serialization versioning
Core-area scrutiny
No test removal
Experimental gate
No magic constants
Backward compatibility
SettingsChangesHistory.cpp
PR metadata quality
Safe rollout
Compilation time
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Mar 31, 2026
@nikitamikhaylov nikitamikhaylov self-assigned this Mar 31, 2026
@nikitamikhaylov nikitamikhaylov added this pull request to the merge queue Mar 31, 2026
Merged via the queue into ClickHouse:master with commit 3d69df4 Mar 31, 2026
145 of 162 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-ci 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