I’ve got a measurement with values tagged either A or B. I want to process these values mostly the same except for a single operation that needs to be different (aggregate window functions “mean” or “last” depending on the tag value).
I do not want to use a union of distinct processing pipelines because I only need a single operation to be different and because of the (assumed) additional overhead.
I realize you can provide a function to aggregateWindow. In theory this would be perfect. However, I am unable to discriminate between measurement values based on tag values. What I’ve tried is this:
|> aggregateWindow( every: 300s, fn: (column, tables=<-) => if "_field\" == 'A' then mean(tables) else last(tables), createEmpty: false)
Is there a way to do this?
If the above approach doesn’t work, is there an alternative approach that does?