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

   ### 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] 2023-01-13 14:46:23.561 +0800 TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask:[211] - 
[WorkflowInstance-6168][TaskInstance-12509] - execute sql error: SQL task 
prepareStatementAndBind error
   [ERROR] 2023-01-13 14:46:23.561 +0800 TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask:[164] - 
[WorkflowInstance-6168][TaskInstance-12509] - 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:370)
           at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.executeQuery(SqlTask.java:294)
           at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.executeFuncAndSql(SqlTask.java:199)
           at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.handle(SqlTask.java:158)
           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)
   Caused by: java.sql.SQLException: Parameter index out of range (1 > number 
of parameters, which is 0).
           at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
           at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
           at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
           at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
           at 
com.mysql.cj.jdbc.ClientPreparedStatement.checkBounds(ClientPreparedStatement.java:1370)
           at 
com.mysql.cj.jdbc.ClientPreparedStatement.getCoreParameterIndex(ClientPreparedStatement.java:1383)
           at 
com.mysql.cj.jdbc.ClientPreparedStatement.setString(ClientPreparedStatement.java:1750)
           at 
com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setString(HikariProxyPreparedStatement.java)
           at 
org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils.setInParameter(ParameterUtils.java:135)
           at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.prepareStatementAndBind(SqlTask.java:364)
           ... 11 common frames omitted
   [ERROR] 2023-01-13 14:46:23.561 +0800 
org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread:[222] - 
[WorkflowInstance-6168][TaskInstance-12509] - task scheduler failure
   org.apache.dolphinscheduler.plugin.task.api.TaskException: SQL task 
prepareStatementAndBind error
           at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.prepareStatementAndBind(SqlTask.java:370)
           at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.executeQuery(SqlTask.java:294)
           at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.executeFuncAndSql(SqlTask.java:199)
           at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.handle(SqlTask.java:158)
           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)
   Caused by: java.sql.SQLException: Parameter index out of range (1 > number 
of parameters, which is 0).
           at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
           at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
           at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
           at 
com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
           at 
com.mysql.cj.jdbc.ClientPreparedStatement.checkBounds(ClientPreparedStatement.java:1370)
           at 
com.mysql.cj.jdbc.ClientPreparedStatement.getCoreParameterIndex(ClientPreparedStatement.java:1383)
           at 
com.mysql.cj.jdbc.ClientPreparedStatement.setString(ClientPreparedStatement.java:1750)
           at 
com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setString(HikariProxyPreparedStatement.java)
           at 
org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils.setInParameter(ParameterUtils.java:135)
           at 
org.apache.dolphinscheduler.plugin.task.sql.SqlTask.prepareStatementAndBind(SqlTask.java:364)
           ... 11 common frames omitted
   
   
   my sql code is "select * 
    FROM db_name.ods_table_name_es WHERE esquery("test_record", '{
        "bool": {
           "must": [
              {
                 "term": {"stationsId": 96}
              }
           ],
            "filter": [
                        
                        {
                          "range": {
                                "finish": {
                                        "gte": "${st}"
                                 
                                }
                          }
                        },
                        {
                          "range": {
                                "finish": {
                                        "lte": "${et}"
                                }
                          }
                        }
                ]
        }}')"
   my parameter key: "st" value : "$[yyyy-MM-dd-1]"
   
   ### What you expected to happen
   
   SQL task unable to resolve parameter
   
   ### How to reproduce
   
   1、Use doris to create an external table of ES
   2、Pass in parameters in sql task
   
   ### Anything else
   
   使用 SQL task 会出现
   
   ### Version
   
   3.0.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