24.8.14 Backport of #98960 - Fix skip index not used for ALIAS columns when query plan expression merging is disabled#1544
Conversation
Fix skip index not used for ALIAS columns when query plan expression merging is disabled
add_minmax_index_for_numeric_columns is unavailable on 24.8. Also, some lines in reference are different or missing.
|
This is an automated comment for commit 6da3227 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
|
AI audit note: This review comment was generated by AI (gpt-5.3-codex). Audit update for PR #1544 (alias skip index with expression merging disabled): Confirmed defectsNo confirmed defects in reviewed scope. Coverage summaryScope reviewed: |
QA Verification - PR #1544SummaryThis is a pure backport of upstream PR ClickHouse/ClickHouse#98960, which fixes skip indexes (and primary key conditions) not being applied for ALIAS columns when query plan expression merging is disabled. The fix resolves issue ClickHouse/ClickHouse#98822, a regression since version 24.2. Backport Accuracy
CI Results
Test CoverageThe upstream test covers the scenarios from the reported issue:
No additional regression tests are needed for this backport. VerdictApproved — backport is correct, CI is green, and the new test validates the fix. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix skip indexes (and primary key conditions) not being applied for ALIAS columns when query plan expression merging is disabled (query_plan_merge_expressions = 0 or query_plan_enable_optimizations = 0). (ClickHouse#98960 by @fastio)
Documentation entry for user-facing changes
When query plan expression merging is disabled, ExpressionStep nodes like "Compute alias columns" and "Change column names to column identifiers" remain separate
from filter steps. The optimizePrimaryKeyConditionAndLimit optimization previously ignored these expression steps, causing filters on ALIAS columns to reference
unresolved column identifiers that the storage layer could not match against indexes.
This fix composes filter DAGs through accumulated expression DAGs (in bottom-to-top order) so that ALIAS column references are resolved to their underlying physical
column expressions, enabling correct primary key and skip index analysis regardless of whether expression merging is active.
CI/CD Options
Exclude tests:
Regression jobs to run: