siddharthteotia commented on a change in pull request #4535: Implement DISTINCT 
clause
URL: https://github.com/apache/incubator-pinot/pull/4535#discussion_r320624117
 
 

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/DefaultAggregationExecutor.java
 ##########
 @@ -41,13 +44,29 @@ public DefaultAggregationExecutor(@Nonnull 
AggregationFunctionContext[] function
     _numFunctions = functionContexts.length;
     _functions = new AggregationFunction[_numFunctions];
     _resultHolders = new AggregationResultHolder[_numFunctions];
-    _expressions = new TransformExpressionTree[_numFunctions];
-    for (int i = 0; i < _numFunctions; i++) {
-      AggregationFunction function = 
functionContexts[i].getAggregationFunction();
-      _functions[i] = function;
-      _resultHolders[i] = _functions[i].createAggregationResultHolder();
-      if (function.getType() != AggregationFunctionType.COUNT) {
-        _expressions[i] = 
TransformExpressionTree.compileToExpressionTree(functionContexts[i].getColumn());
+    if (AggregationFunctionUtils.isDistinct(functionContexts)) {
+      // handle distinct (col1, col2..) function
+      // unlike other aggregate functions, distinct can work on multiple 
columns
+      // so we need to build expression tree for each column
+      _functions[0] = functionContexts[0].getAggregationFunction();
+      _resultHolders[0] = _functions[0].createAggregationResultHolder();
+      final String multiColumnExpression = functionContexts[0].getColumn();
 
 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