Skip to content

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

Open
nssalian wants to merge 1 commit into
apache:mainfrom
nssalian:fix-variant-metrics-empty-stats
Open

Parquet: Fix variant metrics crash when value column has no stats#16585
nssalian wants to merge 1 commit into
apache:mainfrom
nssalian:fix-variant-metrics-empty-stats

Conversation

@nssalian
Copy link
Copy Markdown
Contributor

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.

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)

1 participant