Repository navigation
Fix block structure mismatch in UnionStep after filter push-down with NULL constants - #104853
Merged
Merged
Conversation
… NULL constants When `splitFilter` splits an AND conjunction (e.g. `dummy AND count() + NULL`) and pushes part of it below aggregation, the remaining expression (`plus(count(), NULL)`) may fold to a ColumnConst because `defaultImplementationForNulls` short-circuits when a NULL constant argument is present. The `is_filter_const_after_push_down` flag from `removeUnusedConjunctions` does not account for this — it is only set when ALL conjunctions are pushed down. As a result, the Const filter column propagates into the plan header for the first UNION branch, while the second branch has a non-Const column from `materialize`, causing a "Block structure mismatch in UnionStep" exception. The fix evaluates the actual constness of the filter column after push-down by calling `updateHeader` on the modified expression DAG. When the filter column became Const unexpectedly, `materializeFilterColumnIfNeededAfterPushDown` is called with the corrected flag to insert a `materialize` node, ensuring the output column is non-Const and headers stay consistent. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [88eb1d1] Summary: ❌
AI ReviewSummaryThis PR fixes a real Final Verdict✅ No blockers or major issues found in the current diff. |
Contributor
LLVM Coverage Report
Changed lines: 100.00% (8/8) · Uncovered code |
1 task
alexey-milovidov
pushed a commit
to Onyx2406/ClickHouse
that referenced
this pull request
May 19, 2026
The `Docker server image` job intermittently fails when fetching the prebuilt `.deb` packages from `clickhouse-builds.s3.amazonaws.com`: ``` ERROR 500: Internal Server Error. ERROR 503: Service Unavailable. ``` Three unrelated PRs hit this S3 download flake over three days (`ClickHouse#100173` on 2026-05-15 with `500`, `ClickHouse#104694` on 2026-05-14 with `503`, `ClickHouse#104853` on 2026-05-13 with `503`). On master in the last 14 days the master `Docker server image` job has 1 failure of the same shape. `docker/server/Dockerfile.alpine` already wraps `wget` with a retry helper (added in ClickHouse#100380 to absorb the same kind of transient errors during Alpine cross-architecture builds via QEMU). The Ubuntu and distroless flavours still call `wget ... || exit 1` on the very first attempt, so a single `500`/`503` from S3 kills the whole build. This change ports the same `wget_with_retry` wrapper to `docker/server/Dockerfile.ubuntu` and `docker/server/Dockerfile.distroless` for the `DIRECT_DOWNLOAD_URLS` block (the path used by CI). `WGET_RETRIES` (default `5`) and `WGET_RETRY_DELAY` (default `1s`) match the Alpine version and remain overridable via `--build-arg`. CI report (PR ClickHouse#100173, sha 3ceac71): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100173&sha=3ceac71a43a5fd4fc1a7859937b23e71b8fe42ae&name_0=PR&name_1=Docker%20server%20image Co-Authored-By: Claude Opus 4.7 <[email protected]>
yariks5s
approved these changes
May 20, 2026
DavidHe-2008
pushed a commit
to DavidHe-2008/ClickHouse
that referenced
this pull request
Jun 1, 2026
…down-const-null-union Fix block structure mismatch in UnionStep after filter push-down with NULL constants
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix block structure mismatch in UnionStep after filter push-down with NULL constants. Closes #104821
Version info
26.5.1.902