maytasm opened a new pull request #10063: URL: https://github.com/apache/druid/pull/10063
Make return type consistent for HyperUniquesAggregator and HyperUniquesVectorAggregator when no value found ### Description This bug was discovered by turning on vectorization. In HyperUniquesAggregator, when a column is empty, `collector` will be null and the get() method will returns null. In HyperUniquesVectorAggregator, when a column is empty, get() method will still returns a HyperLogLogCollector (from the call to `HyperUniquesBufferAggregator.doGet(buf, position);`). In HyperUniquesAggregatorFactory#estimateCardinality (called by HyperUniquesAggregatorFactory#finalizeComputation) we return integer 0 if input is null, while we return long/double value. otherwise. Hence, for the above mentioned case, the non-vectorize returns integer 0 while the vectorize returns long/double 0. The test failed since we are expecting integer 0. This PR, make sure that for the case when the input to HyperUniquesAggregatorFactory#estimateCardinality is null, we still return 0 with the same value type as when it is not null. 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 or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/licenses.yaml) - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader. - [ ] 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. - [ ] 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]
