Following the sample provided by influxdata in their documentation (here), I would split this contiuous query into four flux tasks like this:
import "experimental"
options task = {
name: "trade_to_candles_60_open",
every: 10s
}
from(bucket: "mydb/")
|> range(start: experimental.subDuration(d: 10m, from: now()))
|> filter(fn: (r) =>
r._measurement == "trades" and
r._field == "price"
)
|> group(columns: ["pair","exchange"])
|> aggregateWindow(every: 1m, fn: first)
|> set(key: "_field", as: "open")
|> to(bucket: "mydb/candles_1m")
I personnally think that it's not serious that influxdata doesn't provide any CQ to flux task converter. I try to migrate from 1.8 to 2.0 but it's a nightmare : no way to test flux task in 1.8, no way to use CQ in 2.0 to ease migration. Every CQ has to be manually rewritten in flux task and I've hundreds of CQ...