Repository navigation
Conversation
prepareReadingFromFormat classified a requested column as a Hive partition column by exact name, so a subcolumn such as `key.null` or `t.a` of a partition column was read from the data file: it either failed with NOT_FOUND_COLUMN_IN_BLOCK (the file column is never read for a partition column) or returned the file's value next to the path's value of the column itself. Classify a requested subcolumn of a partition column as a partition column, and build it in addPartitionColumnsToChunk from the path value of its storage column with IDataType::getSubcolumn. Path pruning does not parse subcolumns, so they are skipped there, and the format gets no filter when a partition subcolumn is requested, because the format would evaluate it on the file's values. Related: ClickHouse#123718 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A query requesting a partition subcolumn passes no format filter, so PREWHERE / row-level inputs are registered without a filter DAG and a reader-side filter keeps its row count out of the count cache; the hunks are shared with ClickHouse#124124 (initKeyConditionOnce) and ClickHouse#123903 (hasFilter, object-storage count cache). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Without a format filter DAG, `FormatFilterInfo::hasFilter` must still be true while the top-K dynamic filter is armed: a top-K read that skips row groups would otherwise store its short row count as the file's count. No other row of 05332 arms a top-K filter (they all request a partition subcolumn, which turns it off), so add a `file()` read without a partition column: `ORDER BY v LIMIT 3` over 10 row groups, then a cached `count()`. Master returns 100, the fix 1000. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (click to expand)
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-self-slot-57:20261007-081400 |
|
Workflow [PR], commit [18b1299] Summary: ✅
AI ReviewSummaryThe PR derives Hive partition subcolumns from path values and registers reader-side filter inputs even without a filter DAG. One reproducible Findings
Missing context / blind spots
Final Verdict
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units10 translation units recompiled, 44 s compile time in total, 10 of them have a recent master baseline. |
With parallel replicas enabled and `automatic_parallel_replicas_mode = 0`, `parallel_replicas_for_cluster_engines` turns `s3()` into `s3Cluster`, which rejects an explicit PREWHERE with ILLEGAL_PREWHERE. That failed the test in the ParallelReplicas stateless job. The two rows check the plain s3 read path, so pin the setting to 0 on them only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The PR workflow run for 9270a54 was abandoned by the GitHub Actions outage of 2026-10-07 and cannot be re-run from this account. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - d65dcfdEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
All 149 check runs completed, Session id: cron:our-pr-ci-monitor:20261008-060500 |
…olumn-from-path # Conflicts: # src/Storages/HivePartitioningUtils.cpp # src/Storages/VirtualColumnUtils.cpp
CI finish ledger - 5249e20Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261022-170010 |
…olumn-from-path Co-Authored-By: Claude Opus 5.5 <[email protected]>
| if (!filter_actions_dag) | ||
| return; |
There was a problem hiding this comment.
[Major] The input registration before this return still drops independent dotted physical columns. buildKeyConditionInputs calls isColumnCovered, which considers v.tag covered whenever keys contains v, even when v is a scalar and v.tag is a separate stored column. Consequently v.tag never reaches additional_columns.
Reproduced on this head's ARM binary:
INSERT INTO FUNCTION file('key=9/dotted.parquet', Parquet, 'key Nullable(Int64), v UInt64, `v.tag` UInt64')
SELECT NULL, number, number % 2 FROM numbers(4);
SELECT v, key.null
FROM file('key=9/dotted.parquet', Parquet, 'key Nullable(Int64), v UInt64, `v.tag` UInt64')
PREWHERE `v.tag` = 1
ORDER BY v
SETTINGS use_hive_partitioning = 1;Expected (1, 0), (3, 0); actual: NOT_FOUND_COLUMN_IN_BLOCK, with Not found column v.tag in block. There are only columns: v. Projecting the dotted column and evaluating the same condition in WHERE with optimize_move_to_prewhere = 0 both succeed.
This is an existing helper defect, also reproducible without projecting key.null, reached by the Hive-subcolumn/PREWHERE combination supported here. Please distinguish actual subcolumn ancestry from name prefixes and add this regression case, or explicitly link an issue tracking the remaining limitation.
… reads An explicit PREWHERE leaves its PREWHERE-only columns out of the format header, so `FormatFilterInfo::buildKeyConditionInputs` adds them to `additional_columns`, the extra columns the reader produces. Since ClickHouse#104435 (GeoParquet pruning) its `add_required` lambda skipped a name when `isColumnCovered` found any dot-prefix of it in the header. For `SELECT v ... PREWHERE `v.tag` = 1`, `v` is in the header, so `v.tag` was taken for a subcolumn of `v`, never requested, and the Parquet reader threw NOT_FOUND_COLUMN_IN_BLOCK when it evaluated PREWHERE. 26.7 checked the exact name there and returned the rows. PREWHERE and pushed-down row policy inputs are storage columns for every storage that builds a `FormatFilterInfo` with them: File, URL and ObjectStorage return top-level names from `supportedPrewhereColumns()` and do not admit subcolumns (`supportedPrewhereColumnsIncludeSubcolumns()` is false), so explicit PREWHERE, the move to PREWHERE and the row policy pushdown never pass a subcolumn. Match them by exact name again. Keep `isColumnCovered` for the `filter_actions_dag` (WHERE) loop in `initKeyConditionOnce`: WHERE can name a real subcolumn (`t.a` with `t` in the header), and requesting both from the Parquet reader is rejected as COLUMN_QUERIED_MORE_THAN_ONCE. This also covers stored columns whose names are valid subcolumn names of the prefix column (`n.null` next to a Nullable `n`, `j.x` next to a JSON `j`), which a type-aware prefix check would still misread. Related: ClickHouse#124392 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #123718
Related: #123381
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed reading a subcolumn of a Hive partition column (for example
key.null,key.sizeor a tuple elementt.a) from the data file instead of the path: such queries failed withNOT_FOUND_COLUMN_IN_BLOCKor returned the file's values. Closes #123718.Description
On 26.3 and 26.9, with
use_hive_partitioning = 1andt=(1,2)/data.parquetstoringt = (5,5):prepareReadingFromFormatrecognized a partition column only by its exact name, sokey.nullwas requested from the format, which either has nokey(partition columns are never read from the file) or reads the file's ownkey. Now a subcolumn of a partition column is taken from the path too:addPartitionColumnsToChunkbuilds the column from the path value and extracts the subcolumn, and the path-pruning blocks skip such entries.Such a query passes no filter to the format (as when the format reads partition columns), so a conjunct on
t.acannot prune row groups on the file's values. Without a filter DAG, PREWHERE and row policy inputs must still be registered for the reader (FormatFilterInfo::initKeyConditionOnce; the hunk is identical to the one in #124124). A read that they or the top-K filter cut short already stays out of thecount()cache since #123903.The test covers
file,url,s3,partition_strategy = 'hive',.null,.size, tuple elements, PREWHERE, row policies and the count cache after a filtered or top-K read. It fails on master and passes 50/50 randomized runs.Workflow [PR]
Sync PR [sync-upstream/pr/124392]