wdl icon indicating copy to clipboard operation
wdl copied to clipboard

String concatenation behavior

Open gileshall opened this issue 1 year ago • 0 comments

Hi, I was playing around with string concatenation, and I was curious why there is a discrepancy between the two outputs for the example WDL below? I am using the most recent release of cromwell, v84, to run this locally.

WDL

version 1.0

task echo_concat {
  input {
    Array[String] ary
  }
  command {
    echo ~{sep=" " ary}
  }
  output {
    String out = read_string(stdout())
  }
}

workflow concat_example {
  input {
    Array[Pair[String, String]] key_val = [("name1", "val1"), ("name2", "val2")]
  }

  scatter (pair in key_val) {
    String key_eq_val = "~{pair.left}=~{pair.right}"
  }

  String runtime_concat = "~{sep=" " key_eq_val}"

  call echo_concat {
    input:
      ary = key_eq_val
  }

  output {
    String runtime_concat_output = runtime_concat
    String echo_concat_output = echo_concat.out
  }
}

WDL Output

[2022-09-28 14:56:51,73] [info] SingleWorkflowRunnerActor workflow finished with status 'Succeeded'.
{
  "outputs": {
    "concat_example.echo_concat_output": "name1=val1 name2=val2",
    "concat_example.runtime_concat_output": "[\"name1=val1\", \"name2=val2\"]"
  },
  "id": "28a4de69-9341-4cd9-b771-02a7cb905b9e"
}```

gileshall avatar Sep 28 '22 19:09 gileshall