avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Lewi <jer...@lewi.us>
Subject Problems with SortedKeyValueFile.Reader: Generic vs Specific Interface
Date Sun, 16 Dec 2012 07:06:18 GMT
HI avro-users,

I'm having issues with SortedKeyValueFile.Reader. Even though the return
type of get is a specific record type, the actual instance returned has
type GenericRecord. How do I convert this GenericRecord into an instance of
my specific record?

Looking at the source code SortedKeyValueFile is using the Generic
interface to read the data. But the return type for get is V where I have
set V to be a specific record. e.g

SortedKeyValueFile.Reader<CharSequence, GraphNodeData> where GraphNodeData
is one of my avro records.

I don't understand how  this code compiles since the return type is
V=GraphNodeData and a GenericRecord can't be cast to a GraphNodeData.

Thoughts?

Thanks
J

Mime
View raw message