How can one merge two arrays?

How can one join/merge two arrays?

Here is an example:

good = ["foo", "bar"]

from(bucket: "xxx")
  ...
  |> keep(columns: ["_time", "_value"] + good)

Hello @LionelCons,
Unfortunately this isn’t possible atm. Why are you wondering? What are you trying to do? Maybe there’s another workaround.
Alternatively, can you please file a feature request?

Thank you

The goal was to remove duplication in the code. I have a bunch of columns that I use in different places (group, pivot, keep…) and I wanted to define them in one place only.

Also, the code should evolve into periodic tasks, hopefully via named functions so the array of columns will likely be one parameter of the function.

I’ll file a feature request in GitHub.

FWIW, I’ve submitted Add support for array merging · Issue #3397 · influxdata/flux · GitHub.

1 Like