DolphinDB: how to achieve aggregate operations in the reactive state engine?

35 Views Asked by At

As shown in the following figure, I want to group a stream table by “index“ and perform aggregate calculations using a sliding window of length 2. However, it seems that aggregate operations are not supported in the reactive state engine. How to achieve this in DolphinDB?

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

You can create two engines and establish a cascade between them: the first is a time-series engine (see DolphinDB user manual - createTimeSeriesEngine), which specifies keyColumn as "index" and metric as “sum(val)”; the second is a reactive state engine, which specifies metric as “msum(val, 2)” and sums the current value with the previous one.