org.apache.avro.mapreduce
Class AvroKeyValueRecordReader<K,V>
java.lang.Object
org.apache.hadoop.mapreduce.RecordReader<K,V>
org.apache.avro.mapreduce.AvroRecordReaderBase<AvroKey<K>,AvroValue<V>,org.apache.avro.generic.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
public class AvroKeyValueRecordReader<K,V>
- extends AvroRecordReaderBase<AvroKey<K>,AvroValue<V>,org.apache.avro.generic.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 |
AvroKeyValueRecordReader(org.apache.avro.Schema keyReaderSchema,
org.apache.avro.Schema valueReaderSchema)
Constructor. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AvroKeyValueRecordReader
public AvroKeyValueRecordReader(org.apache.avro.Schema keyReaderSchema,
org.apache.avro.Schema valueReaderSchema)
- Constructor.
- Parameters:
keyReaderSchema - The reader schema for the key within the generic record.valueReaderSchema - The reader schema for the value within the generic record.
nextKeyValue
public boolean nextKeyValue()
throws IOException,
InterruptedException
-
- Overrides:
nextKeyValue in class AvroRecordReaderBase<AvroKey<K>,AvroValue<V>,org.apache.avro.generic.GenericRecord>
- Throws:
IOException
InterruptedException
getCurrentKey
public AvroKey<K> getCurrentKey()
throws IOException,
InterruptedException
-
- Specified by:
getCurrentKey in class org.apache.hadoop.mapreduce.RecordReader<AvroKey<K>,AvroValue<V>>
- Throws:
IOException
InterruptedException
getCurrentValue
public AvroValue<V> getCurrentValue()
throws IOException,
InterruptedException
-
- Specified by:
getCurrentValue in class org.apache.hadoop.mapreduce.RecordReader<AvroKey<K>,AvroValue<V>>
- Throws:
IOException
InterruptedException
Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.