I am looking at an efficient way to do a Sum of (n forward-looking array elements) in an array.
For e.g.
Input -> [1,2,3,4,5,6,7,8]
Expected Result (for n = 2) -> [3,5,7,9,11,13,15,8]
Similarly if the n=3 then Expected Result -> [6,9,12,15,18,21,15,8]
Is there a way, this can be accomplished in a super-efficient way within CH. Thanks!
Edit: I would like to know whether this can be accomplished without using
arrayReduceInRanges(agg_func, ranges, arr1...).
The CH version (version 19.15.1) we are using doesn't have arrayReduceInRanges