Skip to content

Conversation

@github-actions
Copy link
Contributor

Cherry-picked from #60182

fix insert failed when concurrent schema change because the lock scope
is small, introduced by #45045.

```
2025-12-22 18:31:27,916 WARN (mysql-nio-pool-20|395) [StmtExecutor.execute():546] Analyze failed. stmt[223, 6daf515a262f4708-959e9e3ef4590797]
org.apache.doris.common.NereidsException: errCode = 2, detailMessage = insert into cols should be corresponding to the query output
	at org.apache.doris.qe.StmtExecutor.executeByNereids(StmtExecutor.java:706)
	at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:541)
	at org.apache.doris.qe.StmtExecutor.queryRetry(StmtExecutor.java:500)
	at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:485)
	at org.apache.doris.qe.ConnectProcessor.executeQuery(ConnectProcessor.java:311)
	at org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:198)
	at org.apache.doris.qe.MysqlConnectProcessor.handleQuery(MysqlConnectProcessor.java:231)
	at org.apache.doris.qe.MysqlConnectProcessor.dispatch(MysqlConnectProcessor.java:259)
	at org.apache.doris.qe.MysqlConnectProcessor.processOnce(MysqlConnectProcessor.java:403)
	at org.apache.doris.mysql.ReadListener.lambda$handleEvent$0(ReadListener.java:52)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.doris.common.AnalysisException: errCode = 2, detailMessage = insert into cols should be corresponding to the query output
	... 13 more
Caused by: org.apache.doris.nereids.exceptions.AnalysisException: insert into cols should be corresponding to the query output
	at org.apache.doris.nereids.rules.analysis.BindSink.bindOlapTableSink(BindSink.java:194)
	at org.apache.doris.nereids.pattern.PatternMatcher$1.transform(PatternMatcher.java:96)
	at org.apache.doris.nereids.jobs.rewrite.TopDownVisitorRewriteJob.doRewrite(TopDownVisitorRewriteJob.java:114)
	at org.apache.doris.nereids.jobs.rewrite.TopDownVisitorRewriteJob.rewrite(TopDownVisitorRewriteJob.java:80)
	at org.apache.doris.nereids.jobs.rewrite.TopDownVisitorRewriteJob.execute(TopDownVisitorRewriteJob.java:56)
	at org.apache.doris.nereids.jobs.rewrite.AdaptiveTopDownRewriteJob.execute(AdaptiveTopDownRewriteJob.java:41)
	at org.apache.doris.nereids.jobs.executor.AbstractBatchJobExecutor.execute(AbstractBatchJobExecutor.java:167)
	at org.apache.doris.nereids.jobs.executor.Analyzer.lambda$execute$0(Analyzer.java:98)
	at org.apache.doris.nereids.util.MoreFieldsThread.keepFunctionSignature(MoreFieldsThread.java:127)
	at org.apache.doris.nereids.jobs.executor.Analyzer.execute(Analyzer.java:97)
	at org.apache.doris.nereids.jobs.executor.Analyzer.analyze(Analyzer.java:92)
	at org.apache.doris.nereids.NereidsPlanner.lambda$analyze$4(NereidsPlanner.java:414)
	at org.apache.doris.nereids.NereidsPlanner.keepOrShowPlanProcess(NereidsPlanner.java:1109)
	at org.apache.doris.nereids.NereidsPlanner.analyze(NereidsPlanner.java:414)
	at org.apache.doris.nereids.trees.plans.commands.insert.FastInsertIntoValuesPlanner.analyze(FastInsertIntoValuesPlanner.java:63)
	at org.apache.doris.nereids.NereidsPlanner.planWithoutLock(NereidsPlanner.java:288)
	at org.apache.doris.nereids.NereidsPlanner.planWithLock(NereidsPlanner.java:263)
	at org.apache.doris.nereids.NereidsPlanner.plan(NereidsPlanner.java:162)
	at org.apache.doris.nereids.trees.plans.commands.insert.InsertIntoTableCommand.planInsertExecutor(InsertIntoTableCommand.java:540)
	at org.apache.doris.nereids.trees.plans.commands.insert.InsertIntoTableCommand.initPlanOnce(InsertIntoTableCommand.java:353)
	at org.apache.doris.nereids.trees.plans.commands.insert.InsertIntoTableCommand.initPlan(InsertIntoTableCommand.java:259)
	at org.apache.doris.nereids.trees.plans.commands.insert.InsertIntoTableCommand.initPlan(InsertIntoTableCommand.java:226)
	at org.apache.doris.nereids.trees.plans.commands.insert.InsertIntoTableCommand.runInternal(InsertIntoTableCommand.java:569)
	at org.apache.doris.nereids.trees.plans.commands.insert.InsertIntoTableCommand.run(InsertIntoTableCommand.java:210)
	at org.apache.doris.qe.StmtExecutor.executeByNereids(StmtExecutor.java:678)
	... 12 more
```
@github-actions github-actions bot requested a review from yiguolei as a code owner January 26, 2026 11:46
@Thearas
Copy link
Contributor

Thearas commented Jan 26, 2026

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@dataroaring dataroaring reopened this Jan 26, 2026
@Thearas
Copy link
Contributor

Thearas commented Jan 26, 2026

run buildall

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (3/3) 🎉
Increment coverage report
Complete coverage report

@yiguolei yiguolei merged commit 879fff5 into branch-4.0 Jan 27, 2026
24 of 26 checks passed
@github-actions github-actions bot deleted the auto-pick-60182-branch-4.0 branch January 27, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants