T
- the type of the record that can be emitted with this record writerpublic class RecordWriter<T extends IOReadableWritable> extends Object
The RecordWriter wraps the runtime's ResultPartitionWriter
and takes care of
serializing records into buffers.
Important: it is necessary to call flush()
after
all records have been written with emit(IOReadableWritable)
. This
ensures that all produced records are written to the output stream (incl.
partially filled ones).
Modifier and Type | Field and Description |
---|---|
protected ResultPartitionWriter |
writer |
Constructor and Description |
---|
RecordWriter(ResultPartitionWriter writer) |
RecordWriter(ResultPartitionWriter writer,
ChannelSelector<T> channelSelector) |
Modifier and Type | Method and Description |
---|---|
void |
broadcastEmit(T record)
This is used to broadcast Streaming Watermarks in-band with records.
|
void |
broadcastEvent(AbstractEvent event) |
void |
clearBuffers() |
void |
emit(T record) |
void |
flush() |
void |
sendEndOfSuperstep() |
void |
setReporter(AccumulatorRegistry.Reporter reporter)
Counter for the number of records emitted and the records processed.
|
protected final ResultPartitionWriter writer
public RecordWriter(ResultPartitionWriter writer)
public RecordWriter(ResultPartitionWriter writer, ChannelSelector<T> channelSelector)
public void emit(T record) throws IOException, InterruptedException
IOException
InterruptedException
public void broadcastEmit(T record) throws IOException, InterruptedException
ChannelSelector
.IOException
InterruptedException
public void broadcastEvent(AbstractEvent event) throws IOException, InterruptedException
IOException
InterruptedException
public void sendEndOfSuperstep() throws IOException, InterruptedException
IOException
InterruptedException
public void flush() throws IOException
IOException
public void clearBuffers()
public void setReporter(AccumulatorRegistry.Reporter reporter)
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.