OLAP-Style Aggregate Calling Pattern with Unbounded Window

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. Context indicators are set to 1 for _window_has_unbounded_preceding and _window_has_unbounded_following

Query

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

Calling pattern

_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)

Result

b,  my_sum(a)
1,  6
1,  6
1,  6
2,  15
2,  15
2,  15