Hello,
I am trying to create an aggregate flux query that windows data based on a timestamp and selects the min and max values of each window. While I understand that this is done by the aggregateWindow function and the min(), max() selectors, I would also like to preserve the timestamp of each of the min, max values I collect.
To this end, I have created a customAggregateWindow function defined as:
customAggregateWindow = (every, fn, column="_value", timeSrc="_time", timeDst="_time", tables=<-) =>
tables
|> window(every:every, createEmpty:true)
|> fn(column:column)
|> keep(columns: [timeSrc, column])
|> window(every: inf)
That I believe does exactly what I want.
The problem is that for smaller values of the every argument my window funtion is significantly slower than the base aggregateWindow function.
So my question is. Is there a more efficient way to do this that takes advantage of the inner workings of Influx better or this is my only solution?
Thank you very much