v.20.4New Feature
Add arrayReduceInRanges function for aggregating array elements in ranges
Add function arrayReduceInRanges which aggregates array elements in given ranges. #9598 (hcz)Why it matters
This function allows users to efficiently perform aggregation operations on segments of array data defined by given ranges, enabling more flexible and targeted analysis of array elements without manually slicing the arrays beforehand.How to use it
Use thearrayReduceInRanges function by passing the aggregate function to apply and the array along with the ranges as arguments. For example:SELECT arrayReduceInRanges('sum', array_column, ranges_column) FROM tableThis will apply the sum aggregation to elements of
array_column segmented by ranges_column.