Skip to content

[Avro] Small improvements #277

Closed
Closed
@MichalFoksa

Description

@MichalFoksa

Hi @cowtowncoder,

Here I have few points to improve Avro support inspired by t is inspired by #132 (comment) and also your comment #132 (comment) .

  1. Simple mapping of few Java date-time types to Avro logicalType on expectIntegerFormat(JavaType type). The mapping works if ObjectMapper is used with JavaTimeModule and WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS is disabled. In this combination JSR310 types are mapped to Avro LONG, only the logical type is missing.

    Implemented in 2.13 by [Avro] Add logicalType support for some java.time types; add AvroJavaTimeModule for native ser/deser #283

    new ObjectMapper
        .registerModule(new JavaTimeModule())
        .disable(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)
    ...
    
  2. Avro specific time module?

    Implemented in 2.13 by [Avro] Add logicalType support for some java.time types; add AvroJavaTimeModule for native ser/deser #283

  3. To ease customization by a user I suggest to add protected method VisitorFormatWrapperImpl createVisitorWrapper() into VisitorFormatWrapperImpl which creates and returns a new instance of visitor wrapper. This method would be used on each place where new visitor instance is created in ArrayVisitor, MapVisitor and RecordVisitor.

    By having this in place it is easier to add / modify existing functionality by a user. He just needs to extend existing visitor wrapper and override particular method (just ask me how I know it).

    protected VisitorFormatWrapperImpl createVisitorFormatWrapperImpl() {
        return new VisitorFormatWrapperImpl(_schemas, _provider);
    }
    

    Implemented in 2.13 by [Avro] Ease future customization by unifying place where a new visitor is created. #292

  4. Rename VisitorFormatWrapperImpl to AvroSchemaVisitorWrapper - or other, better name. Current one is confusing. See [Avro] Rename VisitorFormatWrapperImpl to AvroFormatVisitorWrapper in 2.14 or 3.0 #294

    Will be implemented by [Avro] Rename VisitorFormatWrapperImpl to AvroFormatVisitorWrapper in 2.14 or 3.0 #294

What do you think?
Michal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions