Skip to content

fix: arrow schema to schema supports uuids - #2930

Merged
CTTY merged 12 commits into
apache:mainfrom
JosephLenton:fix-arrow-schema-to-schema-supports-uuids
Oct 15, 2026
Merged

CTTY merged 12 commits into
apache:mainfrom
JosephLenton:fix-arrow-schema-to-schema-supports-uuids

Conversation

@JosephLenton

@JosephLenton JosephLenton commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • This adds UUID support to arrow_schema_to_schema and arrow_schema_to_schema_auto_assign_ids.
  • When they see a field with the extension ARROW:extension:metadata=arrow.uuid, then the field is converted to an Iceberg UUID type.

What changes are included in this PR?

  • The visitor used for converting from Arrow to Iceberg has a UUID section added. This is similar to how it handles variant.
  • UUID support is added to the ToArrowSchemaConverter as well for converting from iceberg to arrow.

Are these changes tested?

  • A new test is added to capture UUID conversion on its own.
  • UUID is added to large arrow_schema_to_schema_auto_assign_ids test.
  • UUID tests are added for the Iceberg to arrow conversions.
  • Tests are added that do a round trip from arrow to iceberg to arrow, and iceberg to arrow to iceberg.

AI Disclosure

AI was used to:

  • apply the fix to the visitor,
  • add a UUID case to the test test_arrow_schema_to_schema_with_field_id,
  • add the test test_parquet_writer_uuid_logical_type.

I built a failing test first and reviewed it's code to ensure it's output worked.

The test_arrow_schema_to_schema_should_convert_uuids test, commit message, and the bug report, were all written without any AI at all.

@JosephLenton
JosephLenton force-pushed the fix-arrow-schema-to-schema-supports-uuids branch from 30d1bc2 to 2fd4148 Compare July 31, 2026 12:57
@JosephLenton
JosephLenton marked this pull request as ready for review July 31, 2026 15:10
@mbutrovich
mbutrovich self-requested a review August 6, 2026 14:34

@mbutrovich mbutrovich left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

First pass, thanks for looking at this @JosephLenton!

Comment thread crates/iceberg/src/arrow/schema.rs Resolved
Comment thread crates/iceberg/src/arrow/schema.rs Resolved
@JosephLenton
JosephLenton force-pushed the fix-arrow-schema-to-schema-supports-uuids branch from 2fd4148 to dc6f224 Compare August 6, 2026 19:52
@JosephLenton
JosephLenton requested a review from mbutrovich August 6, 2026 19:56
@JosephLenton

Copy link
Copy Markdown
Contributor Author

Thank you for the review @mbutrovich . You should find all of your comments addressed. I made all of the changes you suggested, and brought in UUID support on ToArrowSchemaConverter.

When you have time if I could get another review please, that would be grand!

@JosephLenton
JosephLenton force-pushed the fix-arrow-schema-to-schema-supports-uuids branch from dc6f224 to 445db4a Compare August 24, 2026 08:41
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Sep 24, 2026
@JosephLenton

Copy link
Copy Markdown
Contributor Author

I am still waiting on a review for this.

@mbutrovich mbutrovich left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the updates @JosephLenton, and sorry for the wait. The storage check and the reverse-direction tagging both look good. The comments below are about enabling the matching parquet feature so the new tag reaches the files we write, plus a stale doc comment and a few test gaps.

Comment thread crates/iceberg/Cargo.toml
arrow-cast = { workspace = true }
arrow-ord = { workspace = true }
arrow-schema = { workspace = true }
arrow-schema = { workspace = true, features = ["canonical_extension_types"] }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Now that schema_to_arrow_schema tags UUID fields with arrow.uuid, should parquet get its arrow_canonical_extension_types feature too (line 69)? The arrow-schema feature enabled here doesn't turn on the parquet one, and parquet's UUID mapping is behind its own cfg(feature = "arrow_canonical_extension_types").

I wrote a UUID column through ParquetWriter at this commit and inspected the file. The Parquet column has no logical type, but the spec requires fixed_len_byte_array[16] with the UUID logical type (spec). Reads also disagree depending on who wrote the file. Our files come back tagged arrow.uuid only because arrow-rs embeds the ARROW:schema footer entry. A file without that entry (Java, Spark, PyIceberg) comes back as a bare FixedSizeBinary(16), even though schema_to_arrow_schema for the same table now says arrow.uuid.

With features = ["async", "encryption", "arrow_canonical_extension_types"] on parquet, the writer emits the UUID logical type and all three cases read back tagged. cargo test -p iceberg --lib still passes with that change (1580 passed). Could you add it here, with a writer test that asserts the logical type in the Parquet schema?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I have this done. I broke out all my changes into their own commits for ease of review. The change for this is done here: 58cb38e

I did also get Claude to help me understand this and write it. Please do raise if you feel my work here is wrong.

Comment thread crates/iceberg/src/arrow/schema.rs Resolved
Comment thread crates/iceberg/src/arrow/schema.rs Resolved
Comment thread crates/iceberg/src/arrow/schema.rs Resolved
@JosephLenton

Copy link
Copy Markdown
Contributor Author

It's all good on the delays @mbutrovich . Cheers for the re-review. I will look through it and rectify those points.

@github-actions github-actions Bot removed the stale label Sep 25, 2026
@JosephLenton
JosephLenton force-pushed the fix-arrow-schema-to-schema-supports-uuids branch from 445db4a to 58cb38e Compare September 29, 2026 16:20
@JosephLenton

Copy link
Copy Markdown
Contributor Author

Hey @mbutrovich , can I have a re-review please.

You should find I have rebased my PR off of main, and addressed all of your comments.

@CTTY CTTY left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! thanks for fixing it! Could you fix the CI before we merging it please?

@JosephLenton
JosephLenton force-pushed the fix-arrow-schema-to-schema-supports-uuids branch from 58cb38e to 8aa6bc3 Compare October 15, 2026 10:43
@JosephLenton

JosephLenton commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Cheers @CTTY ! I have rebased off main, and formatted the Cargo.toml.

I don't have the ability to hit merge. I will need someone to do that for me.

@CTTY
CTTY added this pull request to the merge queue Oct 15, 2026
Merged via the queue into apache:main with commit f83bec4 Oct 15, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arrow_schema_to_schema fails to convert Arrow fields with UUID extension to Iceberg UUID

3 participants