Skip to content

[Bug] [MTMV] When union rewrite is not supported, the materialized view that requires union can still be rewritten successfully. #59593

@KeeProMise

Description

@KeeProMise

Search before asking

  • I had searched in the issues and found no similar issues.

Version

doris 3.0.8 & 4+

What's Wrong?

1.Create partitioned tables and materialized views
Image
Image

2.set enable_materialized_view_union_rewrite=false;

explain select * from t1;

Image

What You Expected?

Materialized view rewrite fail
Image

How to Reproduce?

CREATE TABLE t1 (
          `k1` LARGEINT NOT NULL COMMENT '\"用户id\"',
          `k2` DATE NOT NULL COMMENT '\"数据灌入日期时间\"'
        ) ENGINE=OLAP
        DUPLICATE KEY(`k1`)
        COMMENT 'OLAP'
        PARTITION BY range(`k2`)
        (
        PARTITION p2038 VALUES [("2038-01-01"),("2038-01-03")),
        PARTITION p2020 VALUES [("2020-01-01"),("2020-01-03"))
        )
        DISTRIBUTED BY HASH(`k1`) BUCKETS 2
        PROPERTIES ('replication_num' = '1') ;


        insert into t1 values(1,"2038-01-02"),(2,"2020-01-02");


CREATE MATERIALIZED VIEW mv1
            BUILD DEFERRED REFRESH AUTO ON MANUAL
            partition by(`k2`)
            DISTRIBUTED BY RANDOM BUCKETS 2
            PROPERTIES (
            'replication_num' = '1',
            'partition_sync_limit'='2',
            'partition_sync_time_unit'='YEAR'
            )
            AS
            SELECT * FROM t1;


REFRESH MATERIALIZED VIEW mv1 AUTO ;           

set enable_materialized_view_union_rewrite=false;

explain select * from t1;

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions