This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new ed3727b3520 branch-2.1:[Fix](insert-job)Fix Issue with Missing StatementContext in StmtExecutor, Leading to Incorrect SQL_BLOCK Handling (#46715) (#46757) ed3727b3520 is described below commit ed3727b352085b02600f89aade5b3ea79a6ee16d Author: Calvin Kirs <guoqi...@selectdb.com> AuthorDate: Fri Jan 10 20:15:50 2025 +0800 branch-2.1:[Fix](insert-job)Fix Issue with Missing StatementContext in StmtExecutor, Leading to Incorrect SQL_BLOCK Handling (#46715) (#46757) … #46715 --- .../org/apache/doris/job/extensions/insert/InsertTask.java | 6 +++++- regression-test/suites/job_p0/test_base_insert_job.groovy | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/InsertTask.java b/fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/InsertTask.java index 94484fdcd9b..728f603d607 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/InsertTask.java +++ b/fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/InsertTask.java @@ -28,6 +28,8 @@ import org.apache.doris.job.task.AbstractTask; import org.apache.doris.load.FailMsg; import org.apache.doris.load.loadv2.LoadJob; import org.apache.doris.load.loadv2.LoadStatistic; +import org.apache.doris.nereids.StatementContext; +import org.apache.doris.nereids.glue.LogicalPlanAdapter; import org.apache.doris.nereids.parser.NereidsParser; import org.apache.doris.nereids.trees.plans.commands.insert.InsertIntoTableCommand; import org.apache.doris.qe.ConnectContext; @@ -159,13 +161,15 @@ public class InsertTask extends AbstractTask { TUniqueId queryId = generateQueryId(UUID.randomUUID().toString()); ctx.getSessionVariable().enableFallbackToOriginalPlanner = false; ctx.getSessionVariable().enableNereidsDML = true; - stmtExecutor = new StmtExecutor(ctx, (String) null); ctx.setQueryId(queryId); + StatementContext statementContext = new StatementContext(); + ctx.setStatementContext(statementContext); if (StringUtils.isNotEmpty(sql)) { NereidsParser parser = new NereidsParser(); this.command = (InsertIntoTableCommand) parser.parseSingle(sql); this.command.setLabelName(Optional.of(getJobId() + LABEL_SPLITTER + getTaskId())); this.command.setJobId(getTaskId()); + stmtExecutor = new StmtExecutor(ctx, new LogicalPlanAdapter(command, ctx.getStatementContext())); } super.before(); diff --git a/regression-test/suites/job_p0/test_base_insert_job.groovy b/regression-test/suites/job_p0/test_base_insert_job.groovy index 1703b355c95..042546d1e43 100644 --- a/regression-test/suites/job_p0/test_base_insert_job.groovy +++ b/regression-test/suites/job_p0/test_base_insert_job.groovy @@ -72,6 +72,17 @@ suite("test_base_insert_job") { "replication_allocation" = "tag.location.default: 1" ); """ + sql """ + DROP SQL_BLOCK_RULE IF EXISTS test_base_insert_job_rule + """ + sql """ + CREATE SQL_BLOCK_RULE test_base_insert_job_rule + PROPERTIES( + "sql"="select \\\\* from test_base_insert_job_rule", + "global"="true", + "enable"="true" + ); + """ sql """ insert into ${tableName} values ('2023-03-18', 1, 1) @@ -242,6 +253,9 @@ suite("test_base_insert_job") { //resume tasks size should be greater than before pause afterResumeTasks.size() > tasks.size() }) + sql """ + DROP SQL_BLOCK_RULE IF EXISTS test_base_insert_job_rule + """ // check resume job status def afterResumeJobStatus = sql """ select status from jobs("type"="insert") where Name='${jobName}' --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org