You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ki...@apache.org on 2020/07/02 22:53:47 UTC

[incubator-pinot] branch optimize-distinct-count created (now 1f92278)

This is an automated email from the ASF dual-hosted git repository.

kishoreg pushed a change to branch optimize-distinct-count
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


      at 1f92278  Using dictionary based aggregation operator when there is no filter/group by

This branch includes the following new commits:

     new 1f92278  Using dictionary based aggregation operator when there is no filter/group by

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-pinot] 01/01: Using dictionary based aggregation operator when there is no filter/group by

Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kishoreg pushed a commit to branch optimize-distinct-count
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 1f9227858121bcaa35cbcabde08e79310cd5820f
Author: kishoreg <g....@gmail.com>
AuthorDate: Thu Jul 2 15:53:05 2020 -0700

    Using dictionary based aggregation operator when there is no filter/group by
---
 .../core/operator/query/DictionaryBasedAggregationOperator.java   | 8 ++++++++
 .../org/apache/pinot/core/plan/maker/InstancePlanMakerImplV2.java | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/query/DictionaryBasedAggregationOperator.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/query/DictionaryBasedAggregationOperator.java
index 8c66805..971a225 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/query/DictionaryBasedAggregationOperator.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/query/DictionaryBasedAggregationOperator.java
@@ -18,6 +18,7 @@
  */
 package org.apache.pinot.core.operator.query;
 
+import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -73,6 +74,13 @@ public class DictionaryBasedAggregationOperator extends BaseOperator<Intermediat
           aggregationResults.add(
               new MinMaxRangePair(dictionary.getDoubleValue(0), dictionary.getDoubleValue(dictionary.length() - 1)));
           break;
+        case DISTINCTCOUNT:
+          IntOpenHashSet set = new IntOpenHashSet(128);
+          for (int dictId = 0; dictId < dictionary.length(); dictId++) {
+            set.add(dictionary.get(dictId).hashCode());
+          }
+          aggregationResults.add(set);
+          break;
         default:
           throw new IllegalStateException(
               "Dictionary based aggregation operator does not support function type: " + aggregationFunction.getType());
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/plan/maker/InstancePlanMakerImplV2.java b/pinot-core/src/main/java/org/apache/pinot/core/plan/maker/InstancePlanMakerImplV2.java
index 3d81a51..ae6ce04 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/plan/maker/InstancePlanMakerImplV2.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/plan/maker/InstancePlanMakerImplV2.java
@@ -164,7 +164,8 @@ public class InstancePlanMakerImplV2 implements PlanMaker {
     for (ExpressionContext expression : selectExpressions) {
       FunctionContext function = expression.getFunction();
       String functionName = function.getFunctionName();
-      if (!functionName.equals("min") && !functionName.equals("max") && !functionName.equals("minmaxrange")) {
+      if (!functionName.equals("min") && !functionName.equals("max") && !functionName.equals("minmaxrange")
+          && !functionName.equals("distinctcount")) {
         return false;
       }
       ExpressionContext argument = function.getArguments().get(0);


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