fix(types): assign omitted field IDs in type JSON - #380
Merged
Merged
Conversation
Accept configured Variant shredding schemas whose ROW fields all omit IDs, matching Java Paimon's preorder numbering from 0. Preserve explicit IDs and require them when deserializing stored table schemas. Reject partially specified IDs in either order. Java's current parser accepts an explicit ID followed by an omitted one, which can produce duplicate IDs; reject that case as required by apache#347. Share the assigner across nested ROW, ARRAY and MAP types, preserve field names and descriptions without truncation, and cover both configuration keys and Parquet round trips with physical field IDs.
SteNicholas
force-pushed
the
PAIMON-347
branch
from
September 21, 2026 12:21
996c34e to
69bc74a
Compare
Member
|
Thanks to @SteNicholas for the fix. @suxiaogang223 , could you please check again whether the issue #347 is resolved after this PR is merged? Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: close #347
Java's
DataTypeJsonParsernumbers the ROW fields of a parsed type when none of them carries an id, so a configuredvariant.shreddingSchemawhose fields all omit their ids is accepted by Java Paimon but was rejected here while deserializing the firstDataField(key 'id' must exist). An embedding engine therefore had to route an otherwise supported Variant write back to the Java SDK only because the configured schema omitted optional field ids.This threads a field id assigner through the data type JSON parsing, mirroring Java's all-or-none rule:
Partial field id is not allowed.One deliberate deviation from Java: Java rejects the mix only when a generated id comes first, so an explicit id followed by an omitted one silently produces duplicate ids there, while both orders are rejected here. Deserializing a stored table schema still requires every field to carry its own id, as before.
Tests
DataTypeJsonParserTest.ParseTypeRowTypeGeneratesMissingFieldIds: ids generated in traversal order across nested ROW, ARRAY and MAP descendants.DataTypeJsonParserTest.ParseTypeRowTypeSuccess: non-sequential explicit ids preserved at every level.DataTypeJsonParserTest.ParseTypeComplexTypeFailure: partial ids rejected in either order, alongside the malformed complex type cases.DataFieldTest.FromJsonandDataFieldTest.FromJsonFailed: a stored schema still requires an id on every field, names and descriptions keep embedded NULs, and each malformed field key reports its own diagnostic.VariantShreddingWritePlanFactoryTest.ConfiguredSchema:variant.shreddingSchemaand itsparquet.variant.shreddingSchemafallback plan the same physical schema, field ids included, whether the configured schema carries ids or omits them.VariantShreddingWritePlanFactoryTest.ConfiguredSchemaRejectsPartialFieldIds.VariantParquetTest.ShreddedWriteAndReadRoundTrip: the newconfigured-without-idsmode asserts the generated ids reach the Parquet physical schema and that the shredded values round trip.API and Format
include/paimon/defs.honly gains documentation forvariant.shreddingSchema; there is no public symbol, storage format or protocol change. A configured schema that already carries field ids produces exactly the same physical schema as before.Documentation
docs/source/user_guide/data_types.rstdocuments that the configured shredding schema's fields either all carry anidor all omit one, in which case the ids are assigned in traversal order starting at 0.Generative AI tooling
Generated-by: Claude Opus 5
🤖 Generated with Claude Code