You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/22 08:11:02 UTC
[doris] 03/03: [fix](InBitmap) Check whether the in bitmap contains correlated subqueries (#15184)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 7c1a4b80b0f10d77aadd1874121c2fe3372ed611
Author: luozenglin <37...@users.noreply.github.com>
AuthorDate: Wed Dec 21 16:52:27 2022 +0800
[fix](InBitmap) Check whether the in bitmap contains correlated subqueries (#15184)
---
.../src/main/java/org/apache/doris/analysis/StmtRewriter.java | 4 ++++
regression-test/suites/query_p0/join/test_bitmap_filter.groovy | 10 +++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/StmtRewriter.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/StmtRewriter.java
index bb572b8aca..92be4011e8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/StmtRewriter.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/StmtRewriter.java
@@ -1113,6 +1113,10 @@ public class StmtRewriter {
Expr subquerySubstitute = slotRef;
if (exprWithSubquery instanceof InPredicate) {
if (slotRef.getType().isBitmapType()) {
+ if (isCorrelated) {
+ throw new AnalysisException(
+ "In bitmap does not support correlated subquery: " + exprWithSubquery.toSql());
+ }
Expr pred = new BitmapFilterPredicate(exprWithSubquery.getChild(0), slotRef,
((InPredicate) exprWithSubquery).isNotIn());
pred.analyze(analyzer);
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 d6770f2ce9..0292c5c93a 100644
--- a/regression-test/suites/query_p0/join/test_bitmap_filter.groovy
+++ b/regression-test/suites/query_p0/join/test_bitmap_filter.groovy
@@ -16,13 +16,12 @@
// under the License.
suite("test_bitmap_filter", "query_p0") {
- def tbl1 = "bigtable"
+ def tbl1 = "test_query_db.bigtable"
def tbl2 = "bitmap_table"
- def tbl3 = "baseall"
+ def tbl3 = "test_query_db.baseall"
sql "set runtime_filter_type = 16"
sql "set enable_vectorized_engine = true"
- sql "use test_query_db"
sql "DROP TABLE IF EXISTS ${tbl2}"
sql """
CREATE TABLE ${tbl2} (
@@ -51,4 +50,9 @@ suite("test_bitmap_filter", "query_p0") {
qt_sql5 "select k1, k2 from ${tbl1} where k1 in (select k2 from ${tbl2}) and k2 not in (select k3 from ${tbl2}) order by k1;"
qt_sql6 "select k2, count(k2) from ${tbl1} where k1 in (select k2 from ${tbl2}) group by k2 order by k2;"
+
+ test {
+ 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"
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org