GithubHelp home page GithubHelp logo

Comments (6)

michaelandrepearce avatar michaelandrepearce commented on May 31, 2024

Also it seems that if i write with a SpecificRecord, i must read with one, and like wise if i write with a GenericRecord, i must read with one.

This will cause issues, where an app produces with specific and another consumes without the specific (aka some generic integration) and vice-versa.

Should not serial/deserialize to Generic/Specific based on how an array is written, but based on if the app has a SpecificRecord on the CP or not. (similar to confluents)

    int recordType = payloadInputStream.read();
                LOG.debug("Received record type: [{}]", Integer.valueOf(recordType));
                Object datumReader = null;
                Schema readerSchema = readerSchemaVersion != null?(Schema)this.getSchema(new SchemaVersionKey(schemaName, readerSchemaVersion)):null;
                if(recordType == 0) {
                    datumReader = readerSchema != null?new GenericDatumReader(e, readerSchema):new GenericDatumReader(e);
                } else {
                    datumReader = readerSchema != null?new SpecificDatumReader(e, readerSchema):new SpecificDatumReader(e);
                }

from registry.

michaelandrepearce avatar michaelandrepearce commented on May 31, 2024

I have raised a PR to hopefully address this.

#115

it would be good if this could make next release (due soon i believe reading google groups), as this is blocking us currently.

from registry.

satishd avatar satishd commented on May 31, 2024

@michaelandrepearce Which version id should be set for KafkaAvroDeserializer?

+1 to be flexible for consuming either specific record or generic record on deserializer side. We can target addressing this issue in upcoming release.

from registry.

michaelandrepearce avatar michaelandrepearce commented on May 31, 2024

For what you serialize into for specific it's redundant, as specefic it should take the schema of what's on concrete class on the class path.

For generic if not provided / present you simply don't evolve and you serialize into generic record using the inbound version.

For generic if provided then you can evolve as you serialize into generic record

This is a key point here.

from registry.

michaelandrepearce avatar michaelandrepearce commented on May 31, 2024

See the pr, This is all the same logic that's in the confluent serdes also.

from registry.

michaelandrepearce avatar michaelandrepearce commented on May 31, 2024

Logic to deal with if no readerSchema (aka no reader version id)

+    private DatumReader getDatumReader(Schema writerSchema, Schema readerSchema) {
 +        if(this.useSpecificAvroReader) {
 +            if(readerSchema == null) {
 +                readerSchema = this.getReaderSchema(writerSchema);
 +            }
 +
 +            return new SpecificDatumReader(writerSchema, readerSchema);
 +        } else {
 +            return readerSchema == null?new GenericDatumReader(writerSchema):new GenericDatumReader(writerSchema, readerSchema);
 +        }
 +    }

from registry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.