The goal of this enhancement is to add a new join operator which should replace the existing phase operator and implements.
It implements the same semantic of the phase operator, the main different consists in the structure of the resulting channel that returns a single copy of the joining key and flat together the remaining element, in a similar manner to the collect, combine and merge (#458) operators.
For example:
left = Channel.from(['X', 1], ['Y', 2], ['Z', 3], ['P', 7])
right= Channel.from(['Z', 6], ['Y', 5], ['X', 4])
left.join(right).println()
It returns:
[Z, 3, 6]
[Y, 2, 5]
[X, 1, 4]
Instead the current phase returns:
[[Y, 2], [Y, 5]]
[[Z, 3], [Z, 6]]
[[X, 1], [X, 4]]
Worth nothing that nested structures are not modified. For example:
left = Channel.from(['X', 1], ['Y', 2], ['Z', 3], ['P', 7])
right= Channel.from(['Z', ['sample_z', 'Z_1.fa', 'Z_2.fa']], ['Y', ['sample_y', 'Y_1.fa', 'Y_2.fa']], ['X', ['sample_x', 'X_1.fa', 'X_2.fa']])
left.join(right).println()
It returns:
[Z, 3, [sample_z, Z_1.fa, Z_2.fa]]
[Y, 2, [sample_y, Y_1.fa, Y_2.fa]]
[X, 1, [sample_x, X_1.fa, X_2.fa]]
As a side effect joining single value channel will return a new channel containing a single value items. For example:
left = Channel.from( 1,2,3 )
right = Channel.from( 1,0,0,2,7,8,9,3 )
left.join(right).println()
It returns:
The goal of this enhancement is to add a new
joinoperator which should replace the existing phase operator and implements.It implements the same semantic of the
phaseoperator, the main different consists in the structure of the resulting channel that returns a single copy of the joining key and flat together the remaining element, in a similar manner to the collect, combine andmerge(#458) operators.For example:
It returns:
Instead the current
phasereturns:Worth nothing that nested structures are not modified. For example:
It returns:
As a side effect joining single value channel will return a new channel containing a single value items. For example:
It returns: