Skip to content

AVRO-3989: [java] add conversion classes to default instance of SpecificData #3354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hmit
Copy link

@hmit hmit commented Apr 8, 2025

What is the purpose of the change

This pull request improves deserialization of data when using default SpecificData instance.

Why?
Often times, SpecificDatumReader and ReflectDatumReader are configured using the default SpecificData instance. This leads to deserialization error when reading fields with union type and inner logical type (see test-case).

Deserialization works correctly when using the custom SpecificData instance stored in the MODEL$ field of the schema class that extends SpecificRecord. The custom SpecificData has the necessary conversions stored to handle fields with union and logical types. The issue has been reported multiple times, notably in [AVRO-3989](linked JIRA).

Verifying this change

This change added tests and can be verified as follows:

  • The added test passes when the code is present but fails when the code is removed

Documentation

  • Does this pull request introduce a new feature? (no)

@github-actions github-actions bot added the Java Pull Requests for Java binding label Apr 8, 2025
@hmit
Copy link
Author

hmit commented May 23, 2025

CC: @Fokko I'd appreciate it if you could look at this PR and leave any feedback for me! Also, apologies for the 1:1 ping in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java Pull Requests for Java binding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants