zddr commented on code in PR #29453: URL: https://github.com/apache/doris/pull/29453#discussion_r1441227871
########## fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java: ########## @@ -224,6 +227,15 @@ public void analyzeQuery(ConnectContext ctx) { } getRelation(planner); getColumns(plan); + try { + // we want to set session variable, so need to new connectContext avoid influence other query + statementContext.setConnectContext( + MTMVPlanUtil.createMTMVContext(this.envInfo.getCtlId(), this.envInfo.getDbId())); Review Comment: Creating a new ctx here may not be a good method. How about setting environment variables on the ctx of crude oil and setting them back after the method ends? Or there may be other methods instead of using the environment variable setDisableNereidsRules ########## fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPlanUtil.java: ########## @@ -60,6 +60,21 @@ public static ConnectContext createMTMVContext(MTMV mtmv) throws AnalysisExcepti return ctx; } + public static ConnectContext createMTMVContext(long ctlId, long dbId) throws AnalysisException { Review Comment: There is some overlap with the logic of createMTMVContext (MTMV mtmv), abstract it a bit -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org