OLAP-Style Optimized Cumulative Window Aggregate

If _evaluate_cumulative_extfn is supplied, this cumulative sum is evaluated where the next_value/evaluate sequence is combined into a single _evaluate_cumulative_extfn call for each row within each partition.

Query

select b, my_sum(a) over (partition by b rows between unbounded preceding and current row)
from t
order by b

Calling pattern

_start_extnfn(cntxt)
_reset_extfn(cntxt)
_evaluate_cumulative_extfn(cntxt, args) -- input a=1 returns 1
_evaluate_cumulative_extfn(cntxt, args) -- input a=2 returns 3
_evaluate_cumulative_extfn(cntxt, args) -- input a=3 returns 6
_reset_extfn(cntxt)
_evaluate_cumulative_extfn(cntxt, args) -- input a=4 returns 4
_evaluate_cumulative_extfn(cntxt, args) -- input a=5 returns 9
_evaluate_cumulative_extfn(cntxt, args) -- input a=6 returns 15
_finish_extfn(cntxt)

Result

b,  my_sum(a)
1,  1
1,  3
1,  6
2,  4
2,  9
2,  15