blu3gui7ar opened a new issue, #14483:
URL: https://github.com/apache/dolphinscheduler/issues/14483

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   NullPointerException happened when running sql task, with both ? and 
customer parameter in sql.
   E.g. 
   `select '${mode}', '?'`
   
   `
   [INFO] 2023-07-07 23:51:17.551 +0000 - setSqlParamsMap: Property with 
paramName: mode put in sqlParamsMap of content select '${mode}', '?'
    successfully.
   [ERROR] 2023-07-07 23:51:17.551 +0000 - sql task error
   java.lang.NullPointerException: null
   [ERROR] 2023-07-07 23:51:17.551 +0000 - 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:168)
        at 
org.apache.dolphinscheduler.server.worker.runner.DefaultWorkerDelayTaskExecuteRunnable.executeTask(DefaultWorkerDelayTaskExecuteRunnable.java:49)
   `
   
   ### What you expected to happen
   
   No Exception should happen.
   
   ### How to reproduce
   
   Create a SQL Task, use the sql 
   `select '${mode}', '?'`
   
   And run the task.
   
   ### Anything else
   
   My environment is 3.1.4. 
   After code investigate, the suspicious code is here:
   
   
https://github.com/apache/dolphinscheduler/blob/a1bf597d0a348f67a3e943217dcf700e484ac9f8/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java#L195
   
   `        String[] split = sql.split("\\?");`
   
   Seems assuming any ? in sql is parameter holder, which is not true.
   
   ### Version
   
   3.1.x
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]

Reply via email to