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

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new f3f1bbc48c [fix](agg)disallow group by bitmap or hll data type (#11782)
f3f1bbc48c is described below

commit f3f1bbc48c7fd58a2ffb79dce1e426c575b08ce6
Author: starocean999 <40539150+starocean...@users.noreply.github.com>
AuthorDate: Tue Aug 16 09:25:02 2022 +0800

    [fix](agg)disallow group by bitmap or hll data type (#11782)
    
    * [fix](agg)disallow group by bitmap or hll data type
---
 .../org/apache/doris/analysis/AggregateInfo.java   | 10 ++++++
 .../aggregate_group_by_hll_and_bitmap.groovy       | 39 ++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java
index 2e8681f2c6..344ff112bc 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java
@@ -21,6 +21,7 @@
 package org.apache.doris.analysis;
 
 import org.apache.doris.catalog.FunctionSet;
+import org.apache.doris.catalog.Type;
 import org.apache.doris.common.AnalysisException;
 import org.apache.doris.common.util.VectorizedUtil;
 import org.apache.doris.planner.DataPartition;
@@ -160,6 +161,14 @@ public final class AggregateInfo extends AggregateInfoBase 
{
         partitionExprs = exprs;
     }
 
+    private static void validateGroupingExprs(List<Expr> groupingExprs) throws 
AnalysisException {
+        for (Expr expr : groupingExprs) {
+            if (expr.getType().isOnlyMetricType()) {
+                throw new AnalysisException(Type.OnlyMetricTypeErrorMsg);
+            }
+        }
+    }
+
     /**
      * Creates complete AggregateInfo for groupingExprs and aggExprs, including
      * aggTupleDesc and aggTupleSMap. If parameter tupleDesc != null, sets 
aggTupleDesc to
@@ -176,6 +185,7 @@ public final class AggregateInfo extends AggregateInfoBase {
         Preconditions.checkState(
                 (groupingExprs != null && !groupingExprs.isEmpty())
                         || (aggExprs != null && !aggExprs.isEmpty()));
+        validateGroupingExprs(groupingExprs);
         AggregateInfo result = new AggregateInfo(groupingExprs, aggExprs, 
AggPhase.FIRST);
 
         // collect agg exprs with DISTINCT clause
diff --git 
a/regression-test/suites/query/aggregate/aggregate_group_by_hll_and_bitmap.groovy
 
b/regression-test/suites/query/aggregate/aggregate_group_by_hll_and_bitmap.groovy
new file mode 100644
index 0000000000..be00387ef8
--- /dev/null
+++ 
b/regression-test/suites/query/aggregate/aggregate_group_by_hll_and_bitmap.groovy
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("aggregate_group_by_hll_and_bitmap") {
+    sql "DROP TABLE IF EXISTS test_group_by_hll_and_bitmap"
+
+    sql """
+        CREATE TABLE test_group_by_hll_and_bitmap (id int, user_ids bitmap 
bitmap_union, hll_set hll hll_union) 
+        ENGINE=OLAP DISTRIBUTED BY HASH(`id`) BUCKETS 5 
properties("replication_num" = "1");
+        """
+
+    sql "insert into test_group_by_hll_and_bitmap values(1, bitmap_hash(1), 
hll_hash(1))"
+
+    test {
+        sql "select distinct user_ids from test_group_by_hll_and_bitmap"
+        exception "Doris hll and bitmap column must use with specific 
function, and don't support filter or group by.please run 'help hll' or 'help 
bitmap' in your mysql client"
+    }
+
+    test {
+        sql "select distinct hll_set from test_group_by_hll_and_bitmap"
+        exception "Doris hll and bitmap column must use with specific 
function, and don't support filter or group by.please run 'help hll' or 'help 
bitmap' in your mysql client"
+    }
+
+    sql "DROP TABLE test_group_by_hll_and_bitmap"
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to