MergeJoin<TInput1, TInput2, TOutput>

Class MergeJoin<TInput1, TInput2, TOutput>

Will join data from the two inputs into one output. Make sure both inputs are sorted or in the right order. Each row from the left join target will be merged with a row from the right join target. If the amount of ingoing data is unevenly distributed, the last rows will be joined with null values.

You can define a match condition that let you only merge matching records. This will change the match behavior a little bit. By assuming that the input is sorted, not matching records will be joined with null then. This can be compared with a left or right join.

Inheritance
MergeJoin<TInput1, TInput2, TOutput>
Inherited Members
Namespace: ETLBox.DataFlow
Assembly: ETLBox.dll
Syntax
    public class MergeJoin<TInput1, TInput2, TOutput> : DataFlowSource<TOutput>, IDataFlowSource<TOutput>, IDataFlowSource, IDataFlowDestination, IDataFlowComponent, ILoggableTask
Type Parameters
NameDescription
TInput1

Type of ingoing data for the left join target.

TInput2

Type of ingoing data for the right join target.

TOutput

Type of outgoing data.

Examples
MergeJoin<InputType1, InputType2, OutputType> join = new MergeJoin<InputType1, InputType2, OutputType>();
join.MergeJoinFunc =  (leftRow, rightRow) => {
    return new OutputType()
    {
        Result = leftRow.Value 1 + rightRow.Value2
    };
});
source1.LinkTo(join.LeftInput);
source2.LinkTo(join.RightInput);
join.LinkTo(dest);

Constructors

MergeJoin()

Declaration
    public MergeJoin()

MergeJoin(Func<TInput1, TInput2, TOutput>)

Declaration
    public MergeJoin(Func<TInput1, TInput2, TOutput> mergeJoinFunc)
Parameters
TypeNameDescription
Func<TInput1, TInput2, TOutput>mergeJoinFunc

Sets the MergeJoinFunc

MergeJoin(Func<TInput1, TInput2, TOutput>, Func<TInput1, TInput2, int>)

Declaration
    public MergeJoin(Func<TInput1, TInput2, TOutput> mergeJoinFunc, Func<TInput1, TInput2, int> comparisonFunc)
Parameters
TypeNameDescription
Func<TInput1, TInput2, TOutput>mergeJoinFunc

Sets the MergeJoinFunc

Func<TInput1, TInput2, int>comparisonFunc

Sets the ComparisonFunc

Properties

Buffer

Declaration
    protected BufferBlock<TOutput> Buffer { get; set; }
Property Value
TypeDescription
BufferBlock<TOutput>

ComparisonFunc

If the ComparisonFunc is defined, records are compared regarding their sort order and only joined if they match. Return 0 if both records match and should be joined. Return a value little than 0 if the record of the left input is in the sort order before the record of the right input. Return a value greater than 0 if the record for the right input is in the order before the record from the left input.

Declaration
    public Func<TInput1, TInput2, int> ComparisonFunc { get; set; }
Property Value
TypeDescription
Func<TInput1, TInput2, int>
Remarks

Make sure that both inputs are sorted, and the comparison func take the sort order into account.

LeftInput

The left target of the merge join. Use this to link your source component with.

Declaration
    public JoinTarget<TInput1> LeftInput { get; set; }
Property Value
TypeDescription
JoinTarget<TInput1>

MergeJoinFunc

The func that describes how both records from the left and right join target can be joined.

Declaration
    public Func<TInput1, TInput2, TOutput> MergeJoinFunc { get; set; }
Property Value
TypeDescription
Func<TInput1, TInput2, TOutput>

RightInput

The right target of the merge join. Use this to link your source component with.

Declaration
    public JoinTarget<TInput2> RightInput { get; set; }
Property Value
TypeDescription
JoinTarget<TInput2>

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

Methods

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

Reset()

Declaration
    protected override void Reset()
Overrides

Implements