Repository navigation
Fix NOT_FOUND_COLUMN_IN_BLOCK in the native Parquet V3 reader prewhere handling - #107059
Conversation
Pre-PR validation gate
Session id: cron:clickhouse-worker-slot-24:20260610-184200 |
|
cc @al13n321 @scanhex12 — could you review? This fixes the |
|
Workflow [PR], commit [a96bc89] Summary: ❌
AI ReviewSummaryThis PR hardens the Parquet V3 Final VerdictStatus: ✅ Approve |
|
CI fully finished (Finish Workflow passed). The single failure is Stateless tests (arm_asan_ubsan, azure, sequential) -- the known azure-infra-outage / db-disk "Server died" chronic class, unrelated to this PR (Parquet V3 shared-column NOT_FOUND_COLUMN_IN_BLOCK fix). Not PR-caused. No Fast/Bugfix/Style failure. |
|
Thanks @PedroTadim. I verified before closing, and these two PRs fix two different root causes of #106147, so I think this one is still needed. #106443 disables
The missing column here is the promoted intermediate Happy to keep this open as the File-path half. If you would rather have one PR cover both, I can move this reader-side fix wherever you prefer. What do you think? |
|
@tiandiwonder what do you prefer? Should we keep both PRs? |
0e5184d to
60bea00
Compare
Pre-PR validation gate (for the second fix added here, STID 3400-40ae)
Session id: cron:clickhouse-worker-slot-0:20260618-080900 |
|
Expanded this PR to also fix a sibling bug in the same The split is now skipped when |
Pre-PR validation gate (identity-based split-step guard, e0a5873)
Session id: cron:clickhouse-worker-slot-0:20260618-093900 |
|
CI finished on
No PR-caused failures. |
CI finish ledger — e0a5873
This failure is unrelated to this PR (which fixes Parquet V3 reader prewhere): the stack is the Session id: cron:our-pr-ci-monitor:20260625-053000 |
CI finish ledger — 4575112Every failure below has an owner: a fixing PR (ours or external). Only
This HEAD is a master-merge that picked up the on-fly-mutation read fix #108128, so the prior Stress (amd_debug) Session id: cron:our-pr-ci-monitor:20260625-110000 |
|
@groeneai do the crashes still happen? |
|
@PedroTadim The first one does. The second is now hidden behind a separate, newer master bug. 1. Shared-intermediate NOT_FOUND_COLUMN_IN_BLOCK (issue #106147, test 04327) - still reproduces on current master (snapshot 2beb103, 26.7.1.1): With this PR the query returns the correct 2. need_filter=false LOGICAL_ERROR (test 04340) - I can no longer reach the original That assertion fires on a clean master debug build (no fix) and runs before the Net: I would keep this PR open for the shared-intermediate fix. For 04340 I can either open a separate issue for the Reader.cpp:382 regression and keep the test, or drop 04340 here and land only the shared-intermediate fix plus its test. Which do you prefer? |
|
@groeneai keep this PR and check the CI failures |
|
@PedroTadim keeping it open, thanks. Checked the CI reds on f76bb0b: The whole red cascade traced to one nit in our own test comment: Remaining items, none PR-caused:
The 04327 shared-intermediate fix (the deliverable) is unaffected and still needed: on the current master snapshot the query throws NOT_FOUND_COLUMN_IN_BLOCK, and with this PR it returns the correct result. If you want green CI here before #109267 lands, I can drop the 04340 test from this PR and keep only the 04327 shared-intermediate fix + test. Your call. |
CI finish ledger — 1468046CI has fully finished on this head (Finish Workflow + Mergeable Check complete). Every failure has an owner.
The sole failure is the chronic Session id: cron:our-pr-ci-monitor:20260722-220000 |
|
|
||
| set input_format_parquet_use_native_reader_v3 = 1; | ||
|
|
||
| -- Old analyzer: PREWHERE and(...) + WHERE leaves need_filter = false and keeps the prewhere column. |
There was a problem hiding this comment.
@groeneai, please remove the old analyzer tests. It's going to be removed soon enough.
There was a problem hiding this comment.
Done in d9c94aa: removed the three old-analyzer (enable_analyzer = 0) cases from 04340; kept only the new-analyzer query. It returns 497 (verified on the fixed binary). This also clears 04340's CI reds, which were the KeyCondition uses PREWHERE output abort on the old-analyzer path (owned by #109267), not a preparePrewhere failure.
…re intermediate The native Parquet V3 reader reuses the MergeTree prewhere splitter (tryBuildPrewhereSteps) to build per-condition read steps, then maps every cross-step column by its index in extended_sample_block. When two conjuncts share an intermediate node, the splitter promotes that node to a step boundary (output of one step, input of the next). extended_sample_block only holds query outputs and leaf prewhere inputs, so the promoted intermediate has no slot and the lookup throws NOT_FOUND_COLUMN_IN_BLOCK. Fix: after the split, verify every step's required columns are addressable in extended_sample_block. A required column is addressable only if it is an original input of the whole prewhere expression or an intermediate an earlier step computed into a dedicated prewhere-output slot; a promoted column with no such slot (or whose generated name merely collides with an unrelated physical column) forces the always-correct single-step path. This only widens the fallback, so it can never enable a new multi-step execution or change a correct result. The same guard also skips the split when a kept prewhere output would otherwise be left unregistered, which previously tripped a "Unexpected column in sample block" LOGICAL_ERROR. That path is only reachable via the old analyzer (need_filter = false requires a PREWHERE with a WHERE on the legacy interpreter; the new analyzer always sets need_filter = true), which is being removed, so it carries no dedicated regression test. Regression tests (both new-analyzer): 04327 (shared intermediate; pins the join algorithm and disables join-table swap so the runtime filter that builds the second shared conjunct is always present under randomized settings) and 04342 (a physical column whose name collides with a promoted intermediate).
d9c94aa to
954bf14
Compare
CI finish ledger — 954bf14CI fully finished (Config + Finish Workflow SUCCESS, 0 checks queued/in_progress, last check completed 16:38 UTC). No failure below is caused by this PR (its diff is the Parquet V3 reader shared-intermediate fix in
Session id: cron:our-pr-ci-monitor:20260724-173000 |
|
Fixing PR for the Correcting my own ledger line: I had recorded it as The randomized-settings fingerprint identifies the trigger: Root cause, as diagnosed by @ davenger in #111762: with I did not author a fix: #111762 is by the owner of this code and already implements the correct one, a bounded |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 31/32 (96.88%) · Uncovered code |
CI finish ledger - a96bc89Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Not PR-caused: this pull request touches only Head Session id: cron:our-pr-ci-monitor:20260728-163000 |
d481542
|
Hi — this looks like a backport candidate for Not needed on |
|
Thanks for the cross-branch run. I do not open manual backport PRs and cannot apply labels; backports are driven by a I re-measured with the official per-branch binaries and this PR's own two regression tests, controlling on master (both pass there and match their Your So the useful ask is a single |
…block Antalya 26.3 Backport of ClickHouse#107059 - Fix NOT_FOUND_COLUMN_IN_BLOCK in the native Parquet V3 reader prewhere handling
…block Antalya 26.6 Backport of ClickHouse#107059 - Fix NOT_FOUND_COLUMN_IN_BLOCK in the native Parquet V3 reader prewhere handling
Related: #106147
Related: #106443
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
NOT_FOUND_COLUMN_IN_BLOCKin the native Parquet V3 reader (regression from #93542) when aPREWHEREhad conjuncts sharing a common intermediate expression.Description
Reader::preparePrewhere()insrc/Processors/Formats/Impl/Parquet/Reader.cppreuses the MergeTree prewhere splitter (tryBuildPrewhereSteps, since #93542) to build per-condition read steps, then maps every cross-step column by its index inextended_sample_block. When two conjuncts share an intermediate node, the splitter promotes that node to a step boundary (output of one step, input of the next).extended_sample_blockonly holds query outputs and leaf prewhere inputs, so the promoted intermediate has no slot and the lookup throwsNOT_FOUND_COLUMN_IN_BLOCK.Fix: after the split, verify every step's required columns are addressable in
extended_sample_block. A required column is addressable only if it is an original input of the whole prewhere expression, or an intermediate an earlier step computed into a dedicated prewhere-output slot. A promoted column with no such slot (or whose generated name merely collides with an unrelated physical column, which would otherwise silently feed user data instead of the computed value) forces the always-correct single-step path. This only widens the fallback, so it can never enable a new multi-step execution or change a correct result.The same guard also skips the split when a kept prewhere output would otherwise be left unregistered, which previously tripped a
LOGICAL_ERROR"Unexpected column in sample block". That path is only reachable via the old analyzer (need_filteris left false only for aPREWHEREwith aWHEREon the legacy interpreter; the new analyzer always setsneed_filter = true), which is being removed, so it carries no dedicated regression test.Regression tests (both new-analyzer):
04327_parquet_v3_prewhere_shared_intermediateand04342_parquet_v3_prewhere_intermediate_name_collision.Note: #106147 was already closed (its object-storage
.null-subcolumn half was fixed by #106443); this PR is the distinctFile(Parquet)shared-intermediate half, henceRelatedrather thanCloses.Found by the AST fuzzer (STID 3400-40ae).