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

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/AggregationFunctionUtils.java
 ##########
 @@ -59,24 +63,35 @@ public static AggregationFunctionColumnPair 
getFunctionColumnPair(@Nonnull Aggre
     return new AggregationFunctionColumnPair(functionType, 
getColumn(aggregationInfo));
   }
 
+  public static boolean isDistinct(AggregationFunctionContext[] 
functionContexts) {
+    return functionContexts.length == 1 &&
+        functionContexts[0].getAggregationFunction().getType() == 
AggregationFunctionType.DISTINCT;
+  }
+
   /**
    * Creates an {@link AggregationFunctionContext} from the {@link 
AggregationInfo}.
    */
   @Nonnull
   public static AggregationFunctionContext 
getAggregationFunctionContext(@Nonnull AggregationInfo aggregationInfo) {
-    String functionName = aggregationInfo.getAggregationType();
-    AggregationFunction aggregationFunction = 
AggregationFunctionFactory.getAggregationFunction(functionName);
-    return new AggregationFunctionContext(aggregationFunction, 
AggregationFunctionUtils.getColumn(aggregationInfo));
+   return getAggregationFunctionContext(aggregationInfo, new BrokerRequest());
 
 Review comment:
   Done -- although I think making nonnullable would be better. It would then 
avoid unnecessary conditional check before dereferencing in 
getAggregationFunction()

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