clintropolis opened a new pull request #11185: URL: https://github.com/apache/druid/pull/11185
Fixes #8970 (well it was already fixed somewhere along the way, but fixes another issue discovered in the comments) ### Description This PR fixes an issue when using expression virtual columns that reference string values on realtime query segments, where an automatic transform to handle possible multi-valued string inputs forces array output from the selector, which the aggregators are not prepared to handle. See https://github.com/apache/druid/issues/8970#issuecomment-829762963 for details. This PR adds a modification that fixes the side-effect of these transformations, to allow array typed `ExprEval` to provide scalar values if and only if the array has a single element. Otherwise it will retain its current behavior where methods like `getLong` and `getDouble` return default zero values. This changes makes array expression results mirror the the behavior of scalar expression results, where scalar expressions are currently allowed to present themselves as single element arrays (which exists to handle cases where array functions are used and the input value is a string column is multi-valued in one segment, but single valued in another). This PR has: - [x] been self-reviewed. - [ ] added documentation for new or modified features or behaviors. - [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links. - [ ] 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. - [ ] added integration tests. - [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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
