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


   ### Description
   This PR fixes an issue with TopN algorithm selection to make sure that 
string columns with dictionaries also have sorted and unique dictionaries. The 
off-heap pooled algorithm assumes this to be true, so we must use the heap 
based algorithm in cases where the column has a dictionary, but it is not 
unique or sorted.
   
   Prior to this PR, the added test produces the following incorrect results 
prior to this PR:
   ```
   2020-06-18T18:52:21,520 INFO [main] 
org.apache.druid.sql.calcite.BaseCalciteQueryTest - row #0: [a, 3]
   2020-06-18T18:52:21,520 INFO [main] 
org.apache.druid.sql.calcite.BaseCalciteQueryTest - row #1: [a, 3]
   2020-06-18T18:52:21,520 INFO [main] 
org.apache.druid.sql.calcite.BaseCalciteQueryTest - row #2: [a, 3]
   2020-06-18T18:52:21,520 INFO [main] 
org.apache.druid.sql.calcite.BaseCalciteQueryTest - row #3: [b, 3]
   ```
   This test covers a ton more surface than just this condition since it tests 
it via a join to a broadcast `GlobalTableDataSource`. `CalciteQueryTest` may 
now test against an `IndexedTable` joinable version of the `numfoo` test 
datasource (without the metrics columns), which is wired up into the segment 
walker to mimic a broadcast segment that is present on the broker, so that in 
the `DruidSchema` it will be translated into a `GlobalTableDataSource` instead 
of a `TableDataSource`.
   
   <hr>
   
   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.
   - [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.
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `TopNQueryEngine`
   


----------------------------------------------------------------
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]

Reply via email to