beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davor Bonaci (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BEAM-2303) Add SpecificData to AvroCoder
Date Sun, 28 May 2017 20:00:05 GMT

    [ https://issues.apache.org/jira/browse/BEAM-2303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16027931#comment-16027931
] 

Davor Bonaci commented on BEAM-2303:
------------------------------------

[~arvid heise], do you perhaps want to contribute a fix here? Would be much appreciated.

> Add SpecificData to AvroCoder
> -----------------------------
>
>                 Key: BEAM-2303
>                 URL: https://issues.apache.org/jira/browse/BEAM-2303
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>    Affects Versions: 2.1.0
>            Reporter: Arvid Heise
>            Assignee: Davor Bonaci
>
> The AvroCoder currently supports GenericData and ReflectData, but not SpecificData.
> It should relatively easy to incorporate it by expanding the logic while constructing
the Reader and Writer by also checking if the type implements the SpecificRecord interface.
It would greatly speed up (de-)serialization of Avro-generated java classes.
> {code}
>             return myCoder.getType().equals(GenericRecord.class)
>                 ? new GenericDatumReader<T>(myCoder.getSchema())
>                 : new ReflectDatumReader<T>(
>                     myCoder.getSchema(), myCoder.getSchema(), myCoder.reflectData.get());
> {code}
> should be
> {code}
>                         if (myCoder.getType().equals(GenericRecord.class)) {
>                             return new GenericDatumReader<T>(myCoder.getSchema());
>                         }
>                         if (SpecificRecord.class.isAssignableFrom(myCoder.getType()))
{
>                             return new SpecificDatumReader<T>(myCoder.getType());
>                         }
>                         return new ReflectDatumReader<T>(
>                                 myCoder.getSchema(), myCoder.getSchema(), myCoder.reflectData.get());
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message