Skip to content

Conversation

@kevinburkesegment
Copy link

AVRO JIRA instance ticket number will be filed as soon as my request to create a JIRA account is granted.

What is the purpose of the change

When using GenericDatumReader with schemas containing "java-class" attributes on string fields (e.g., java.math.BigDecimal), FastReaderBuilder throws:

ClassCastException: Utf8 cannot be cast to String

The bug is in getTransformingStringReader() which casts the result of stringReader.read() directly to String, but GenericData returns Utf8.

This commit adds a failing test to reproduce the issue.

Verifying this change

Run the test suite.

Documentation

  • Does this pull request introduce a new feature? No

@github-actions github-actions bot added the Java Pull Requests for Java binding label Jan 7, 2026
@kevinburkesegment
Copy link
Author

I'd be happy to try and propose a fix as well but I'm not great at Java

…th java-class attribute

When using GenericDatumReader with schemas containing "java-class"
attributes on string fields (e.g., java.math.BigDecimal),
FastReaderBuilder throws:

    ClassCastException: Utf8 cannot be cast to String

The bug is in getTransformingStringReader() which casts the result of
stringReader.read() directly to String, but GenericData returns Utf8.

This commit adds a failing test to reproduce the issue.
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.

1 participant