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
System.Object
MergeJoin<TInput1, TInput2, TOutput>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ETLBox.DataFlow.Transformations
Assembly: ETLBox.dll
Syntax
    public class MergeJoin<TInput1, TInput2, TOutput> : DataFlowSource<TOutput>, ILoggableTask, IDataFlowLogging, IDataFlowTransformation<TOutput>, IDataFlowSource<TOutput>, IDataFlowSource, IDataFlowDestination, IDataFlowComponent
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
System.Func<TInput1, TInput2, TOutput>mergeJoinFunc

Sets the MergeJoinFunc

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

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

Sets the MergeJoinFunc

System.Func<TInput1, TInput2, System.Int32>comparisonFunc

Sets the ComparisonFunc

Properties

Buffer

Declaration
    protected BufferBlock<TOutput> Buffer { get; set; }
Property Value
TypeDescription
System.Threading.Tasks.Dataflow.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
System.Func<TInput1, TInput2, System.Int32>
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
System.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
System.Threading.Tasks.Dataflow.ISourceBlock<TOutput>
Overrides
ETLBox.DataFlow.DataFlowSource<TOutput>.SourceBlock

TaskName

A name to identify the task or component. Every component or task comes with a default name that can be overwritten.

Declaration
    public override string TaskName { get; set; }
Property Value
TypeDescription
System.String
Overrides

Methods

CheckParameter()

Declaration
    protected override void CheckParameter()
Overrides

CleanUpOnFaulted(Exception)

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

CleanUpOnSuccess()

Declaration
    protected override void CleanUpOnSuccess()
Overrides

InitComponent()

Declaration
    protected override void InitComponent()
Overrides

Implements