Skip to content

Commit

Permalink
add partition materialized view rewrite test
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Dec 18, 2023
1 parent bff4a10 commit 51b0a5d
Showing 1 changed file with 32 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,51 +132,54 @@ suite("partition_mv_rewrite") {
sql """DROP TABLE IF EXISTS mv_10086"""
sql"""
CREATE MATERIALIZED VIEW mv_10086
BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by(l_shipdate)
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS ${mv_def_sql}
AS
${mv_def_sql}
"""

def job_name = getJobName(db, "mv_10086");
waitingMTMVTaskFinished(job_name)

// explain {
// sql("${all_partition_sql}")
// contains "mv_10086"
// }
// explain {
// sql("${partition_sql}")
// contains "mv_10086"
// }
explain {
sql("${all_partition_sql}")
contains "mv_10086"
}
explain {
sql("${partition_sql}")
contains "mv_10086"
}
// partition is invalid, so can not use partition 2023-10-17 to rewrite
sql """
insert into lineitem values
(1, 2, 3, 4, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-10-17', '2023-10-17', '2023-10-17', 'a', 'b', 'yyyyyyyyy');
"""
// wait partition is invalid
sleep(3000)
// only can use valid partition
explain {
sql("${all_partition_sql}")
notContains "mv_10086"
}
// explain {
// sql("${partition_sql}")
// contains "mv_10086"
// }

// sql """
// REFRESH MATERIALIZED VIEW mv_10086;
// """
// waitingMTMVTaskFinished(getJobName(db, "mv_10086"))
//
// explain {
// sql("${all_partition_sql}")
// contains "mv_10086"
// }
// explain {
// sql("${partition_sql}")
// contains "mv_10086"
// }
// sql """DROP MATERIALIZED VIEW IF EXISTS mv_10086"""
explain {
sql("${partition_sql}")
contains "mv_10086"
}

sql """
REFRESH MATERIALIZED VIEW mv_10086;
"""
waitingMTMVTaskFinished(getJobName(db, "mv_10086"))

explain {
sql("${all_partition_sql}")
contains "mv_10086"
}
explain {
sql("${partition_sql}")
contains "mv_10086"
}
sql """DROP MATERIALIZED VIEW IF EXISTS mv_10086"""
}

0 comments on commit 51b0a5d

Please sign in to comment.