Skip to content

Commit

Permalink
[fix](mtmv) fix mtmv task nereids cost too much time (#37589)
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
zddr authored Jul 11, 2024
1 parent 5367f7e commit d15005d
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
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;
Expand Down Expand Up @@ -222,6 +223,9 @@ public void run() throws JobException {
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
Expand Down

0 comments on commit d15005d

Please sign in to comment.