avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Venkat <vramac...@ymail.com>
Subject Avro file - Seek to specific offset and read
Date Wed, 20 Feb 2013 20:23:30 GMT
Hi All,


Using DataFileReader, I'm trying to read data from a specific [start-offset] to an [end-offset].
Both the start and end offsets are marked with synchronization markers using DataFileWriter.sync()

The following is the snipped I use to read the data back:

        DataFileReader<GenericRecord> fileReader = new DataFileReader<GenericRecord>(input,
reader);      
        fileReader.seek(startOffset);  // set to the start-offset       

        while(fileReader.hasNext() && !fileReader.pastSync(endOffset))
        {
            GenericRecord gr = fileReader.next();
        }

This, however, reads & returns more records than what I wrote between the two offsets.



Appreciate your help regarding this.

Thanks

Mime
View raw message