You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Doug Cutting <cu...@apache.org> on 2013/08/13 19:38:30 UTC

Re: Read specific record from DataFileReader for avro files

Avro data files don't easily permit random access to records.  One
approach is that you could index the result of the previous
DataFileWriter#sync() of each record, then use DataFileReader#seek()
and scan for the desired record.

Also, please consider using SortedKeyValueFile.

http://avro.apache.org/docs/current/api/java/org/apache/avro/hadoop/file/SortedKeyValueFile.html

Doug

On Tue, Jun 4, 2013 at 9:32 AM, amit nanda <am...@gmail.com> wrote:
> Hi,
>
> I have avro files that have a number of records in each file, we generate
> indexes using Lucene for these files, and now depending upon the index
> matches I want to read some specific records from the avro file.
>
> I am using DataFileReader for this, but i am not able to find a way to read
> random records. ANy help is much appreciated.
>
>
>
>