foxtail463 opened a new pull request, #63639: URL: https://github.com/apache/doris/pull/63639
Problem Summary: Nested MV rewrite may fail to use predicates carried by a lower MV scan. ```sql CREATE MATERIALIZED VIEW mv_fact AS SELECT k1, dim_id, sku_type, amount FROM fact WHERE sku_type = '1'; CREATE MATERIALIZED VIEW mv_join AS SELECT f.k1, f.dim_id, f.sku_type, f.amount, d.tag FROM mv_fact f JOIN dim d ON f.dim_id = d.dim_id WHERE f.sku_type = '1'; SELECT f.k1, f.dim_id, f.sku_type, f.amount, d.tag FROM fact f JOIN dim d ON f.dim_id = d.dim_id WHERE f.sku_type = '1'; ``` The lower MV scan semantically carries sku_type = '1'. During nested MV rewrite, this predicate must be visible when matching and compensating predicates for the upper MV. If the MV scan does not carry relation-implied predicates, the rewrite may fail even though mv_join can answer the query correctly. This change attaches relation-implied predicates when generating MV scans, so predicates guaranteed by lower MV scans can participate in later nested MV matching and compensation. -- 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]
