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

Doug Cutting commented on AVRO-804:
-----------------------------------

Raghu, that'd be great if you wanted to take a stab at this.  I'd be happy to 
collaborate.

Some initial thoughts:

- We can cache the Class<extends TBase> -> Schema mapping in a static 
ConcurrentHashMap.
- We might use schema properties for types that don't map exactly, e.g., 
Thrift's i16 type could be mapped to the Avro schema {"type":"int", 
"thrift":"i16"}.  Dunno if that'll be required, though.
- Thrift field numbers can be saved as Avro schema field properties, so that, 
when reading into a Thrift-generated class we'd set values by number, not name, 
since that's Thrift semantics.
- The implementation should subclass GenericData, GenericDatumReader & Writer, 
overriding methods like getField & setField.  Look at the specific and reflect 
subclasses of these for examples.
- ThriftDatumReader should probably have an Schema -> int[] cache for record 
schemas, where these arrays map from Avro field positions (as passed to 
setField) to Thrift field numbers, passed to TBase#setFieldValue().  

> Java: add ThriftDatumWriter and ThriftDatumReader
> -------------------------------------------------
>
>                 Key: AVRO-804
>                 URL: https://issues.apache.org/jira/browse/AVRO-804
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>            Reporter: Doug Cutting
>
> Add a ThriftDatumWriter that accepts Thrift-generated classes and writes them 
> in Avro format, and a ThriftDatumReader that reads Avro data into a 
> Thrift-generated class.  This would permit storage of Thrift-generated data 
> structures in Avro data files.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to