Skip to content

Commit

Permalink
[fix](Nereids) query mv column directly (#30444)
Browse files Browse the repository at this point in the history
  • Loading branch information
morrySnow authored Jan 29, 2024
1 parent a0e8d79 commit 690df04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public List<Slot> getOutputByIndex(long indexId) {
}

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))) {
Expand Down
12 changes: 6 additions & 6 deletions regression-test/suites/statistics/test_select_mv.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down

0 comments on commit 690df04

Please sign in to comment.