Skip to content

Commit 5fe466e

Browse files
committed
HashBuilder
Signed-off-by: Rob Syme <rob.syme@gmail.com>
1 parent 9221b11 commit 5fe466e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

modules/nextflow/src/main/groovy/nextflow/extension/DataflowHelper.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ class DataflowHelper {
360360
if( !(entry instanceof List) ) {
361361
if( pivot != [0] )
362362
throw new IllegalArgumentException("Not a valid `by` index: $pivot")
363-
result.keys = [entry]
363+
result.addKey(entry)
364364
result.values = []
365365
return result
366366
}

modules/nextflow/src/main/groovy/nextflow/extension/KeyPair.groovy

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package nextflow.extension
1919
import groovy.transform.CompileStatic
2020
import groovy.transform.EqualsAndHashCode
2121
import groovy.transform.ToString
22+
import nextflow.extension.GroupKey
2223

2324
/**
2425
* Implements an helper key-value helper object used in dataflow operators
@@ -33,6 +34,9 @@ class KeyPair {
3334
List values
3435

3536
void addKey(el) {
37+
if (keys == null) {
38+
keys = []
39+
}
3640
keys.add(safeStr(el))
3741
}
3842

@@ -41,6 +45,10 @@ class KeyPair {
4145
}
4246

4347
static private safeStr(key) {
44-
key instanceof GString ? key.toString() : key
48+
if (key instanceof GString)
49+
return key.toString()
50+
if (key instanceof GroupKey)
51+
return key.getGroupTarget()
52+
return key
4553
}
4654
}

0 commit comments

Comments
 (0)