[ https://issues.apache.org/jira/browse/AVRO-266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12794258#action_12794258 ]
Todd Lipcon commented on AVRO-266: ---------------------------------- I think the best solution to this would be to deserialize unions as a tagged class, with one member field per type plus either an enum, int, or Schema reference "selectedType" field. We can still provide a .getObject() accessor which returns java.lang.Object. This would allow really easy reuse of the constituent records. > Union as java.lang.Object prevents object reuse > ----------------------------------------------- > > Key: AVRO-266 > URL: https://issues.apache.org/jira/browse/AVRO-266 > Project: Avro > Issue Type: Improvement > Affects Versions: 1.2.0 > Reporter: Todd Lipcon > > Because Unions end up deserializing as java.lang.Object and using the > object's type to differentiate the union constituents, object reuse is pretty > hard to achieve. I don't have a specific benchmark, but I think this will > hurt performance for logging applications where every record in a large file > is a union, and the type tends to change for each record. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.