[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
This commit is contained in:
starocean999
2023-04-07 09:15:00 +08:00
committed by GitHub
parent 4e1cdb9ce7
commit 505f25c580
3 changed files with 13 additions and 1 deletions

View File

@ -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;
}

View File

@ -39,3 +39,11 @@
2 4
2 4
-- !select_mv_constant --
\N
\N
\N
\N
\N
\N

View File

@ -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;"""
}