[feature](mtmv)create mtmv can use view#56423
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
| } | ||
| try { | ||
| return isMTMVSync(MTMVRefreshContext.buildContext(mtmv), mtmvRelation.getBaseTablesOneLevel(), | ||
| return isMTMVSync(MTMVRefreshContext.buildContext(mtmv), mtmvRelation.getBaseTablesOneLevelAndFromView(), |
There was a problem hiding this comment.
getBaseTablesOneLevelAndFromView look like contain views, how can compare mv snapshot to view snapshot?
There was a problem hiding this comment.
getBaseTablesOneLevelAndFromView not contains view, but contains table from view, not need compare mv snapshot to view snapshot
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug("mtmv task run, taskId: {}", super.getTaskId()); | ||
| } | ||
| mtmvSchemaChangeVersion = mtmv.getSchemaChangeVersion(); |
There was a problem hiding this comment.
mtmvSchemaChangeVersion is not used?
There was a problem hiding this comment.
after task refresh,will compare schema of base table if changed in org.apache.doris.catalog.MTMV#addTaskResult
|
|
||
| import org.junit.Assert; | ||
|
|
||
| suite("test_create_mtmv_with_view","mtmv") { |
There was a problem hiding this comment.
maybe should add some cases which are views contains mv, and mv is partitioned
| private MTMVRelation relation; | ||
| private StmtExecutor executor; | ||
| private Map<String, MTMVRefreshPartitionSnapshot> partitionSnapshots; | ||
| private long mtmvSchemaChangeVersion; |
There was a problem hiding this comment.
what does mtmvSchemaChangeVersion means? why add this
There was a problem hiding this comment.
Used to determine whether the SQL of the view has changed during the refresh period. If a change has occurred, the result of this refresh may be incorrect and will be ignored
# Conflicts: # fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
|
run buildall |
TPC-DS: Total hot run time: 190358 ms |
ClickBench: Total hot run time: 30.75 s |
FE Regression Coverage ReportIncrement line coverage |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
The main changes are as follows: - If the MTMV is in a schema change state, recheck whether the materialized view's SQL statement meets the requirements before refreshing, and check whether the PCT table has changed. - Add a data structure in the StatementContext to store the tables and views directly depended on in the plan. - Add a data structure to store the relationship between materialized views and views. - The location for adding filter conditions during partition refresh has been moved to CheckPolicy, as the previous location could only access the parsed plan. - Clear the snapshot information of the materialized view when a view is deleted or modified. # Conflicts: # fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java # fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java # fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java # fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java
…ew (#57958) ### What problem does this PR solve? Related PR: #56423 #56958 Problem Summary: 1. Fix partition trace fail when create partition mv with view and date_trunc 2. Fix err if use data_trunc('day', col) partition column when create partition materialized view the mv def sql would be success after this fix CREATE VIEW lineitem_daily_summary_view AS SELECT DATE_TRUNC('day', L_SHIPDATE) AS ship_date, L_RETURNFLAG, L_LINESTATUS, COUNT(*) AS order_count, SUM(L_QUANTITY) AS total_quantity, SUM(L_EXTENDEDPRICE) AS total_price, AVG(L_DISCOUNT) AS avg_discount FROM lineitem WHERE L_SHIPDATE IS NOT NULL GROUP BY ship_date, L_RETURNFLAG, L_LINESTATUS; mv def is as following SELECT ship_date, L_RETURNFLAG, SUM(order_count) AS total_orders, SUM(total_quantity) AS sum_quantity, SUM(total_price) AS sum_price, AVG(avg_discount) AS average_discount FROM lineitem_daily_summary_view GROUP BY ship_date, L_RETURNFLAG ORDER BY ship_date, L_RETURNFLAG, total_orders, sum_quantity, sum_price;
…ew (apache#57958) ### What problem does this PR solve? Related PR: apache#56423 apache#56958 Problem Summary: 1. Fix partition trace fail when create partition mv with view and date_trunc 2. Fix err if use data_trunc('day', col) partition column when create partition materialized view the mv def sql would be success after this fix CREATE VIEW lineitem_daily_summary_view AS SELECT DATE_TRUNC('day', L_SHIPDATE) AS ship_date, L_RETURNFLAG, L_LINESTATUS, COUNT(*) AS order_count, SUM(L_QUANTITY) AS total_quantity, SUM(L_EXTENDEDPRICE) AS total_price, AVG(L_DISCOUNT) AS avg_discount FROM lineitem WHERE L_SHIPDATE IS NOT NULL GROUP BY ship_date, L_RETURNFLAG, L_LINESTATUS; mv def is as following SELECT ship_date, L_RETURNFLAG, SUM(order_count) AS total_orders, SUM(total_quantity) AS sum_quantity, SUM(total_price) AS sum_price, AVG(avg_discount) AS average_discount FROM lineitem_daily_summary_view GROUP BY ship_date, L_RETURNFLAG ORDER BY ship_date, L_RETURNFLAG, total_orders, sum_quantity, sum_price;
…ew (apache#57958) ### What problem does this PR solve? Related PR: apache#56423 apache#56958 Problem Summary: 1. Fix partition trace fail when create partition mv with view and date_trunc 2. Fix err if use data_trunc('day', col) partition column when create partition materialized view the mv def sql would be success after this fix CREATE VIEW lineitem_daily_summary_view AS SELECT DATE_TRUNC('day', L_SHIPDATE) AS ship_date, L_RETURNFLAG, L_LINESTATUS, COUNT(*) AS order_count, SUM(L_QUANTITY) AS total_quantity, SUM(L_EXTENDEDPRICE) AS total_price, AVG(L_DISCOUNT) AS avg_discount FROM lineitem WHERE L_SHIPDATE IS NOT NULL GROUP BY ship_date, L_RETURNFLAG, L_LINESTATUS; mv def is as following SELECT ship_date, L_RETURNFLAG, SUM(order_count) AS total_orders, SUM(total_quantity) AS sum_quantity, SUM(total_price) AS sum_price, AVG(avg_discount) AS average_discount FROM lineitem_daily_summary_view GROUP BY ship_date, L_RETURNFLAG ORDER BY ship_date, L_RETURNFLAG, total_orders, sum_quantity, sum_price;
What problem does this PR solve?
The main changes are as follows:
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)