This is an automated email from the ASF dual-hosted git repository.
cambyzju 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 a4af1fbf90 [fix](inbitmap) forbid having clause to include in bitmap.
(#15494)
a4af1fbf90 is described below
commit a4af1fbf90e07ee79afacfb3b17182abc2d950c6
Author: luozenglin <[email protected]>
AuthorDate: Wed Jan 4 14:33:18 2023 +0800
[fix](inbitmap) forbid having clause to include in bitmap. (#15494)
---
.../src/main/java/org/apache/doris/analysis/SelectStmt.java | 11 +++++++++++
.../suites/query_p0/join/test_bitmap_filter.groovy | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
index 1af417841a..0950b3d839 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
@@ -957,6 +957,13 @@ public class SelectStmt extends QueryStmt {
}
}
+ private boolean isContainInBitmap(Expr expr) {
+ List<Expr> inPredicates = Lists.newArrayList();
+ expr.collect(InPredicate.class, inPredicates);
+ return inPredicates.stream().anyMatch(e -> e.getChild(1) instanceof
Subquery
+ && ((Subquery)
e.getChild(1)).getStatement().getResultExprs().get(0).getType().isBitmapType());
+ }
+
/**
* Analyze aggregation-relevant components of the select block (Group By
clause,
* select list, Order By clause),
@@ -1017,6 +1024,10 @@ public class SelectStmt extends QueryStmt {
"HAVING clause must not contain analytic expressions: "
+ analyticExpr.toSql());
}
+ if (isContainInBitmap(havingClauseAfterAnaylzed)) {
+ throw new AnalysisException(
+ "HAVING clause dose not support in bitmap syntax: " +
havingClauseAfterAnaylzed.toSql());
+ }
}
if (groupByClause == null && !selectList.isDistinct()
diff --git a/regression-test/suites/query_p0/join/test_bitmap_filter.groovy
b/regression-test/suites/query_p0/join/test_bitmap_filter.groovy
index 788f26ec3a..7e70d5c0f1 100644
--- a/regression-test/suites/query_p0/join/test_bitmap_filter.groovy
+++ b/regression-test/suites/query_p0/join/test_bitmap_filter.groovy
@@ -69,4 +69,9 @@ suite("test_bitmap_filter", "query_p0") {
sql "select k1, k2 from ${tbl1} b1 where k1 in (select k2 from ${tbl2}
b2 where b1.k2 = b2.k1) order by k1;"
exception "In bitmap does not support correlated subquery"
}
+
+ test {
+ sql "select k1, count(*) from ${tbl1} b1 group by k1 having k1 in
(select k2 from ${tbl2} b2) order by k1;"
+ exception "HAVING clause dose not support in bitmap"
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]