Skip to content

fix: table UUID partitions not working - #2916

Merged
blackmwk merged 31 commits into
apache:mainfrom
JosephLenton:fix-uuid-partitions-fail
Nov 21, 2026
Merged

blackmwk merged 31 commits into
apache:mainfrom
JosephLenton:fix-uuid-partitions-fail

Conversation

@JosephLenton

@JosephLenton JosephLenton commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Table Partitions work on writing with UUID values.

What changes are included in this PR?

  • The Avro schema for uuid now matches the spec's fixed[16] + logicalType: uuid named uuid_fixed, instead of a string.
  • PrimitiveLiteral::UInt128 will now convert to a new RawLiteralEnum::Fixed, when the type is UUID. This writes an Avro Value::Fixed, which apache-avro requires for a fixed uuid schema.
  • PrimitiveLiteral::Binary also converts to RawLiteralEnum::Fixed, when the type is fixed[N].
  • RawLiteralEnum::String can now be read back as a UUID. Only hyphenated UUIDs are accepted, to match the Java implementation.

Are these changes tested?

I added:

  • a large number of round trips tests for converting different types via the manifest writer and Datum, to show we can convert to and back correctly. This includes UUID.
  • the Avro schema generated for a uuid field.
  • converting UUID, fixed[16] and 16 byte binary values to and from Avro and JSON.
  • accepting hyphenated UUID strings, and rejecting invalid or non-hyphenated ones.
  • writing and reading back a manifest with UUID and fixed[16] partitions, for v1, v2 and v3.
  • a manifest with two UUID partition fields to:
    • to confirm the shared uuid_fixed schema name does not error.
    • to confirm sharing with null does not error.

AI Disclosure

I have used Claude code substantially during this to:

  • write the implementation,
  • implement tests,
  • summarise and act on review comments,
  • and it has written some of this PR description.

@JosephLenton JosephLenton changed the title Fix UUID partitions fail fix: table UUID partitions not working Jul 27, 2026
@JosephLenton

Copy link
Copy Markdown
Contributor Author

A few notes ... Avro has an avro::Value::Uuid type so I did look into adding a RawLiteralEnum::Uuid type. Then the types internally could all match up. However this doesn't play well with Serde + apache_avro::to_value. Uuid will only serialise to bytes or a string.

The other thing I found is with the integration tests. I found when I had multiple tests in the same file it would fail with a Reqwest + Tokio error. I believe in opendal-core there is a global Reqwest client, and this will keep sessions alive across multiple tests within the same program (i.e. a single integration test). It doesn't do this if the endpoint changes (this is relevant later).

As a workaround I put my second test into a second file.

I'd be happy to try to solve this in a followup ticket if there is interest, and any other work to make test simpler. The solution is technically straight forward, but would be a chunk of code. We are talking a custom S3 storage layer, changing OpenDal core, or moving to use test-containers (as the endpoint will be different across tests). So I've left that out.

@JosephLenton
JosephLenton force-pushed the fix-uuid-partitions-fail branch from f92395e to de83553 Compare July 27, 2026 19:44

@blackmwk blackmwk 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.

Thanks @JosephLenton for this fix!

Comment thread crates/integration_tests/src/lib.rs Resolved
Comment thread crates/iceberg/src/spec/values/serde.rs Resolved
@JosephLenton
JosephLenton force-pushed the fix-uuid-partitions-fail branch 2 times, most recently from 5f0221f to 6ca9fa2 Compare July 29, 2026 11:01
@JosephLenton

JosephLenton commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Hey @blackmwk those changes are done. Please take another look when you have time!

Btw whilst working on this I found a few items which I suspect to be bugs. I can add them as tickets later when I have time:

@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 working on this @JosephLenton!

Comment thread crates/iceberg/src/spec/values/serde.rs Resolved
Comment thread crates/iceberg/src/spec/values/serde.rs Resolved
Comment thread crates/iceberg/src/spec/values/tests.rs Resolved
@JosephLenton
JosephLenton force-pushed the fix-uuid-partitions-fail branch from 6ca9fa2 to a9fbd60 Compare August 7, 2026 07:05
Comment thread crates/integration_tests/src/lib.rs Resolved
Comment thread crates/iceberg/src/avro/schema.rs Resolved
Comment thread crates/iceberg/src/spec/values/tests.rs Resolved
@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

Please keep this around for a little longer. It does not need a review.

I plan to return to this PR this week, to try and get UUIDs working in partitions.

@mbutrovich mbutrovich removed the stale label Sep 29, 2026
@mbutrovich

Copy link
Copy Markdown
Collaborator

Removed the stale tag. Thanks for sticking with this @JosephLenton!

@JosephLenton

Copy link
Copy Markdown
Contributor Author

Hey @mbutrovich , I have updated this and it should now be ready for review!

The main changes since it was first open:

  • It's now rebased off main and using Avro 0.22.
  • I've cleaned up removing a bunch of things.
  • I changed the Avro UUID schema from UUID::String to UUID::FixedSize.
  • I have added a RawLiteralEnum::Uuid for the serialiation.

I have tested these changes locally against DF integration tests, and a private Iceberg project, and on both UUID partitions are now working.

@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 coming back to this after the Avro 0.22 release, @JosephLenton! Writing the uuid as the spec's 16-byte fixed type is the right fix, and it keeps the manifest format the same as Java's.

Comment thread Cargo.lock Resolved
Comment thread crates/iceberg/src/avro/schema.rs Resolved
Comment thread crates/iceberg/src/spec/values/serde.rs Resolved
Comment thread crates/iceberg/src/spec/values/serde.rs Resolved
Comment thread crates/iceberg/src/spec/values/serde.rs Resolved
Comment thread crates/iceberg/src/spec/values/serde.rs Resolved
@blackmwk

blackmwk commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Please also resovle conflicts

@JosephLenton
JosephLenton force-pushed the fix-uuid-partitions-fail branch 2 times, most recently from c32a830 to b6b77af Compare November 5, 2026 00:08
@JosephLenton

Copy link
Copy Markdown
Contributor Author

Hey @mbutrovich and @blackmwk . Thank you both for the reviews! I have rebased, removed the Cargo.lock update, addressed most of the points.

I have pushed back on removing RawLiteralEnum::Uuid, as I feel it is needed. I've left a comment explaining why.

Please can you take a look when you both have time. Thank you again!

@JosephLenton
JosephLenton force-pushed the fix-uuid-partitions-fail branch from 095455c to 3b66443 Compare November 20, 2026 11:36
@JosephLenton

Copy link
Copy Markdown
Contributor Author

No worries. @blackmwk I've just pushed up a rebase just now.

@JosephLenton

Copy link
Copy Markdown
Contributor Author

I can see there are some issues with the rebase. I will get this resolved over the next few hours.

@JosephLenton

Copy link
Copy Markdown
Contributor Author

@blackmwk that is now resolved. The CI is now green.

@blackmwk
blackmwk added this pull request to the merge queue Nov 21, 2026
Merged via the queue into apache:main with commit a7160a0 Nov 21, 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.

Partitions with type UUID fail to create transactions

3 participants