Package org.apache.avro.mapreduce
Class AvroKeyValueRecordReader<K,V>
java.lang.Object
org.apache.hadoop.mapreduce.RecordReader<AvroKey<K>,AvroValue<V>>
org.apache.avro.mapreduce.AvroRecordReaderBase<AvroKey<K>,AvroValue<V>,GenericRecord>
org.apache.avro.mapreduce.AvroKeyValueRecordReader<K,V>
- Type Parameters:
K
- The type of the Avro key to read.V
- The type of the Avro value to read.
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class AvroKeyValueRecordReader<K,V>
extends AvroRecordReaderBase<AvroKey<K>,AvroValue<V>,GenericRecord>
Reads Avro generic records from an Avro container file, where the records
contain two fields: 'key' and 'value'.
The contents of the 'key' field will be parsed into an AvroKey object. The contents of the 'value' field will be parsed into an AvroValue object.
-
Constructor Summary
ConstructorDescriptionAvroKeyValueRecordReader
(Schema keyReaderSchema, Schema valueReaderSchema) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Methods inherited from class org.apache.avro.mapreduce.AvroRecordReaderBase
close, createAvroFileReader, createSeekableInput, getCurrentRecord, getProgress, initialize
-
Constructor Details
-
AvroKeyValueRecordReader
Constructor.- Parameters:
keyReaderSchema
- The reader schema for the key within the generic record.valueReaderSchema
- The reader schema for the value within the generic record.
-
-
Method Details
-
nextKeyValue
- Overrides:
nextKeyValue
in classAvroRecordReaderBase<AvroKey<K>,
AvroValue<V>, GenericRecord> - Throws:
IOException
InterruptedException
-
getCurrentKey
- Specified by:
getCurrentKey
in classRecordReader<AvroKey<K>,
AvroValue<V>> - Throws:
IOException
InterruptedException
-
getCurrentValue
- Specified by:
getCurrentValue
in classRecordReader<AvroKey<K>,
AvroValue<V>> - Throws:
IOException
InterruptedException
-