siddharthteotia commented on a change in pull request #4790: Support ORDER BY 
for DISTINCT queries
URL: https://github.com/apache/incubator-pinot/pull/4790#discussion_r347641897
 
 

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/DistinctTable.java
 ##########
 @@ -39,85 +42,44 @@
  * (2) The same object is serialized by the server inside the data table
  * for sending the results to broker. Broker deserializes it.
  */
-public class DistinctTable {
+public class DistinctTable extends SimpleIndexedTable {
   private static final double LOAD_FACTOR = 0.75;
   private static final int MAX_INITIAL_CAPACITY = 64 * 1024;
-  private FieldSpec.DataType[] _columnTypes;
-  private String[] _columnNames;
-  private Set<Key> _table;
 
-  /**
-   * Add a row to hash table
-   * @param key multi-column key to add
-   */
-  public void addKey(final Key key) {
-    _table.add(key);
-  }
-
-  public DistinctTable(int limit) {
+  public DistinctTable(DataSchema dataSchema, List<SelectionSort> orderBy, int 
limit) {
     // TODO: see if 64k is the right max initial capacity to use
     // if it turns out that users always use LIMIT N > 0.75 * 64k and
     // there are indeed that many records, then there will be resizes.
     // The current method of setting the initial capacity as
     // min(64k, limit/loadFactor) will not require resizes for LIMIT N
     // where N <= 48000
-    int initialCapacity = Math.min(MAX_INITIAL_CAPACITY, 
Math.abs(nextPowerOfTwo((int) (limit / LOAD_FACTOR))));
-    _table = new HashSet<>(initialCapacity);
+    super(dataSchema, new ArrayList<>(), orderBy, limit,
 
 Review comment:
   Done

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


With regards,
Apache Git Services

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

Reply via email to