Skip to content

fix: have the native Iceberg write read a converted child's Arrow stream - #7536

Open
zhangfengcdt wants to merge 1 commit into
apache:mainfrom
zhangfengcdt:fix/iceberg-write-arrow-stream
Open

zhangfengcdt wants to merge 1 commit into
apache:mainfrom
zhangfengcdt:fix/iceberg-write-arrow-stream

Conversation

@zhangfengcdt

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #7239.

Rationale for this change

A native Iceberg write over a Spark-to-Arrow conversion wrapped the conversion's executeColumnar batches in a reader that closes each batch once native has it. The conversion reuses its vectors for the next batch, and closing a struct vector drops its children, so the second batch of a partition fails with no more field nodes. Native shuffle had the same bug, fixed in #6689 by reading the child's Arrow stream.

On main the symptom is hidden since #7325, which copies each batch into fresh vectors. The release branches have neither change, so the bug is live there.

What changes are included in this PR?

CometIcebergWriteExec reads a CometNativeArrowSource child through doExecuteAsArrowStream(), as #6689 does for shuffle. Any other columnar child is wrapped into one Arrow stream per partition, which is what the operator did per task before; the scheduler test probe stays on that path.

How are these changes tested?

A test in CometIcebergWriteActionSuite writes a struct column from an RDD-backed DataFrame with spark.comet.batchSize=2. With the batch reader as it was before #7325 it fails with no more field nodes for field a, and passes with this change. CometIcebergWriteActionSuite and CometIcebergWriteDetectionSuite pass on Spark 4.1.

A native Iceberg write over a Spark-to-Arrow conversion wrapped the
conversion's executeColumnar batches in a reader that closes each batch
once native has it. The conversion reuses its vectors for the next
batch, and closing a struct vector drops its children, so the second
batch of a partition failed to import with "no more field nodes". The
write now reads such a child's Arrow stream, as native shuffle does
since apache#6689.
@github-actions github-actions Bot added bug Something isn't working area:writer Native Parquet writer area:Iceberg labels Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Iceberg area:writer Native Parquet writer bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native Iceberg write fails with "no more field nodes" on a struct column when its input is a Spark-to-Arrow conversion

1 participant