BatchTransformation<TInput, TOutput>

Class BatchTransformation<TInput, TOutput>

A batch transformation will transform batches of data. The default batch size are 100000 rows. The batch transformation function allows you to process and modify each batch of data. You can use the BatchSize property to choose a smaller batch size. The batch size must always be smaller than the max buffer size. The default batch size are 1000 rows per batch. The batch transformation is a partial blocking transformation - it will always need at least enough memory to store a whole batch.

Inherited Members
Namespace: ETLBox.DataFlow
Assembly: ETLBox.dll
Syntax
    public class BatchTransformation<TInput, TOutput> : DataFlowTransformation<TInput, TOutput>, IDataFlowTransformation<TInput, TOutput>, IDataFlowSource<TOutput>, IDataFlowSource, IDataFlowDestination<TInput>, IDataFlowDestination, IDataFlowComponent, ILoggableTask
Type Parameters
NameDescription
TInput

Type of ingoing data.

TOutput

Type of outgoing data.

Constructors

BatchTransformation()

Declaration
    public BatchTransformation()

BatchTransformation(int)

Declaration
    public BatchTransformation(int batchSize)
Parameters
TypeNameDescription
intbatchSize

The size of each batch

BatchTransformation(int, Func<TInput[], TOutput[]>)

Declaration
    public BatchTransformation(int batchSize, Func<TInput[], TOutput[]> batchTransformationFunc)
Parameters
TypeNameDescription
intbatchSize

The size of each batch

Func<TInput[], TOutput[]>batchTransformationFunc

Sets the BatchTransformationFunc

Fields

WasInitActionInvoked

Declaration
    protected bool WasInitActionInvoked
Field Value
TypeDescription
bool

Properties

BatchSize

The size of each batch that is passed to the BatchTransformation<TInput, TOutput> Default is 1000.

Declaration
    public virtual int BatchSize { get; set; }
Property Value
TypeDescription
int

BatchTransformationFunc

The transformation Func that is executed on each array of input data. It returns another array as output data - the output array can have a different length than the input array.

Declaration
    public Func<TInput[], TOutput[]> BatchTransformationFunc { get; set; }
Property Value
TypeDescription
Func<TInput[], TOutput[]>

InitAction

The init action is executed shortly before the first data row is processed.

Declaration
    public Action InitAction { get; set; }
Property Value
TypeDescription
Action

SourceBlock

SourceBlock from the underlying TPL.Dataflow which is used as output buffer for the component.

Declaration
    public override ISourceBlock<TOutput> SourceBlock { get; }
Property Value
TypeDescription
ISourceBlock<TOutput>
Overrides

SuppressNullValueFilter

By default, all null values in the batch returned from the batch transformation func are filtered out. Set this option to true to avoid this behavior.

Declaration
    public bool SuppressNullValueFilter { get; set; }
Property Value
TypeDescription
bool

TargetBlock

TargetBlock from the underlying TPL.Dataflow which is used as input buffer for the component.

Declaration
    public override ITargetBlock<TInput> TargetBlock { get; }
Property Value
TypeDescription
ITargetBlock<TInput>
Overrides

Methods

CheckAndAdjustBatchSize()

Declaration
    protected void CheckAndAdjustBatchSize()

CheckParameter()

Declaration
    protected override void CheckParameter()
Overrides

CleanUpOnFaulted(Exception)

Declaration
    protected override void CleanUpOnFaulted(Exception e)
Parameters
TypeNameDescription
Exceptione
Overrides

CleanUpOnSuccess()

Declaration
    protected override void CleanUpOnSuccess()
Overrides

InitComponent()

Declaration
    protected override void InitComponent()
Overrides

InvokeBatchTransformationFunc(TInput[])

Declaration
    protected virtual TOutput[] InvokeBatchTransformationFunc(TInput[] batch)
Parameters
TypeNameDescription
TInput[]batch
Returns
TypeDescription
TOutput[]

InvokeInitActionOnce()

Declaration
    protected virtual void InvokeInitActionOnce()

Reset()

Declaration
    protected override void Reset()
Overrides

Implements