Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ public void getTableRefs(Analyzer analyzer, List<TableRef> tblRefs, Set<String>
}
}

public void forbiddenMVRewrite() {
super.forbiddenMVRewrite();
for (SetOperand op : operands) {
op.getQueryStmt().forbiddenMVRewrite();
}
}

/**
* Propagates DISTINCT from left to right, and checks that all
* set operands are set compatible, adding implicit casts if necessary.
Expand Down
32 changes: 32 additions & 0 deletions regression-test/suites/correctness_p0/test_mv_case.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,36 @@ suite("test_mv_case") {
sql """insert into test_table_aaa2 select 'cib2205045_1_1s','2023/6/10 3:57:33','{"DB1":168939,"DNT":"2023-06-10 03:57:33"}' ;"""
sql """insert into test_table_aaa2 select 'cib2205045_1_1s','2023/6/10 3:58:33','{"DB1":168939,"DNT":"2023-06-10 03:58:33"}' ;"""
qt_select_default """ select * from test_table_aaa2 order by dnt;"""

sql """set enable_nereids_planner=false;"""
sql """drop table if exists test_mv_view_t;"""
sql """drop view if exists test_mv_view_t_view;"""
sql """CREATE TABLE `test_mv_view_t` (
`day` date NOT NULL,
`game_code` varchar(100) NOT NULL ,
`plat_code` varchar(100) NOT NULL
) ENGINE=OLAP
duplicate KEY(`day`)
DISTRIBUTED BY HASH(`day`) BUCKETS 4
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);"""
sql """INSERT INTO test_mv_view_t VALUES('2024-04-01', 'x', 'y');"""
createMV ("""create materialized view test_mv_view_t_mv as
select `day`, count(game_code)
from test_mv_view_t group by day;""")
sql """create view test_mv_view_t_view
as
select `day`
from test_mv_view_t
where day<'2024-04-15'

union all
select `day`
from test_mv_view_t
where day>='2024-04-15';"""
explain {
sql("""SELECT * from test_mv_view_t_view where day='2024-04-15';""")
notContains("mv_day")
}
}