Jackie-Jiang commented on a change in pull request #5564:
URL: https://github.com/apache/incubator-pinot/pull/5564#discussion_r440489545



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/DistinctCountHLLAggregationFunction.java
##########
@@ -35,9 +36,20 @@
 
 public class DistinctCountHLLAggregationFunction extends 
BaseSingleInputAggregationFunction<HyperLogLog, Long> {
   public static final int DEFAULT_LOG2M = 8;
+  protected final int _log2M;
 
-  public DistinctCountHLLAggregationFunction(String column) {
-    super(column);
+  public DistinctCountHLLAggregationFunction(List<String> arguments) {
+    super(arguments.get(0));
+    int numExpressions = arguments.size();
+    // This function expects 1 or 2 arguments.
+    Preconditions
+        .checkArgument(numExpressions <= 2 && numExpressions >= 1, 
"DistinctCountHLL expects 1 or 2 arguments, got: ",
+            numExpressions);
+    if (arguments.size() == 2) {
+      _log2M = Integer.valueOf(arguments.get(1).replace("'", ""));

Review comment:
       But why would someone put `'1'` here? In order to put `'1'` as the 
literal, you need to explicitly escape `'` (i.e. `DistinctCountHLL(column, 
'''1''')`). Also, in that case we should fail the query because it is invalid.




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



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

Reply via email to