You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/12/01 19:15:58 UTC

[GitHub] [incubator-pinot] siddharthteotia commented on a change in pull request #6285: Improve performance for distinct queries

siddharthteotia commented on a change in pull request #6285:
URL: https://github.com/apache/incubator-pinot/pull/6285#discussion_r533659152



##########
File path: pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/DistinctAggregationFunction.java
##########
@@ -18,31 +18,25 @@
  */
 package org.apache.pinot.core.query.aggregation.function;
 
-import com.google.common.base.Preconditions;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import javax.annotation.Nullable;
 import org.apache.pinot.common.function.AggregationFunctionType;
-import org.apache.pinot.common.utils.DataSchema;
 import org.apache.pinot.common.utils.DataSchema.ColumnDataType;
 import org.apache.pinot.core.common.BlockValSet;
-import org.apache.pinot.core.common.RowBasedBlockValueFetcher;
-import org.apache.pinot.core.data.table.Record;
 import org.apache.pinot.core.query.aggregation.AggregationResultHolder;
-import org.apache.pinot.core.query.aggregation.ObjectAggregationResultHolder;
-import org.apache.pinot.core.query.aggregation.function.customobject.DistinctTable;
 import org.apache.pinot.core.query.aggregation.groupby.GroupByResultHolder;
 import org.apache.pinot.core.query.request.context.ExpressionContext;
 import org.apache.pinot.core.query.request.context.OrderByExpressionContext;
 
 
 /**
- * The DISTINCT clause in SQL is executed as the DISTINCT aggregation function.
- * TODO: Support group-by
+ * The DISTINCT clause in SQL is represented as the DISTINCT aggregation function. Currently it is only used to wrap the
+ * information for the distinct queries.
+ * TODO: Use a separate way to represent DISTINCT instead of aggregation.
  */
 @SuppressWarnings("rawtypes")
-public class DistinctAggregationFunction implements AggregationFunction<DistinctTable, Comparable> {
+public class DistinctAggregationFunction implements AggregationFunction<Object, Comparable> {

Review comment:
       DISTINCT is supported in PinotQuery as a function. The CalciteSqlParser compiles Distinct specifically as a function expression.
   
   ```
   private static List<Expression> convertDistinctSelectList(SqlNodeList selectList) {
       List<Expression> selectExpr = new ArrayList<>();
       selectExpr.add(convertDistinctAndSelectListToFunctionExpression(selectList));
       return selectExpr;
     }
   ```
   
   




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org