github-actions[bot] commented on code in PR #68269:
URL: https://github.com/apache/doris/pull/68269#discussion_r4060687581
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java:
##########
@@ -969,10 +970,11 @@ private IvmPlanSignature refreshPartitions(Set<String>
refreshPartitionNames,
Map<TableIf, String> tableWithPartKey,
Optional<IvmRewriteContext> rewriteContext, RefreshMode
refreshMode)
throws Exception {
- // Create MTMV context first so that new StatementContext() captures
the
- // correct thread-local ConnectContext (with MTMV disabled rules,
etc.).
+ // Create the MTMV context before parsing the MV definition SQL so
SET_VAR hints
+ // resolve against the internal session (with MTMV disabled rules,
etc.).
ConnectContext mtmvCtx = MTMVPlanUtil.createMTMVContext(mtmv,
MTMVPlanUtil.DISABLE_RULES_WHEN_RUN_MTMV_TASK);
- StatementContext statementContext = new StatementContext();
+ StatementContext statementContext = new StatementContext(
+ mtmvCtx, new OriginStatement(mtmv.getQuerySql(), 0));
Review Comment:
[P2] Install the incremental context before parsing SET_VAR hints
This fixes the origin-bearing context on the complete/partition path, but
`IvmIncrRefreshManager.executeInternalRefresh` constructs its
`StatementContext` and then calls `buildInsertCommand()` before
`executeCommand()` installs that context. For an incremental MV query
containing `SET_VAR`, `parseSingle` reaches `LogicalPlanBuilder.withHints`,
passes the still-null `ConnectContext.get().getStatementContext()` to
`SelectHintSetVar`, and the refresh fails with a null dereference; incremental
dry run has the same ordering. Please install the new context before parsing
(or make parsing consume it explicitly) and add a hinted incremental-refresh
test. The ordering predates this branch, but it is a distinct parallel refresh
bug exposed by this call-chain review.
--
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]