T
- The Java type of the Avro data to write.public class AvroKeyRecordWriter<T> extends RecordWriter<AvroKey<T>,NullWritable> implements Syncable
Constructor and Description |
---|
AvroKeyRecordWriter(Schema writerSchema,
GenericData dataModel,
CodecFactory compressionCodec,
OutputStream outputStream)
Constructor.
|
AvroKeyRecordWriter(Schema writerSchema,
GenericData dataModel,
CodecFactory compressionCodec,
OutputStream outputStream,
int syncInterval)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close(TaskAttemptContext context) |
long |
sync()
Return the current position as a value that may be passed to DataFileReader.seek(long).
|
void |
write(AvroKey<T> record,
NullWritable ignore) |
public AvroKeyRecordWriter(Schema writerSchema, GenericData dataModel, CodecFactory compressionCodec, OutputStream outputStream, int syncInterval) throws IOException
writerSchema
- The writer schema for the records in the Avro container file.compressionCodec
- A compression codec factory for the Avro container file.outputStream
- The output stream to write the Avro container file to.syncInterval
- The sync interval for the Avro container file.IOException
- If the record writer cannot be opened.public AvroKeyRecordWriter(Schema writerSchema, GenericData dataModel, CodecFactory compressionCodec, OutputStream outputStream) throws IOException
writerSchema
- The writer schema for the records in the Avro container file.compressionCodec
- A compression codec factory for the Avro container file.outputStream
- The output stream to write the Avro container file to.IOException
- If the record writer cannot be opened.public void write(AvroKey<T> record, NullWritable ignore) throws IOException
write
in class RecordWriter<AvroKey<T>,NullWritable>
IOException
public void close(TaskAttemptContext context) throws IOException
close
in class RecordWriter<AvroKey<T>,NullWritable>
IOException
public long sync() throws IOException
sync
in interface Syncable
IOException
- - if an error occurred while attempting to sync.Copyright © 2009–2016 The Apache Software Foundation. All rights reserved.