public class WriterProjector extends AbstractProjector
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicLong |
counter |
downstream
Constructor and Description |
---|
WriterProjector(java.util.concurrent.ExecutorService executorService,
java.lang.String uri,
WriterProjection.CompressionType compressionType,
java.util.List<Input<?>> inputs,
java.util.Set<CollectExpression<Row,?>> collectExpressions,
java.util.Map<ColumnIdent,java.lang.Object> overwrites,
java.util.List<java.lang.String> outputNames,
WriterProjection.OutputFormat outputFormat) |
Modifier and Type | Method and Description |
---|---|
void |
fail(java.lang.Throwable throwable)
Is called from the upstream in case of a failure.
|
void |
finish()
Called from the upstream to indicate that all rows are sent.
|
void |
prepare()
prepares / starts the RowReceiver, after this call it must be ready to receive rows
|
boolean |
setNextRow(Row row)
Feed the downstream with the next input row.
|
protected static java.util.Map<java.lang.String,java.lang.Object> |
toNestedStringObjectMap(java.util.Map<ColumnIdent,java.lang.Object> columnIdentObjectMap) |
downstream, kill, pause, repeat, requirements, resume, setUpstream
public WriterProjector(java.util.concurrent.ExecutorService executorService, java.lang.String uri, @Nullable WriterProjection.CompressionType compressionType, @Nullable java.util.List<Input<?>> inputs, java.util.Set<CollectExpression<Row,?>> collectExpressions, java.util.Map<ColumnIdent,java.lang.Object> overwrites, @Nullable java.util.List<java.lang.String> outputNames, WriterProjection.OutputFormat outputFormat)
inputs
- a list of Input
.
If null the row that is received in setNextRow(Row)
is expected to contain the raw source in its first column.
That raw source is then written to the output
If inputs is not null the inputs are consumed to write a JSON array to the output.protected static java.util.Map<java.lang.String,java.lang.Object> toNestedStringObjectMap(java.util.Map<ColumnIdent,java.lang.Object> columnIdentObjectMap)
public void prepare()
RowReceiver
prepare
in interface RowReceiver
prepare
in class AbstractProjector
public boolean setNextRow(Row row)
RowReceiver
false
,
true
otherwise.
Any upstream who calls this methods must call RowReceiver.setUpstream(RowUpstream)
exactly once
so that the receiver is able to call pause/resume on its upstream.
RowReceiver.finish()
and RowReceiver.fail(Throwable)
may be called without calling setUpstream if there are no rows.row
- the next row - the row is usually a shared object and the instances content change after the
setNextRow call.public void finish()
RowReceiver
public void fail(java.lang.Throwable throwable)
RowReceiver
throwable
- the cause of the fail
NOTE: This method must not throw any exceptions!