Skip to content

Parquet: Fix variant metrics crash when value column has no stats#16585

Merged
huaxingao merged 3 commits into
apache:mainfrom
nssalian:fix-variant-metrics-empty-stats
Jun 20, 2026
Merged

Parquet: Fix variant metrics crash when value column has no stats#16585
huaxingao merged 3 commits into
apache:mainfrom
nssalian:fix-variant-metrics-empty-stats

Conversation

@nssalian

Copy link
Copy Markdown
Collaborator

Closes #16567

Rationale for this change

Spark writes to Iceberg tables with shredded VARIANT columns crash with NoSuchElementException during DataWriter.close() when the variant value sub-column has no usable parquet Statistics. Matches the iceberg-go #932 approach for variant sub-columns lacking stats.

What changes are included in this PR?

MetricsVariantVisitor.value() returns empty bounds when valueResult is empty, instead of calling Iterables.getOnlyElement on it.

Are these changes tested?

Yes. testShreddedValueColumnWithEmptyStats writes a shredded variant with parquet stats disabled. Fails with the issue's exact stack trace without the fix; passes with it.

Are there any user-facing changes?

No. Crash becomes graceful drop of bounds for the affected variant column.

@huaxingao huaxingao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nssalian

Copy link
Copy Markdown
Collaborator Author

@Fokko PTAL when you get a chance.

@nssalian nssalian requested review from huaxingao and singhpk234 June 16, 2026 22:29
@huaxingao huaxingao merged commit 56b1e19 into apache:main Jun 20, 2026
53 checks passed
@huaxingao

Copy link
Copy Markdown
Contributor

Thanks @nssalian for the PR! Thanks @wombatu-kun for the review!

@nssalian nssalian deleted the fix-variant-metrics-empty-stats branch June 22, 2026 02:57
@nssalian nssalian added this to the Iceberg 1.12.0 milestone Jun 23, 2026
jakelong95 pushed a commit to jakelong95/iceberg that referenced this pull request Jun 29, 2026
…ache#16585)

* Parquet: Fix variant metrics crash when value column has no stats

* Fixup after 16327
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apache Iceberg version 1.11.0 (org.apache.iceberg:iceberg-spark-runtime-4.0_2.13:1.11.0)

3 participants