IN
- the type of input object to the sinkKEY_OUT
- the type of key the sink outputsVAL_OUT
- the type of value the sink outputs@Beta public abstract class BatchSink<IN,KEY_OUT,VAL_OUT> extends BatchConfigurable<BatchSinkContext> implements Transformation<IN,KeyValue<KEY_OUT,VAL_OUT>>, StageLifecycle<BatchRuntimeContext>
initialize(io.cdap.cdap.etl.api.batch.BatchRuntimeContext)
, transform(IN, io.cdap.cdap.etl.api.Emitter<io.cdap.cdap.api.dataset.lib.KeyValue<KEY_OUT, VAL_OUT>>)
and destroy()
methods
are called inside the Batch Run while BatchConfigurable.prepareRun(T)
and BatchConfigurable.onRunFinish(boolean, T)
methods are called on the client side, which launches the Batch run,
before the Batch run starts and after it finishes respectively.Modifier and Type | Field and Description |
---|---|
static String |
FORMAT_PLUGIN_TYPE |
static String |
PLUGIN_TYPE |
Constructor and Description |
---|
BatchSink() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the Batch Sink stage.
|
void |
initialize(BatchRuntimeContext context)
Initialize the Batch Sink stage.
|
void |
transform(IN input,
Emitter<KeyValue<KEY_OUT,VAL_OUT>> emitter)
Transform the input received from previous stage to a
KeyValue pair which can be
consumed by the output, as set in BatchConfigurable.prepareRun(T) . |
configurePipeline, onRunFinish, prepareRun
public static final String PLUGIN_TYPE
public static final String FORMAT_PLUGIN_TYPE
public void initialize(BatchRuntimeContext context) throws Exception
transform(IN, io.cdap.cdap.etl.api.Emitter<io.cdap.cdap.api.dataset.lib.KeyValue<KEY_OUT, VAL_OUT>>)
are made.initialize
in interface StageLifecycle<BatchRuntimeContext>
context
- BatchRuntimeContext
Exception
- if there is any error during initializationpublic void transform(IN input, Emitter<KeyValue<KEY_OUT,VAL_OUT>> emitter) throws Exception
KeyValue
pair which can be
consumed by the output, as set in BatchConfigurable.prepareRun(T)
. By default, the input object is
used as both key and value. This method is invoked inside the Batch run.public void destroy()
destroy
in interface Destroyable
Copyright © 2023 Cask Data, Inc. Licensed under the Apache License, Version 2.0.