Repository navigation
Use iceberg row and column stats for Cascades CBO - #124857
Conversation
|
Workflow [PR], commit [5daf1ad] Summary: ✅
AI ReviewSummaryThis PR supplies Iceberg manifest estimates to Cascades, shares the cached estimate with join reordering, and avoids using filter-selectivity guesses to size transported runtime filters. Findings
Missing context / blind spots
Tests
Final Verdict |
2b24c69 to
0723993
Compare
c38ba84 to
9602942
Compare
9602942 to
e36c483
Compare
e36c483 to
aa1f44c
Compare
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units16 translation units recompiled, 148 s compile time in total, 16 of them have a recent master baseline. Symbol sizes
|
aa1f44c to
8611e57
Compare
358b673 to
bf58262
Compare
bf58262 to
bdfe9e6
Compare
bdfe9e6 to
e6dd88a
Compare
e6dd88a to
7718744
Compare
31be022 to
71262c4
Compare
1921bd0 to
bda765f
Compare
bda765f to
3c56e31
Compare
`ReadFromObjectStorageStep` is shared by every data lake, so it no longer reads `use_iceberg_manifest_statistics` and `use_statistics`; `IcebergMetadata::estimateRead` returns no estimate when either is off, as before. #124857 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #120440
Related: #123085
Related: #123553
Related: #124395
The fourth PR for #120440, stacked on #124395. The Cascades optimizer seeds a read's group with the join reordering estimate (
estimateStatistics), but only forReadFromMergeTree; an Iceberg read got default statistics with 0 rows, so every join and exchange above it saw a free, empty input. Withuse_iceberg_manifest_statistics, an object storage read, alone or under a filter, now gets the estimate of #123085..#124395: rows after pruning and deletes, the selectivity of the filter above it, and the number of distinct values, min/max and NULL fraction of its columns.max_row_countis the live rows of the remaining files (DataLakeReadEstimate::rows): pruning drops only files that cannot match, and an estimate of the conditions is not an upper bound.avg_bytesper column is the width of its type: the manifests give only compressed sizes.physical_read_bytescounts the live rows of the remaining files. The scan also reads the deleted rows, which are left out.Without the settings, or without an estimate, the statistics stay as they were.
With
for_runtime_filter_transport,estimateReadRowsCountdoes not estimate the conditions of an Iceberg read: the rows size a sent runtime filter, so they must be an upper bound, not a guess. Such a read gets the rows of the remaining files if pruning dropped a file, and no estimate otherwise, as a MergeTree read with a filter that its index does not use.ReadFromObjectStorageStepnow keeps the estimate as ashared_ptrand hands it out withgetOrCreateDataLakeReadEstimate, asReadFromMergeTreedoes with its analysis result, so join reordering and Cascades share one estimate without copying it. The checks ofuse_iceberg_manifest_statisticsanduse_statisticsmoved into it.Cascades runs only for distributed plans, and an object storage read is serializable only in ClickHouse Cloud (
ReadFromObjectStorageStep::isSerializable), so in this repository the query falls back to local execution before Cascades runs. The test is in the Cloud repository: a 100000-row Iceberg table joined with a 1000-row table, where Cascades built the hash table on the Iceberg read before and on the small table now; with a filter that keeps 5 rows, on the filtered Iceberg read.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
With
use_iceberg_manifest_statistics, the Cascades optimizer estimates Iceberg reads from the manifest files, as join reordering does, instead of treating them as empty.Workflow [PR]
Sync PR [sync-upstream/pr/124857]
Version info
26.11.1.1762-master(included in26.11and later)