yjhjstz commented on code in PR #1606: URL: https://github.com/apache/cloudberry/pull/1606#discussion_r2898010436
########## src/test/regress/sql/matview_data.sql: ########## @@ -343,6 +343,541 @@ drop table jt3; drop table jt2; drop table jt1; +-- +-- Test AQUMV (Answer Query Using Materialized Views) with join queries. +-- Each matching test shows EXPLAIN + SELECT with GUC off (original plan), +-- then EXPLAIN + SELECT with GUC on (MV rewrite). Results must match. +-- +create table aqj_t1(a int, b int) distributed by (a); +create table aqj_t2(a int, b int) distributed by (a); +create table aqj_t3(a int, b int) distributed by (a); +insert into aqj_t1 select i, i*10 from generate_series(1, 100) i; +insert into aqj_t2 select i, i*100 from generate_series(1, 100) i; +insert into aqj_t3 select i, i*1000 from generate_series(1, 100) i; +analyze aqj_t1; +analyze aqj_t2; +analyze aqj_t3; + +-- 1. Two-table INNER JOIN exact match +create materialized view mv_aqj_join2 as + select aqj_t1.a, aqj_t2.b from aqj_t1 join aqj_t2 on aqj_t1.a = aqj_t2.a; +analyze mv_aqj_join2; Review Comment: Add test case : self join -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
