Hey,
i have a Table with 20 columns and every now and the there is a gap that needs to be filled with the previous value. At the moment i am using the fill function 20 times to fill every column. The Problem is that the Query Perfomance is to slow and i want to optimize it.
My Query looks like this:
from(bucket: “MyBucket”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) =>
r._measurement == “MyMeasurement” and
r.short == “M1” or
r.short == “M2” or
r.short == “M3” or
r.short == “M4” or
(and so on up to M20)
)
|>keep(columns:["_time",“short”,"_field","_value"])
|> pivot(
rowKey:["_time"],
columnKey: ["short","_field"],
valueColumn: "_value"
)
|>fill(column:“M1”,usePrevious:true)
|>fill(column:“M2”,usePrevious:true)
|>fill(column:“M3”,usePrevious:true)
|>fill(column:“M4”,usePrevious:true)
(And so on up to M20)
Is there a way that i can use the fill() function or something similiar only once?