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_r348749344
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/DistinctTable.java
##########
@@ -39,85 +44,54 @@
* (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 BaseTable {
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);
- }
+ private Set<Record> _uniqueRecordsSet;
+ private boolean _noMoreNewRecords;
+ private Iterator<Record> _sortedIterator;
- 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
+ super(dataSchema, Collections.emptyList(), orderBy, limit);
Review comment:
Yup, in fact the super constructor in BaseTable is written in a generic
manner. In other words, it won't assert or throw NPE if it sees an empty list.
So I think for now we can keep this.
----------------------------------------------------------------
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]