This is an automated email from the ASF dual-hosted git repository.
morningman 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 505f25c580 [fix](planner)use base index if the where clause is a
constant value (#18367)
505f25c580 is described below
commit 505f25c5808d74a8a593042cf6eba36b4e13ea0f
Author: starocean999 <[email protected]>
AuthorDate: Fri Apr 7 09:15:00 2023 +0800
[fix](planner)use base index if the where clause is a constant value
(#18367)
sql : select bitmap_empty() from d_table where true;
should always use base index instead of any mv, because the conjuncts is
constant (true) and use none of the column from any mv
---
.../src/main/java/org/apache/doris/planner/OlapScanNode.java | 4 +++-
regression-test/data/mv_p0/where/k123/k123.out | 8 ++++++++
regression-test/suites/mv_p0/where/k123/k123.groovy | 2 ++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
index 7ece5b09e3..6688d5c1ef 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java
@@ -474,7 +474,9 @@ public class OlapScanNode extends ScanNode {
if (mvColumn == null) {
boolean isBound = false;
for (Expr conjunct : conjuncts) {
- if (conjunct.isBound(slotDescriptor.getId())) {
+ List<TupleId> tids = Lists.newArrayList();
+ conjunct.getIds(tids, null);
+ if (!tids.isEmpty() &&
conjunct.isBound(slotDescriptor.getId())) {
isBound = true;
break;
}
diff --git a/regression-test/data/mv_p0/where/k123/k123.out
b/regression-test/data/mv_p0/where/k123/k123.out
index 55bd6c538c..faeb23fbb6 100644
--- a/regression-test/data/mv_p0/where/k123/k123.out
+++ b/regression-test/data/mv_p0/where/k123/k123.out
@@ -39,3 +39,11 @@
2 4
2 4
+-- !select_mv_constant --
+\N
+\N
+\N
+\N
+\N
+\N
+
diff --git a/regression-test/suites/mv_p0/where/k123/k123.groovy
b/regression-test/suites/mv_p0/where/k123/k123.groovy
index 09201fe31c..29da7d05af 100644
--- a/regression-test/suites/mv_p0/where/k123/k123.groovy
+++ b/regression-test/suites/mv_p0/where/k123/k123.groovy
@@ -86,4 +86,6 @@ suite ("k123p") {
contains "(k123p4w)"
}
qt_select_mv """select k1,k2+k3 from d_table where k1 = 2 and k4 = "b"
order by k1;"""
+
+ qt_select_mv_constant """select bitmap_empty() from d_table where true;"""
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]