K - The type of the first tuple field.V - The type of the second tuple field.public class SequenceFileWriter<K extends org.apache.hadoop.io.Writable,V extends org.apache.hadoop.io.Writable> extends Object implements Writer<org.apache.flink.api.java.tuple.Tuple2<K,V>>, org.apache.flink.api.java.typeutils.InputTypeConfigurable
Writer that writes the bucket files as Hadoop SequenceFiles.
The input to the RollingSink must
be a Tuple2 of two Hadopo
Writables.| Constructor and Description |
|---|
SequenceFileWriter()
Creates a new
SequenceFileWriter that writes sequence files without compression. |
SequenceFileWriter(String compressionCodecName,
org.apache.hadoop.io.SequenceFile.CompressionType compressionType)
Creates a new
SequenceFileWriter that writes sequence with the given
compression codec and compression type. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the
Writer. |
Writer<org.apache.flink.api.java.tuple.Tuple2<K,V>> |
duplicate()
Duplicates the
Writer. |
void |
flush()
Flushes out any internally held data.
|
void |
open(org.apache.hadoop.fs.FSDataOutputStream outStream)
Initializes the
Writer for a newly opened bucket file. |
void |
setInputType(org.apache.flink.api.common.typeinfo.TypeInformation<?> type,
org.apache.flink.api.common.ExecutionConfig executionConfig) |
void |
write(org.apache.flink.api.java.tuple.Tuple2<K,V> element)
Writes one element to the bucket file.
|
public SequenceFileWriter()
SequenceFileWriter that writes sequence files without compression.public SequenceFileWriter(String compressionCodecName, org.apache.hadoop.io.SequenceFile.CompressionType compressionType)
SequenceFileWriter that writes sequence with the given
compression codec and compression type.compressionCodecName - Name of a Hadoop Compression Codec.compressionType - The compression type to use.public void open(org.apache.hadoop.fs.FSDataOutputStream outStream)
throws IOException
WriterWriter for a newly opened bucket file.
Any internal per-bucket initialization should be performed here.open in interface Writer<org.apache.flink.api.java.tuple.Tuple2<K extends org.apache.hadoop.io.Writable,V extends org.apache.hadoop.io.Writable>>outStream - The FSDataOutputStream for the newly opened file.IOExceptionpublic void flush()
throws IOException
Writerflush in interface Writer<org.apache.flink.api.java.tuple.Tuple2<K extends org.apache.hadoop.io.Writable,V extends org.apache.hadoop.io.Writable>>IOExceptionpublic void close()
throws IOException
WriterWriter. This must not close the FSDataOutputStream that
was handed in in the Writer.open(org.apache.hadoop.fs.FSDataOutputStream) method. Only internally held state should be
closed.close in interface Writer<org.apache.flink.api.java.tuple.Tuple2<K extends org.apache.hadoop.io.Writable,V extends org.apache.hadoop.io.Writable>>IOExceptionpublic void write(org.apache.flink.api.java.tuple.Tuple2<K,V> element) throws IOException
Writerwrite in interface Writer<org.apache.flink.api.java.tuple.Tuple2<K extends org.apache.hadoop.io.Writable,V extends org.apache.hadoop.io.Writable>>IOExceptionpublic void setInputType(org.apache.flink.api.common.typeinfo.TypeInformation<?> type,
org.apache.flink.api.common.ExecutionConfig executionConfig)
setInputType in interface org.apache.flink.api.java.typeutils.InputTypeConfigurableCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.