Skip to content

Conversation

@RustedBones
Copy link
Contributor

What is the purpose of the change

ParseContext.put accept known schemas when strictly identical. Call to this method was made before schema was fully parsed avoiding exact schema redefinition in files.

Call ParseContext.put when schema is fully parsed.

This has an inpact on the schemas ordering returned by the parser.

Verifying this change

Tests were adapted by adding a redefinition of the MyResponse schema in the ApplicationEvent record

Documentation

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

ParseContext.put accept known schemas when strictly identical.
Call to this method was made before schema was fully parsed avoiding
exact schema redefinition in files.

Call ParseContext.put when schema is fully parsed.

This has an inpact on the schemas ordering returned by the parser.
@github-actions github-actions bot added the Java Pull Requests for Java binding label Jan 28, 2025
@ismailbay
Copy link

ismailbay commented May 22, 2025

Hi, any updates on this PR @cutting ?

@opwvhk
Copy link
Contributor

opwvhk commented May 29, 2025

It took me a while to really understand this PR, and why it changes the parsing behaviour (most notably the order or parse results).

I'm also renaming it to match the other reported issue for this.

@opwvhk opwvhk changed the title AVRO-3940: [java] Allow schema redefinition when equal AVRO-4071: [java] Allow schema redefinition when equal May 29, 2025
@opwvhk opwvhk merged commit cea41a4 into apache:main May 29, 2025
8 checks passed
@barun-jha-maersk
Copy link

@opwvhk, can we get a release for this fix, as we are waiting for same due to the bug fixed in this commit.

@aartigao
Copy link

We're also facing this issue and having a release would be great! 🙏🏽

opwvhk pushed a commit that referenced this pull request Jun 13, 2025
ParseContext.put accept known schemas when strictly identical.
Call to this method was made before schema was fully parsed avoiding
exact schema redefinition in files.

Call ParseContext.put when schema is fully parsed.

This has an inpact on the schemas ordering returned by the parser.

(cherry picked from commit cea41a4)
opwvhk pushed a commit to opwvhk/avro that referenced this pull request Sep 5, 2025
ParseContext.put accept known schemas when strictly identical.
Call to this method was made before schema was fully parsed avoiding
exact schema redefinition in files.

Call ParseContext.put when schema is fully parsed.

This has an inpact on the schemas ordering returned by the parser.
@lhotari
Copy link
Member

lhotari commented Nov 20, 2025

This change breaks compatibility with previous releases.

Seeing this StackOverflowError in Pulsar tests:

  Caused by: java.lang.StackOverflowError
  	at org.apache.avro.specific.SpecificData.createSchema(SpecificData.java:492)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:673)
  	at org.apache.avro.reflect.ReflectData.createNonStringMapSchema(ReflectData.java:548)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:642)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:649)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)
  	at org.apache.avro.reflect.ReflectData.createNonStringMapSchema(ReflectData.java:549)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:642)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:649)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)
  	at org.apache.avro.reflect.ReflectData.createNonStringMapSchema(ReflectData.java:549)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:642)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:649)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)
  	at org.apache.avro.reflect.ReflectData.createNonStringMapSchema(ReflectData.java:549)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:642)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:649)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)
  	at org.apache.avro.reflect.ReflectData.createNonStringMapSchema(ReflectData.java:549)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:642)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:649)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)
  	at org.apache.avro.reflect.ReflectData.createNonStringMapSchema(ReflectData.java:549)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:642)
  	at org.apache.avro.reflect.ReflectData.createFieldSchema(ReflectData.java:894)
  	at org.apache.avro.reflect.ReflectData$AllowNull.createFieldSchema(ReflectData.java:98)
  	at org.apache.avro.reflect.ReflectData.createSchema(ReflectData.java:744)

lhotari added a commit to lhotari/avro that referenced this pull request Nov 20, 2025
@lhotari
Copy link
Member

lhotari commented Nov 20, 2025

I filed https://issues.apache.org/jira/browse/AVRO-4209 about the issue.

@lhotari
Copy link
Member

lhotari commented Dec 2, 2025

@opwvhk @RustedBones Do you have a chance to take a look at https://issues.apache.org/jira/browse/AVRO-4209 since this PR caused the regression?

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.

6 participants