异步物化视图透明改写
当物化视图和基表分区相同但某个分区的数据不同时,查询结果正常;
当物化视图不存在基表的分区时,查询结果异常
物化视图SQL,内表join内表,imp_base_target_unique_part_auto2是分区表,imp_distribution_room非分区表
CREATE MATERIALIZED VIEW mv_unique_part_auto
BUILD IMMEDIATE
REFRESH auto
ON SCHEDULE EVERY 1 day
partition by(collect_date)
DISTRIBUTED BY hash(room_id) BUCKETS auto
PROPERTIES (
"replication_num" = "1"
)
AS SELECT
a.collect_date,
a.room_id,
a.item_code,
a.target_code,
a.collect_ts,
a.collect_minute,
a.target_group,
a.tag_value,
b.room_name
FROM
imp_base_target_unique_part_auto2 a
join imp_distribution_room b
on a.room_id = b.pk_room