Repository navigation
Fix iceberg identity partitioned reading - #116129
Conversation
|
Workflow [PR], commit [892122d] Summary: ❌
AI ReviewSummaryThis PR reconstructs missing Findings❌ Blockers
Tests
Final VerdictChanges requested. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 144/156 (92.31%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Object file sizes17 object files changed (+132.56 KiB total), 0 added.
737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units298 translation units recompiled, 2823 s compile time in total, 298 of them have a recent master baseline. |
| if (!name_and_type.has_value()) | ||
| continue; | ||
|
|
||
| if (name_and_type->name.contains('.')) |
There was a problem hiding this comment.
This could be an issue if a column has a period in it. What do you think about a check for top-level columns?
| auto row_level_filter = format_filter_info->row_level_filter; | ||
| auto prewhere_info = format_filter_info->prewhere_info; | ||
| bool filters_substituted = false; | ||
| if (format_supports_prewhere && !identity_partition_columns.empty() |
There was a problem hiding this comment.
Maybe we could add a test for CSV that has a row policy but not prewhere?
Also, a comment about the if condition would be useful.
There was a problem hiding this comment.
I didn't understand why do we need it but okay, I've added it
| if (name_and_type->name.contains('.')) | ||
| continue; | ||
|
|
||
| Field value = convertFieldToType(partition_key_value[partition_field.tuple_index], *name_and_type->type); |
There was a problem hiding this comment.
Let's use convertFieldToTypeOrThrow?
| const auto & constant | ||
| = substitution.addColumn(required.type->createColumnConst(0, *it->second), required.type, required.name); | ||
| substitution.getOutputs().push_back(&substitution.materializeNode(constant)); | ||
| values_by_name.erase(it); |
There was a problem hiding this comment.
Is the erase needed? I would think to keep it in case there are duplicates.
There was a problem hiding this comment.
Can we add a test where the partition column is renamed after writing data files? It would be good to check that the data is properly filled even after a rename.
| { | ||
| std::unordered_map<std::string_view, const Field *> values_by_name; | ||
| for (const auto & [name, value] : identity_partition_columns) | ||
| if (header.has(name)) |
There was a problem hiding this comment.
This only fills exact header columns. For an identity-partitioned nested field like s.c, a query that projects the parent struct s never matches header.has(name), so no substitution DAG is built and AddingDefaultsTransform later returns (NULL,NULL) even though the manifest already carries s.c. The new nested-field test currently encodes that mismatch. SELECT s and SELECT s.c should not disagree on the same row; please synthesize the containing tuple/struct from recovered identity-partition subfields instead of handling only exact leaf-name matches.
|
📊 Cloud Performance Report ✅ AI verdict: This PR is scoped entirely to Iceberg data-lake code (identity partition column projection in the object-storage source, plus a cluster protocol version bump and integration tests). ClickBench Q18 executes against MergeTree and does not touch any of the changed code, so its flagged +6.1% (median 1062.5 ms to 1127.0 ms) cannot be attributed to this change and is treated as noise. The two tests already disagreed on Q18, consistent with run-to-run variance rather than a real effect. No genuine performance regressions or improvements are attributable to this PR. clickbenchFlagged queries (1 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
One conflict, in StorageObjectStorageSource.cpp: master's ClickHouse#116129 (Iceberg identity partition column projection) and this branch both insert a transform immediately after `builder.init(Pipe(input_format))`. Both blocks are kept, with `AddingDefaultsTransform` first and the identity-partition `ExpressionTransform` second. `AddingDefaultsTransform` indexes the reader's missing-value bitmask by column position in the reader's own block, so it has to stay adjacent to the reader. It also fills only the columns the reader reported as missing, so running it after the identity-partition transform would overwrite a manifest partition value, which is the authoritative value for that column in that file, with the table's DEFAULT expression. In this order the manifest value wins and the bitmask lookup is still against the reader's block. Nothing from either side was dropped. Master's move of `makeQueryConditionCacheKey` to a member function with `isEtagUsableAsCacheKey`, its three identity-partition helpers, the filter substitution inside the `filter_info` lambda and the `filters_substituted` early return all auto-merged unchanged.
Cherry pick #116129 to 26.3: Fix iceberg identity partitioned reading
Cherry pick #116129 to 26.5: Fix iceberg identity partitioned reading
Cherry pick #116129 to 26.6: Fix iceberg identity partitioned reading
Cherry pick #116129 to 26.7: Fix iceberg identity partitioned reading
Backport #116129 to 26.8: Fix iceberg identity partitioned reading
|
@scanhex12 all three open backports of this PR fail
All three heads carry the same single statement, Master has exactly one reader of that field, 26.3 needs one more thing: its Merging the release branch into these branches does not help, because the blockers are master commits I do not hand-author or hand-resolve release-branch ports, so I am leaving these three with you. |
|
Correction to my previous note: "one cause" understates it. The three first errors do all trace to The robot does not cherry-pick. Excess additions per file, comparing each head against its own merge base with the release branch and
The next build error on both 26.6 and 26.7 is 26.6 and 26.3 also pick up a protocol-version bump that no compiler can catch. Fixing only the reported compile error on 26.6 or 26.3 would leave that bump in place. |
Every build fails on this branch with:
src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.h:108:30:
error: use of undeclared identifier 'avro'
108 | std::function<void(const avro::GenericDatum &)> callback);
`26.3` never had `forEachAvroEntry`: it arrived on master in 8fe1d61
("Extract forEachAvroEntry helper for iceberg avro readers"), which is not on
this branch. That commit added both the declaration and the
`namespace avro { class GenericDatum; }` forward declaration it needs.
The cherry-pick of #116129 appends `getIdentityPartitionColumnValues` directly
below `forEachAvroEntry`, so it pulled the `forEachAvroEntry` declaration in as
part of the hunk, but not the forward declaration - that sits higher up in the
file, outside any hunk this cherry-pick touches. The definition in `Utils.cpp`
came along too and compiles, because that translation unit includes the real
avro headers; only the header was left without a declaration.
Add the forward declaration, byte-identical to master's and in the same place
relative to the includes. `avro::GenericDatum` is only used here as a reference
inside a `std::function` parameter, so an incomplete type is sufficient - the
same way master uses it.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Resolved one conflict in `src/Storages/ObjectStorage/StorageObjectStorageSource.cpp`, where two unrelated changes land on adjacent lines. - Operands: kept this branch's `row_level_filter` / `prewhere_info`. #116129 introduces those locals just above and rewrites them through `substituteIdentityPartitionColumns` when the filter reads an identity partition column - that substitution is the whole point of the PR, so reverting to `format_filter_info->...` would undo the fix. - `current_schema_column_mapper`: dropped, taking the release-branch side. It is not part of #116129 (that PR does not touch `src/Formats/` at all); it is master-only code that predates it and the cherry-pick pulled in as adjacent context. `FormatFilterInfo` has no such member on `26.3`, so it would not have compiled - a second build break, latent only because ninja stopped at the `avro` error in `Utils.h` before reaching this file. Checked that nothing else references `current_schema_column_mapper`, and that every symbol the merged code uses exists on this branch. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Resolve the cherry-pick conflicts of #118606 for 26.7: - `src/Functions/FunctionsConversion.h`: keep only the new `get` signature of `ToDateMonotonicity`; the `getPreimage` overload next to it comes from another change that is not in 26.7. - `src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFilesPruning.cpp`: hoist `partition_value` out of the partition key block and keep the 26.7 way of computing `has_no_nulls`, so that the new partition range pruning runs even when a column has no min/max hyperrectangle in the manifest entry. - `src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFile.h`, `src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFileIterator.cpp`: add `PartitionSpecsEntry::tuple_index`, taken from #116129 which is not in 26.7. The pruning needs it to address the partition tuple: entries whose source column is missing from the manifest schema are skipped, so the position in `PartitionSpecification` is not the position in the partition tuple. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Resolve the cherry-pick conflicts of #118606 for 26.6: - `src/Functions/FunctionsConversion.h`: keep only the new `get` signature of `ToDateMonotonicity`; the `getPreimage` overload next to it comes from another change that is not in 26.6. - `src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFilesPruning.cpp`: take only the partition transform helpers of this change; `buildPartitionKeyFromSpec` and the decimal partition value decoding that git put into the same conflict belong to other changes that are not in 26.6. Then hoist `partition_value` out of the partition key block and keep the 26.6 way of computing `has_no_nulls`, so that the new partition range pruning runs even when a column has no min/max hyperrectangle in the manifest entry. - `src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFile.h`, `src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFileIterator.cpp`: add `PartitionSpecsEntry::tuple_index`, taken from #116129 which is not in 26.6. The pruning needs it to address the partition tuple: entries whose source column is missing from the manifest schema are skipped, so the position in `PartitionSpecification` is not the position in the partition tuple. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Resolve the cherry-pick conflicts of #118606 for 26.3: - `src/Functions/FunctionsConversion.h`: keep only the new `get` signature of `ToDateMonotonicity`; the `getPreimage` overload next to it comes from another change that is not in 26.3. - `src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFilesPruning.cpp`: take only the partition transform helpers of this change; `buildPartitionKeyFromSpec` and the decimal partition value decoding that git put into the same conflict belong to other changes that are not in 26.3. Then hoist `partition_value` out of the partition key block and keep the 26.3 way of computing `has_no_nulls`, so that the new partition range pruning runs even when a column has no min/max hyperrectangle in the manifest entry. - `src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFile.h`, `src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFileIterator.cpp`: add `PartitionSpecsEntry::tuple_index`, taken from #116129 which is not in 26.3. The pruning needs it to address the partition tuple: entries whose source column is missing from the manifest schema are skipped, so the position in `PartitionSpecification` is not the position in the partition tuple. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix iceberg identity partitioned reading (we returned null as there were no values, but we need to return value from partition). Closes #110216
Workflow [PR]
Sync PR [sync-upstream/pr/116129]
Version info
26.8.1.2017