Skip to content

Revert "Fix Parquet reads of .null and .size0 subcolumns when the filter runs as PREWHERE" - #125121

Merged
alexey-milovidov merged 1 commit into
masterfrom
revert-124685-parquet-prewhere-subcolumn-header
Oct 11, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
revert-124685-parquet-prewhere-subcolumn-header

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Reverts #124685


Workflow [PR]
Sync PR [sync-upstream/pr/125121]

Version info

  • Merged into: 26.10.1.2089-master (included in 26.10 and later)

@alexey-milovidov alexey-milovidov self-assigned this Oct 11, 2026
@alexey-milovidov
alexey-milovidov merged commit 1654481 into master Oct 11, 2026
1 check failed
@alexey-milovidov
alexey-milovidov deleted the revert-124685-parquet-prewhere-subcolumn-header branch October 11, 2026 00:36
@clickhouse-gh

clickhouse-gh Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [563bb06]

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Oct 11, 2026
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 11, 2026
This was referenced Oct 11, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 11, 2026
…mber-missing-from-child

Picks up ClickHouse#125121 (revert of ClickHouse#124685), which fixes the
05339_parquet_prewhere_subcolumn_read_through_column failure on this PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@PedroTadim

Copy link
Copy Markdown
Member

@alexey-milovidov are you going to revert this and reapply the PR?

opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-ClickHouse__ClickHouse that referenced this pull request Nov 6, 2026
…RE read header

`prepareReadingFromFormat` keeps query-level `requested_columns` / `source_header`,
which can hold subcolumns such as `n.null` or `arr.size0`, and a format-level
`format_header`, where Parquet reads such a subcolumn through its whole column
(`n`). After PREWHERE, `updateFormatPrewhereInfo` set `source_header` to the
post-PREWHERE `format_header`, and ClickHouse#126573 then re-requested a subcolumn only
when its column was still read. Two shapes stayed broken:

- an explicit PREWHERE that consumes the column a selected subcolumn is read
  through drops the subcolumn: `SELECT countIf(n.null), count() FROM
  file('x.parquet') PREWHERE n > 5` fails with NOT_FOUND_COLUMN_IN_BLOCK, also on
  released 26.3, 26.8, 26.9 and 26.10;
- when the column survives an optimizer PREWHERE, the read step outputs the whole
  column `n` that no step requested, and lazy materialization over it trips
  `chassert(header.columns() == required_inputs.size())` in
  `splitExpressionStep` with default settings: `SELECT n.null, number FROM
  file('x.parquet') WHERE number > 5 ORDER BY number LIMIT 3`.

Compute the post-PREWHERE source header by applying the PREWHERE actions to the
query-level requested block, as `SourceStepWithFilter::updatePrewhereInfo` does,
keep each requested column with its storage mapping, and keep a storage column
in `format_header` when an explicit PREWHERE consumes the column a selected
subcolumn is extracted from. This replaces the ClickHouse#126573 loop, whose cases the new
construction covers (05413 passes unchanged).

The object-storage fallback that re-applies PREWHERE after the reader, for a
data file whose format has no PREWHERE (ORC files of an Iceberg table read as
Parquet, schema-evolved files), now keeps the inputs listed in the format header
among the PREWHERE outputs, so the column survives the filter there too.

This re-lands the source part of ClickHouse#124685 (reverted in ClickHouse#125121 because its test
failed under DatabaseReplicated: the replicated DDL worker does not see the
`TEMPORARY TABLE` that the Iceberg block passes to `IcebergLocal`). The test now
carries `no-replicated-database` with the reason line of
`05291_iceberg_optimize_explicit_metadata`. Its explicit-PREWHERE `s3` arm pins
`parallel_replicas_for_cluster_engines = 0`, because under parallel replicas
`s3` is read through its `-Cluster` storage, which rejects PREWHERE.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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