-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Search before asking
- I had searched in the issues and found no similar issues.
What happened
Exception caused by incorrect parameter type passed from upstream task to downstream task.
Upstream SQL task content:
SELECT CAST(week_of_year AS INT) as week_of_year FROM table_name LIMIT 1
Upstream SQL task output parameter:
week_of_year OUT INTEGER
Downstream SQL task content:
ALTER TABLE table_name ADD PARTITION p${week_of_year} VALUES IN (('${week_of_year}'));
Downstream SQL task input parameter:
week_of_year IN INTEGER ${week_of_year}
Error message when running the task:
[LOG-PATH]: /opt/software/dolphinscheduler/worker-server/logs/20260317/20630785500544_36-19853-41745.log, [HOST]: Host{address='198.168.x.x:1234', ip='198.168.x.x', port=1234}
[INFO] 2026-03-17 22:07:50.058 +0800 - Begin to pulling task
[INFO] 2026-03-17 22:07:50.059 +0800 - Begin to initialize task
[INFO] 2026-03-17 22:07:50.059 +0800 - Set task startTime: Tue Mar 17 22:07:50 CST 2026
[INFO] 2026-03-17 22:07:50.059 +0800 - Set task envFile: /opt/software/dolphinscheduler/worker-server/conf/dolphinscheduler_env.sh
[INFO] 2026-03-17 22:07:50.059 +0800 - Set task appId: 19853_41745
[INFO] 2026-03-17 22:07:50.059 +0800 - End initialize task
[INFO] 2026-03-17 22:07:50.060 +0800 - Set task status to TaskExecutionStatus{code=1, desc='running'}
[INFO] 2026-03-17 22:07:50.060 +0800 - TenantCode:dolphinscheduler check success
[INFO] 2026-03-17 22:07:50.064 +0800 - ProcessExecDir:/opt/ds-data/exec/process/dolphinscheduler/20589300434304/20630785500544_36/19853/41745 check success
[INFO] 2026-03-17 22:07:50.064 +0800 - Resources:{} check success
[INFO] 2026-03-17 22:07:50.064 +0800 - Task plugin: SQL create success
[INFO] 2026-03-17 22:07:50.064 +0800 - Success initialized task plugin instance success
[INFO] 2026-03-17 22:07:50.064 +0800 - Success set taskVarPool: [{"prop":"week_of_year","direct":"IN","type":"INTEGER","value":"20260010"}]
[INFO] 2026-03-17 22:07:50.064 +0800 - Full sql parameters: SqlParameters{type='MYSQL', datasource=1, sql='ALTER TABLE dws.dws_app_user_w ADD PARTITION p${week_of_year} VALUES IN (('${week_of_year}'));', sqlType=1, sendEmail=null, displayRows=50, limit=0, segmentSeparator=;, udfs='null', showType='null', connParams='null', groupId='0', title='null', preStatements=[], postStatements=[]}
[INFO] 2026-03-17 22:07:50.064 +0800 - sql type : MYSQL, datasource : 1, sql : ALTER TABLE dws.dws_app_user_w ADD PARTITION p${week_of_year} VALUES IN (('${week_of_year}')); , localParams : [Property{prop='week_of_year', direct=IN, type=INTEGER, value='${week_of_year}'}],udfs : null,showType : null,connParams : null,varPool : [Property{prop='week_of_year', direct=IN, type=INTEGER, value='20260010'}] ,query max result limit 0
[INFO] 2026-03-17 22:07:50.065 +0800 - setSqlParamsMap: Property with paramName: week_of_year put in sqlParamsMap of content
ALTER TABLE dws.dws_app_user_w ADD PARTITION p${week_of_year} VALUES IN (('${week_of_year}')); successfully.
[INFO] 2026-03-17 22:07:50.065 +0800 - setSqlParamsMap: Property with paramName: week_of_year put in sqlParamsMap of content
ALTER TABLE dws.dws_app_user_w ADD PARTITION p${week_of_year} VALUES IN (('${week_of_year}')); successfully.
[INFO] 2026-03-17 22:07:50.065 +0800 - after replace sql , preparing :
ALTER TABLE dws.dws_app_user_w ADD PARTITION p? VALUES IN ((?));
[INFO] 2026-03-17 22:07:50.065 +0800 - Sql Params are replaced sql , parameters:${week_of_year}(INTEGER)${week_of_year}(INTEGER)
[INFO] 2026-03-17 22:07:50.065 +0800 - can't find udf function resource
[ERROR] 2026-03-17 22:07:50.069 +0800 - execute sql error: SQL task prepareStatementAndBind error
[ERROR] 2026-03-17 22:07:50.069 +0800 - sql task error
org.apache.dolphinscheduler.plugin.task.api.TaskException: SQL task prepareStatementAndBind error
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.prepareStatementAndBind(SqlTask.java:383)
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.executeUpdate(SqlTask.java:315)
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.executeFuncAndSql(SqlTask.java:212)
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.handle(SqlTask.java:163)
at org.apache.dolphinscheduler.server.worker.runner.DefaultWorkerDelayTaskExecuteRunnable.executeTask(DefaultWorkerDelayTaskExecuteRunnable.java:49)
at org.apache.dolphinscheduler.server.worker.runner.WorkerTaskExecuteRunnable.run(WorkerTaskExecuteRunnable.java:174)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.NumberFormatException: For input string: "${week_of_year}"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:569)
at java.lang.Integer.parseInt(Integer.java:615)
at org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils.setInParameter(ParameterUtils.java:138)
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.prepareStatementAndBind(SqlTask.java:376)
... 12 common frames omitted
[ERROR] 2026-03-17 22:07:50.069 +0800 - Task execute failed, due to meet an exception
org.apache.dolphinscheduler.plugin.task.api.TaskException: Execute sql task failed
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.handle(SqlTask.java:170)
at org.apache.dolphinscheduler.server.worker.runner.DefaultWorkerDelayTaskExecuteRunnable.executeTask(DefaultWorkerDelayTaskExecuteRunnable.java:49)
at org.apache.dolphinscheduler.server.worker.runner.WorkerTaskExecuteRunnable.run(WorkerTaskExecuteRunnable.java:174)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Caused by: org.apache.dolphinscheduler.plugin.task.api.TaskException: SQL task prepareStatementAndBind error
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.prepareStatementAndBind(SqlTask.java:383)
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.executeUpdate(SqlTask.java:315)
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.executeFuncAndSql(SqlTask.java:212)
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.handle(SqlTask.java:163)
... 9 common frames omitted
Caused by: java.lang.NumberFormatException: For input string: "${week_of_year}"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:569)
at java.lang.Integer.parseInt(Integer.java:615)
at org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils.setInParameter(ParameterUtils.java:138)
at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.prepareStatementAndBind(SqlTask.java:376)
... 12 common frames omitted
[INFO] 2026-03-17 22:07:50.069 +0800 - Get a exception when execute the task, will send the task execute result to master, the current task execute result is TaskExecutionStatus{code=6, desc='failure'}
What you expected to happen
The parameter is passed correctly, and its type is INTEGER as I set.
How to reproduce
no
Anything else
No response
Version
3.4.1
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct