This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new d15005d8d01 [fix](mtmv) fix mtmv task nereids cost too much time
(#37589)
d15005d8d01 is described below
commit d15005d8d01fd955571495a32538266ac1e936e3
Author: zhangdong <[email protected]>
AuthorDate: Thu Jul 11 19:33:51 2024 +0800
[fix](mtmv) fix mtmv task nereids cost too much time (#37589)
cause: when mtmv task need refresh multi partition, will be split into
multiple `insert overwrite` tasks,they use same `ConnectContext` and
`StatementContext`,nereids time is calculated based on StatementContext,
so multiple tasks will accumulate time
fix: each `insert overwrite` tasks use unique `StatementContext`
---
.../src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java
b/fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java
index 517909f5e1f..b50d755951f 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java
@@ -41,6 +41,7 @@ import org.apache.doris.mtmv.MTMVRefreshEnum.RefreshMethod;
import org.apache.doris.mtmv.MTMVRefreshPartitionSnapshot;
import org.apache.doris.mtmv.MTMVRelation;
import org.apache.doris.mtmv.MTMVUtil;
+import org.apache.doris.nereids.StatementContext;
import org.apache.doris.nereids.glue.LogicalPlanAdapter;
import
org.apache.doris.nereids.trees.plans.commands.UpdateMvByPartitionCommand;
import org.apache.doris.nereids.trees.plans.commands.info.TableNameInfo;
@@ -222,6 +223,9 @@ public class MTMVTask extends AbstractTask {
private void exec(ConnectContext ctx, Set<String> refreshPartitionNames,
Map<TableIf, String> tableWithPartKey)
throws Exception {
+ Objects.requireNonNull(ctx, "ctx should not be null");
+ StatementContext statementContext = new StatementContext();
+ ctx.setStatementContext(statementContext);
TUniqueId queryId = generateQueryId();
lastQueryId = DebugUtil.printId(queryId);
// if SELF_MANAGE mv, only have default partition, will not have
partitionItem, so we give empty set
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]