Partitioning on “b” creates the same partitions as grouping on “b”. An unbounded window causes the “a” value to be evaluated for each row of the partition. Because this is an unbounded query, all values are fed to the UDF first, followed by an evaluation cycle. The _window_has_unbounded_preceding and _window_has_unbounded_following context indicators are set to 1.
select b, my_sum(a) over (partition by b rows between unbounded preceding and unbounded following) from t
_start_extfn(cntxt) _reset_extfn(cntxt) _next_value_extfn(cntxt, args) input a=1 _next_value_extfn(cntxt, args) input a=2 _next_value_extfn(cntxt, args) input a=3 _evaluate_extfn(cntxt, args) rr=1 returns 6 _evaluate_extfn(cntxt, args) rr=2 returns 6 _evaluate_extfn(cntxt, args) rr=3 returns 6 _reset_extfn(cntxt) _next_value_extfn(cntxt, args) input a=4 _next_value_extfn(cntxt, args) input a=5 _next_value_extfn(cntxt, args) input a=6 _evaluate_extfn(cntxt, args) rr=1 returns 15 _evaluate_extfn(cntxt, args) rr=2 returns 15 _evaluate_extfn(cntxt, args) rr=3 returns 15 _finish_extfn(cntxt)