How to create our own function like stateChangesOnly

Hi, @scott
Could you help to create a function like stateChangesOnly ?
Many times we just want to leave the necessary records.
I don’t know how to reduce data.

  thank you

I don’t know how to reduce data with the same column

Input data
2021-01-01T00:00:00Z	t1	25
2021-01-01T00:00:10Z	t1	25
2021-01-01T00:00:20Z	t1	28
2021-01-01T00:00:30Z	t1	30
2021-01-01T00:00:40Z	t1	30
2021-01-01T00:00:50Z	t1	35

Expect output
2021-01-01T00:00:00Z	t1	25
2021-01-01T00:00:20Z	t1	28
2021-01-01T00:00:30Z	t1	30
2021-01-01T00:00:50Z	t1	35

@Erikson There is a PR on the Flux repo that would extend reduce() to allow you to create a custom stateChangesOnly function. It hasn’t been merged yet, but you can take a look at it here: [WIP]: first prototype of cumulative reduce. functionality is there, but no … by aanthony1243 · Pull Request #4387 · influxdata/flux · GitHub

@scott , thanks a lot.