You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by zh...@apache.org on 2020/04/03 01:08:37 UTC
[incubator-doris] branch master updated: Fix Rewrite count distinct
bitmap and hll order by bug (#3251)
This is an automated email from the ASF dual-hosted git repository.
zhaoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new c9ff6f6 Fix Rewrite count distinct bitmap and hll order by bug (#3251)
c9ff6f6 is described below
commit c9ff6f68d1a4cb9489880fa7678266af34bdf617
Author: kangkaisen <ka...@apache.org>
AuthorDate: Fri Apr 3 09:08:27 2020 +0800
Fix Rewrite count distinct bitmap and hll order by bug (#3251)
---
fe/src/main/java/org/apache/doris/analysis/QueryStmt.java | 4 ++--
fe/src/test/java/org/apache/doris/planner/QueryPlanTest.java | 7 +++++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/fe/src/main/java/org/apache/doris/analysis/QueryStmt.java b/fe/src/main/java/org/apache/doris/analysis/QueryStmt.java
index 1c96f45..a54dd7b 100644
--- a/fe/src/main/java/org/apache/doris/analysis/QueryStmt.java
+++ b/fe/src/main/java/org/apache/doris/analysis/QueryStmt.java
@@ -269,8 +269,8 @@ public abstract class QueryStmt extends StatementBase {
orderByElementsAfterAnalyzed = Lists.newArrayList();
for (int i = 0; i < orderByElements.size(); i++) {
// rewrite count distinct
- Expr rewritten = rewriteCountDistinctForBitmapOrHLL(orderingExprs.get(i), analyzer);
- OrderByElement orderByElement = new OrderByElement(rewritten, isAscOrder.get(i),
+ orderingExprs.set(i, rewriteCountDistinctForBitmapOrHLL(orderingExprs.get(i), analyzer));
+ OrderByElement orderByElement = new OrderByElement(orderingExprs.get(i), isAscOrder.get(i),
nullsFirstParams.get(i));
orderByElementsAfterAnalyzed.add(orderByElement);
}
diff --git a/fe/src/test/java/org/apache/doris/planner/QueryPlanTest.java b/fe/src/test/java/org/apache/doris/planner/QueryPlanTest.java
index 1f38371..11d2553 100644
--- a/fe/src/test/java/org/apache/doris/planner/QueryPlanTest.java
+++ b/fe/src/test/java/org/apache/doris/planner/QueryPlanTest.java
@@ -371,14 +371,17 @@ public class QueryPlanTest {
explainString = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, "explain " + sql);
Assert.assertTrue(explainString.contains("hll_union_agg"));
- sql = "select count(distinct id2) from test.bitmap_table having count(distinct id2) > 0";
+ sql = "select count(distinct id2) from test.bitmap_table group by id order by count(distinct id2)";
explainString = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, "explain " + sql);
Assert.assertTrue(explainString.contains("bitmap_union_count"));
- sql = "select count(distinct id2) from test.bitmap_table order by count(distinct id2) > 0";
+ sql = "select count(distinct id2) from test.bitmap_table having count(distinct id2) > 0";
explainString = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, "explain " + sql);
Assert.assertTrue(explainString.contains("bitmap_union_count"));
+ sql = "select count(distinct id2) from test.bitmap_table order by count(distinct id2)";
+ explainString = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, "explain " + sql);
+ Assert.assertTrue(explainString.contains("bitmap_union_count"));
ConnectContext.get().getSessionVariable().setRewriteCountDistinct(false);
sql = "select count(distinct id2) from test.bitmap_table";
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org