This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit afab713048241a864b114114543760cc226435ab
Author: morrySnow <[email protected]>
AuthorDate: Mon Jan 29 17:27:03 2024 +0800

    [fix](Nereids) query mv column directly (#30444)
---
 .../doris/nereids/trees/plans/logical/LogicalOlapScan.java   |  2 +-
 regression-test/suites/statistics/test_select_mv.groovy      | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java
index 5f80823041b..bcf80fd899a 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalOlapScan.java
@@ -368,7 +368,7 @@ public class LogicalOlapScan extends LogicalCatalogRelation 
implements OlapScan
     }
 
     private Slot generateUniqueSlot(OlapTable table, Column column, boolean 
isBaseIndex, long indexId) {
-        String name = isBaseIndex ? column.getName()
+        String name = isBaseIndex || directMvScan ? column.getName()
                 : 
AbstractSelectMaterializedIndexRule.parseMvColumnToMvName(column.getName(),
                         column.isAggregated() ? 
Optional.of(column.getAggregationType().toSql()) : Optional.empty());
         if (cacheSlotWithSlotName.containsKey(Pair.of(indexId, name))) {
diff --git a/regression-test/suites/statistics/test_select_mv.groovy 
b/regression-test/suites/statistics/test_select_mv.groovy
index a35adaeb9ff..5378abb598c 100644
--- a/regression-test/suites/statistics/test_select_mv.groovy
+++ b/regression-test/suites/statistics/test_select_mv.groovy
@@ -21,17 +21,17 @@ suite("test_select_mv") {
     def dup_sql2 = """select mv_key2 from test_dup index dup1 order by 
mv_key2;"""
     def dup_sql3 = """select count(mv_key2) from test_dup index dup1;"""
     def dup_sql4 = """select min(mv_key2), max(mv_key2), count(mv_key2), 
sum(mv_key2) from test_dup index dup1;"""
-    def dup_sql5 = """select `mva_SUM__CAST(value AS BIGINT)` as a from 
test_dup index dup1 order by a;"""
-    def dup_sql6 = """select count(`mva_SUM__CAST(value AS BIGINT)`) from 
test_dup index dup1;"""
-    def dup_sql7 = """select min(`mva_SUM__CAST(value AS BIGINT)`), 
max(`mva_SUM__CAST(value AS BIGINT)`), ndv(`mva_SUM__CAST(value AS BIGINT)`), 
sum(`mva_SUM__CAST(value AS BIGINT)`) from test_dup index dup1;"""
+    def dup_sql5 = """select `mva_SUM__CAST(``value`` AS BIGINT)` as a from 
test_dup index dup1 order by a;"""
+    def dup_sql6 = """select count(`mva_SUM__CAST(``value`` AS BIGINT)`) from 
test_dup index dup1;"""
+    def dup_sql7 = """select min(`mva_SUM__CAST(``value`` AS BIGINT)`), 
max(`mva_SUM__CAST(``value`` AS BIGINT)`), ndv(`mva_SUM__CAST(``value`` AS 
BIGINT)`), sum(`mva_SUM__CAST(``value`` AS BIGINT)`) from test_dup index 
dup1;"""
 
     def agg_sql1 = """select count(*) from test_agg;"""
     def agg_sql2 = """select mv_key2 from test_agg index agg1 order by 
mv_key2;"""
     def agg_sql3 = """select count(mv_key2) from test_agg index agg1;"""
     def agg_sql4 = """select min(mv_key2), max(mv_key2), count(mv_key2), 
sum(mv_key2) from test_agg index agg1;"""
-    def agg_sql5 = """select `mva_SUM__CAST(value AS BIGINT)` as a from 
test_agg index agg1 order by a;"""
-    def agg_sql6 = """select count(`mva_SUM__CAST(value AS BIGINT)`) from 
test_agg index agg1;"""
-    def agg_sql7 = """select min(`mva_SUM__CAST(value AS BIGINT)`), 
max(`mva_SUM__CAST(value AS BIGINT)`), ndv(`mva_SUM__CAST(value AS BIGINT)`), 
sum(`mva_SUM__CAST(value AS BIGINT)`) from test_agg index agg1;"""
+    def agg_sql5 = """select `mva_SUM__CAST(``value`` AS BIGINT)` as a from 
test_agg index agg1 order by a;"""
+    def agg_sql6 = """select count(`mva_SUM__CAST(``value`` AS BIGINT)`) from 
test_agg index agg1;"""
+    def agg_sql7 = """select min(`mva_SUM__CAST(``value`` AS BIGINT)`), 
max(`mva_SUM__CAST(``value`` AS BIGINT)`), ndv(`mva_SUM__CAST(``value`` AS 
BIGINT)`), sum(`mva_SUM__CAST(``value`` AS BIGINT)`) from test_agg index 
agg1;"""
 
 
     sql """drop database if exists test_select_mv"""


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to