clintropolis opened a new pull request #12226:
URL: https://github.com/apache/druid/pull/12226


   ### Description
   This PR adds `ARRAY_CONCAT_AGG` which can aggregate array inputs together 
into a single array and improves `ARRAY_AGG` to support array inputs (if 
`druid.expressions.allowNestedArrays` is true).
   
   |Function|Notes|Default|
   |--------|-----|-------|
   |`ARRAY_CONCAT_AGG(expr, [size])`|Concatenates all array `expr` into a 
single ARRAY, with `size` in bytes limit on aggregation size (default of 1024 
bytes).   Input `expr` _must_ be an array. Null `expr` will be ignored, but any 
null values within an `expr` _will_ be included in the resulting array. If the 
aggregated array grows larger than the maximum size in bytes, the query will 
fail. Use of `ORDER BY` within the `ARRAY_CONCAT_AGG` expression is not 
currently supported, and the ordering of results within the output array may 
vary depending on processing order.|`null`|
   |`ARRAY_CONCAT_AGG(DISTINCT expr, [size])`|Concatenates all distinct values 
of all array `expr` into a single ARRAY, with `size` in bytes limit on 
aggregation size (default of 1024 bytes) per aggregate. Input `expr` _must_ be 
an array. Null `expr` will be ignored, but any null values within an `expr` 
_will_ be included in the resulting array. If the aggregated array grows larger 
than the maximum size in bytes, the query will fail. Use of `ORDER BY` within 
the `ARRAY_CONCAT_AGG` expression is not currently supported, and the ordering 
of results will be based on the default for the element type.|`null`|
   
   <hr>
   
   Also, two new options to `ExpressionLambdaAggregatorFactory` have been 
added, `shouldAggregateNullInputs` and `shouldCombineAggregateNullInputs` to 
both fix a correctness issue with `STRING_AGG` and `ARRAY_AGG` when merging 
results that include nulls, and as an optimization to aggregators that do not 
need to aggregate anything if any inputs are null.
   
   This PR has:
   - [ ] been self-reviewed.
   - [x] added documentation for new or modified features or behaviors.
   - [x] added Javadocs for most classes and all non-trivial methods. Linked 
related entities via Javadoc links.
   - [x] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [x] been tested in a test Druid cluster.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to