From 066bc7693ee179ea9f745cae515fbad1e418f9b0 Mon Sep 17 00:00:00 2001 From: starocean999 <40539150+starocean999@users.noreply.github.com> Date: Thu, 18 Aug 2022 14:50:25 +0800 Subject: [PATCH] [fix](orderby)disallow hll and bitmap data type in order by list (#11837) --- .../main/java/org/apache/doris/analysis/QueryStmt.java | 7 +++++++ .../aggregate/aggregate_group_by_hll_and_bitmap.groovy | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/QueryStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/QueryStmt.java index 2246139339..7c4079dedd 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/QueryStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/QueryStmt.java @@ -21,6 +21,7 @@ package org.apache.doris.analysis; import org.apache.doris.catalog.TableIf; +import org.apache.doris.catalog.Type; import org.apache.doris.common.AnalysisException; import org.apache.doris.common.ErrorCode; import org.apache.doris.common.ErrorReport; @@ -318,6 +319,12 @@ public abstract class QueryStmt extends StatementBase implements Queriable { + " in nested queries."); } + for (Expr expr : orderingExprs) { + if (expr.getType().isOnlyMetricType()) { + throw new AnalysisException(Type.OnlyMetricTypeErrorMsg); + } + } + sortInfo = new SortInfo(orderingExprs, isAscOrder, nullsFirstParams); // order by w/o limit and offset in inline views, set operands and insert statements // are ignored. 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 index be00387ef8..dff2b797c7 100644 --- 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 @@ -35,5 +35,15 @@ suite("aggregate_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 user_ids from test_group_by_hll_and_bitmap order by user_ids" + 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 hll_set from test_group_by_hll_and_bitmap order by hll_set" + 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