Fix Iceberg metadata-only file combining #16499
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #16499"
general
weight: 0.35
gerashegalov
Fixes #16473.
Description
Iceberg’s multithreaded Parquet reader can return incorrect values when combining metadata-only file reads: reads that need row counts and per-file constants without reading Parquet column data. The combined output can apply one file’s constants to rows from other files.
This affects both imported tables with identity-partition columns absent from the Parquet payload and native Iceberg tables queried for metadata columns such as
_spec_idand_partition.This change checks metadata-only entries before combining them, reusing Iceberg’s existing compatibility logic. Entries with incompatible output constants remain in separate batch groups; compatible entries can still combine. The combined metadata retains the representative file used for compatibility checks, so subsequent file-specific processing applies to every row in the group. This requirement is documented and checked at runtime.
Testing
Added deterministic tests using the actual Iceberg reader. Both file reads finish before combining, making coverage independent of worker timing. The tests verify that matching constants combine, differing constants remain separate, and output values and batch sizes are correct.
Integration coverage includes separate physical-column and metadata-only queries for imported identity-partition tables and native tables with partition specification evolution. These run across
PERFILE,MULTITHREADED, andCOALESCINGreaders.Validation at
9d219e613used an RTX A5500 and Hadoop catalog:| Spark | Iceberg | Full Iceberg integration | Targeted format v1 | Targeted format v2 | Targeted format v3 | Selected Scala tests |
|---|---|---|---|---|---|---|
| 3\.5.3 | 1\.6.1 | 401 passed, 84 skipped | 15 passed | 15 passed | Unsupported | 120 passed, 11 canceled |
| 3\.5.8 | 1\.9.2 | 401 passed, 84 skipped | 15 passed | 15 passed | Unsupported | 120 passed, 11 canceled |
| 3\.5.8 | 1\.10.1 | 446 passed, 39 skipped | 15 passed | 15 passed | 15 passed | 131 passed |
| 4\.0.1 | 1\.10.1 | 456 passed, 29 skipped | 15 passed | 15 passed | 15 passed | 87 passed |
| 4\.1.1 | 1\.11.0 | 463 passed, 22 skipped | 15 passed | 15 passed | 15 passed | 89 passed |
Targeted v1/v2/v3 runs explicitly set and verify the Iceberg table format version. Each covers five scenarios across three reader types: schema evolution, partition specification evolution, imported identity partitions, and the two metadata-only regression scenarios.
Selected Scala coverage includes Iceberg reader and post-processor suites, S3 input handling,
ParquetCombineSuite, andBatchWithPartitionDataSuite. Spark 4.1.1 additionally covers write-summary commits. The canceled tests require unsupported lineage functionality.Additional Spark 3.5.8 validation:
| Suite | Passed | Skipped | XFAIL | XPASS |
|---|---:|---:|---:|---:|
| Parquet | 3,724 | 115 | 0 | 0 |
| ORC | 2,457 | 18 | 1 | 124 |
| CSV | 1,094 | 0 | 40 | 8 |
| JSON | 2,716 | 13 | 110 | 129 |
| Delta | 319 | 11 | 0 | 0 |
| Delta delete/update/merge/write | 545 | 159 | 0 | 0 |
| Avro | 44 | 0 | 0 | 0 |
| Hive text | 143 | 0 | 6 | 0 |
| Selected shared-reader Scala tests | 140 | 0 | 0 | 0 |
Final results contain no unexpected test failures.
Performance
CPU baseline: Spark’s CPU Iceberg reader with RAPIDS disabled. GPU: the split implementation in this PR. Benchmarks used an RTX A5500, Spark 4.1.1, Iceberg 1.11.0, Scala 2.13, and
local[2].Environment: Spark 4.1.1, Iceberg 1.11.0, Scala 2.13,
local[2], and an RTX A5500 for the existing GPU runs. CPU and GPU use identical datasets, query settings, and workload order, with a fresh JVM per row count. Each workload uses three warmups and five measured queries. Runs were collected separately.The workloads use native Iceberg tables with 8, 16, 24, or 32 files in one scan task:
All tables use one partition specification. The query materializes metadata columns without reading Parquet column data:
AQE and aggregate pushdown are disabled. GPU settings use a one-billion-row reader batch limit, 64 MiB combining, and a zero combine wait. Dataset preparation is excluded; query execution and result collection are timed.
Each cell shows CPU / GPU median milliseconds. Row counts are per file.
Same constants
| Rows/file | 8 files | 16 files | 24 files | 32 files |
|---:|---:|---:|---:|---:|
| 1M | 423\.2 / 158.2 | 680\.2 / 150.4 | 991\.4 / 137.7 | 1,309.0 / 110.6 |
| 5M | 1,671.7 / 164.4 | 3,489.6 / 159.6 | 4,939.7 / 149.9 | 6,580.4 / 152.9 |
| 50M | 15,885.7 / 244.7 | 32,608.9 / 363.4 | 48,767.8 / 468.2 | 65,280.0 / 581.4 |
| 100M | 31,304.0 / 358.7 | 64,884.7 / 583.7 | 98,091.3 / 810.8 | 130,841.9 / 1,035.7 |
Different constants
| Rows/file | 8 files | 16 files | 24 files | 32 files |
|---:|---:|---:|---:|---:|
| 1M | 406\.2 / 222.3 | 681\.2 / 303.7 | 1,011.0 / 387.9 | 1,326.8 / 469.9 |
| 5M | 1,704.6 / 231.3 | 3,330.2 / 312.9 | 4,983.7 / 393.3 | 6,607.9 / 482.0 |
| 50M | 16,327.6 / 306.8 | 32,616.0 / 453.1 | 48,804.8 / 615.2 | 65,066.8 / 775.3 |
| 100M | 32,527.6 / 379.1 | 65,111.3 / 613.7 | 97,643.8 / 864.4 | 129,690.1 / 1,087.6 |
All reported results were correct. The new CPU run completed 32 workloads, totaling 96 warmup queries and 160 measured queries.
AI assistance was used in implementation and validation.
Checklists
Documentation
Testing
(Please provide the names of the existing tests in the PR description.)
Performance