Skip to content

AVRO-4039 [java] fix GenericData.newArray to only return an appropriate array implementation #3307

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 7 commits into
base: main
Choose a base branch
from

Conversation

mkeskells
Copy link

What is the purpose of the change

  • Fix the class cast exceptions noted in the ticket (when using logical types)
  • Fix other paths that can return PrimitiveArray when it would not be appropriate
  • Tightness the constraints for the return value, so if a GenericContainer is returned the schema must match the supplied schema

appropriate means that

  • If the suppled value could act as a container for the values that will be added, then clear its values, and reuse
  • If it is a GenericContainer and thus has a schema, then the schema is the same
    If we can't reuse the supplied value, then generate an appropriate collection, using the optimised values where we can

Updated the documentation, and added tests

Verifying this change

This change added tests and can be verified as follows:

  • Added unit tests to ensure that appropriate values are returned (as described above)

Documentation

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

only return an appropriate array
@github-actions github-actions bot added the Java Pull Requests for Java binding label Feb 6, 2025
@mkeskells
Copy link
Author

related issue - https://issues.apache.org/jira/browse/AVRO-4039

Mike Skells added 3 commits February 7, 2025 15:46
only return an appropriate array
fix import that spotless removed
review feedback
remove schema check on returned value
Check convertors with logical types
review feedback
@opwvhk
Copy link
Contributor

opwvhk commented Mar 14, 2025

Hi @mkeskells,
Looks good!
Can you please push the commit with these last "removed"/"done" fixes?

review feedback
@mkeskells
Copy link
Author

Hi @mkeskells, Looks good! Can you please push the commit with these last "removed"/"done" fixes?

doh

pushed now

@mkeskells
Copy link
Author

@opwvhk What's the process from here to get this merged? Does it need other reviewers to approve etc?
I don't know the processes that apply here for this project

@mkeskells
Copy link
Author

Hi
What's the process to get this merged?

@jasmdk
Copy link

jasmdk commented Apr 11, 2025

@mkeskells it seems like it can be merged now. I am also waiting for this fix as it blocks us from upgrading Quarkus beyond version 3.13

@mkeskells
Copy link
Author

@jasmdk I don't have permission to merge. I don't know who is the appropriate maintainer who can merge this

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.

4 participants