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

   ### 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
   
   [ERROR] 2022-12-08 09:30:30.645 +0000 - sql task error
   java.lang.NullPointerException: null
        at 
org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils.expandListParameter(ParameterUtils.java:170)
        at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.getSqlAndSqlParamsMap(SqlTask.java:457)
        at 
java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at 
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at 
java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
        at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.handle(SqlTask.java:142)
        at 
org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread.run(TaskExecuteThread.java:208)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at 
com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
        at 
com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
        at 
com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
        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:748)
   
   ### What you expected to happen
   
   When I upgraded from version 3.0.0 to 3.0.2, the execution task got null 
pointer exception.
   It was normal before I upgraded and I observed that 
ParameterUtils.expandListParameter is a recent addition to the code.
   
   ### How to reproduce
   
   By reading the dolphinscheduler source code, I found the following code.
   ```java
   String[] split = sql.split("\\?");
   ...
   for (int i = 1; i < split.length; i++) {
       Property property = params.get(i);
       String value = property.getValue();
   }
   ```
   The placeholder for the parameter is "?" and if the "?" is also present in 
my sql If my sql also has "?" in it, for example in a regular expression, will 
that lead to an error in splitting and guessing the wrong number of parameters, 
leading to an out-of-bounds index from the map and a null result.
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   3.0.x
   
   ### Are you willing to submit PR?
   
   - [x] 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