Skip to content

AVRO-4351: [C++] Preserve primitive custom attributes - #4001

Open
wgtmac wants to merge 1 commit into
apache:mainfrom
wgtmac:AVRO-4351
Open

wgtmac wants to merge 1 commit into
apache:mainfrom
wgtmac:AVRO-4351

Conversation

@wgtmac

@wgtmac wgtmac commented Sep 17, 2026

Copy link
Copy Markdown
Member

What is the purpose of the change

Avro C++ currently drops custom attributes attached directly to primitive
schema objects.

The schema compiler does not collect unknown properties from primitive objects,
and NodePrimitive::printJson only emits an object for logical types without
serializing primitive custom attributes.

This is required by integrations such as Apache Iceberg. Iceberg uses the
adjust-to-utc property to distinguish timestamp from timestamptz, while
both types use Avro long with the timestamp-micros logical type.

This change:

  • Preserves unknown properties when parsing primitive schema objects.
  • Serializes a primitive as a JSON object when it has a logical type or custom
    attributes.
  • Keeps the implementation generic and does not add Iceberg-specific behavior.

Verifying this change

This change added tests and can be verified as follows:

  • Added a schema round-trip test for Iceberg's adjust-to-utc property.
  • Added coverage for a generic primitive custom property without a logical type.

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

Preserve unknown properties when parsing and serializing primitive
schema objects. This keeps extensions such as Iceberg's adjust-to-utc
annotation intact across schema JSON round trips.
@github-actions github-actions Bot added the C++ Pull Requests for C++ binding label Sep 17, 2026
@wgtmac

wgtmac commented Sep 17, 2026

Copy link
Copy Markdown
Member Author

@martin-g @thiru-mg @Fokko Could you help review this? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C++ Pull Requests for C++ binding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant