This is an automated email from the ASF dual-hosted git repository.
panxiaolei 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 5473795a51 [Bug](scan) forbiden push down in predicate when
in_state->use_set is false (#19471)
5473795a51 is described below
commit 5473795a51d6d67466ef8ab84bedf6f6af1e1bf2
Author: Pxl <[email protected]>
AuthorDate: Wed May 10 11:12:20 2023 +0800
[Bug](scan) forbiden push down in predicate when in_state->use_set is false
(#19471)
forbiden push down in predicate when in_state->use_set is false
---
be/src/vec/exec/scan/vscan_node.cpp | 12 ++++++++++++
regression-test/data/query_p0/sql_functions/test_in_expr.out | 10 ++++++++++
.../suites/query_p0/sql_functions/test_in_expr.groovy | 11 +++++++++++
3 files changed, 33 insertions(+)
diff --git a/be/src/vec/exec/scan/vscan_node.cpp
b/be/src/vec/exec/scan/vscan_node.cpp
index febcf72f18..e082507e88 100644
--- a/be/src/vec/exec/scan/vscan_node.cpp
+++ b/be/src/vec/exec/scan/vscan_node.cpp
@@ -855,6 +855,12 @@ Status VScanNode::_normalize_in_and_eq_predicate(VExpr*
expr, VExprContext* expr
InState* state = reinterpret_cast<InState*>(
expr_ctx->fn_context(pred->fn_context_index())
->get_function_state(FunctionContext::FRAGMENT_LOCAL));
+
+ // xx in (col, xx, xx) should not be push down
+ if (!state->use_set) {
+ return Status::OK();
+ }
+
iter = state->hybrid_set->begin();
}
@@ -930,6 +936,12 @@ Status
VScanNode::_normalize_not_in_and_not_eq_predicate(VExpr* expr, VExprConte
InState* state = reinterpret_cast<InState*>(
expr_ctx->fn_context(pred->fn_context_index())
->get_function_state(FunctionContext::FRAGMENT_LOCAL));
+
+ // xx in (col, xx, xx) should not be push down
+ if (!state->use_set) {
+ return Status::OK();
+ }
+
HybridSetBase::IteratorBase* iter = state->hybrid_set->begin();
auto fn_name = std::string("");
if (!is_fixed_range && state->null_in_set) {
diff --git a/regression-test/data/query_p0/sql_functions/test_in_expr.out
b/regression-test/data/query_p0/sql_functions/test_in_expr.out
index 31d6bb5b1a..c7f58848a5 100644
--- a/regression-test/data/query_p0/sql_functions/test_in_expr.out
+++ b/regression-test/data/query_p0/sql_functions/test_in_expr.out
@@ -53,3 +53,13 @@ a
b
d
+-- !select --
+2
+3
+4
+
+-- !select --
+2
+3
+4
+
diff --git a/regression-test/suites/query_p0/sql_functions/test_in_expr.groovy
b/regression-test/suites/query_p0/sql_functions/test_in_expr.groovy
index 46d5f95dd0..a7a324f631 100644
--- a/regression-test/suites/query_p0/sql_functions/test_in_expr.groovy
+++ b/regression-test/suites/query_p0/sql_functions/test_in_expr.groovy
@@ -113,4 +113,15 @@ suite("test_in_expr", "query") {
sql """DROP TABLE IF EXISTS ${nullTableName}"""
sql """DROP TABLE IF EXISTS ${notNullTableName}"""
+ // from https://github.com/apache/doris/issues/19374
+ sql """DROP TABLE IF EXISTS t11"""
+ sql """
+ CREATE TABLE t11(c0 CHAR(109) NOT NULL) DISTRIBUTED BY HASH (c0)
BUCKETS 13 PROPERTIES ("replication_num" = "1");
+ """
+ sql """
+ insert into t11 values ('1'), ('1'), ('2'), ('2'), ('3'), ('4');
+ """
+
+ qt_select "select t11.c0 from t11 group by t11.c0 having not ('1' in
(t11.c0)) order by t11.c0;"
+ qt_select "select t11.c0 from t11 group by t11.c0 having ('1' not in
(t11.c0)) order by t11.c0;"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]