eolivelli opened a new pull request #10557:
URL: https://github.com/apache/pulsar/pull/10557


   ### Motivation
   
   When you run a Sink<GenericObject> and you call record.getSchema(), it does 
not return an accurate representation of the schema in case of a schema update.
   
   For instance:
   - the topic starts with AVRO Schema schema1
   - the AutoConsumeSchema starts by populating the internal SchemaInfo with 
the definition of schema1
   - the topic advances to AVRO Schema schema2
   - the AutoConsumeSchema still reports SchemaInfo for schema1
   - record.getSchema().getNativeSchema() reports the wrong schema definition
   
   ### Modifications
   
   With this change we leverage PIP-85 Message.getReaderSchema() API that 
returns the exact schema used for the Message, that is the schema that these 
pieces for information updated to the same "schemaVersion" of the Message 
represented by the Record:
   - reports the correct getSchemaInfo() 
   - reports the correct getNativeSchema() 
    
   ### Verifying this change
   This change adds new integration tests
   
   ### Does this pull request potentially affect one of the following parts:
   It affects Pulsar Sinks that implement Sink<GenericRecord>, in fact now 
Record.getSchema() will return accurate schema information. 
   
   ### Documentation
   No need for docs, previous behaviour was unexpected, the new behaviour is 
what you expect.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to