[ 
https://issues.apache.org/jira/browse/IGNITE-20976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel Pereslegin updated IGNITE-20976:
--------------------------------------
    Epic Link: IGNITE-20453

> Sql. Multistatement dynamic parameters adjusting works incorrect for DELETE 
> operator.
> -------------------------------------------------------------------------------------
>
>                 Key: IGNITE-20976
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20976
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Pavel Pereslegin
>            Priority: Major
>              Labels: ignite-3
>
> Normalized statement cannot be obtained for 'DELETE' statement with dynamic 
> parameters.
> It seems that after adjusting the dynamic parameters (see 
> {{ScriptParseResult.SqlDynamicParamsAdjuster}}),  the new tree cannot be 
> converted to a string.
> Reproducer:
> {code:java}
>     @Test
>     public void testScriptDelete() {
>         String query1 = "SELECT 1;";
>         String query2 = "DELETE FROM TEST WHERE ID=?";
>         // Parse separately - ok.
>         StatementParseResult res1 = IgniteSqlParser.parse(query1, 
> StatementParseResult.MODE);
>         StatementParseResult res2 = IgniteSqlParser.parse(query2, 
> StatementParseResult.MODE);
>         System.out.println(res1.statement().toString());
>         System.out.println(res2.statement().toString());
>         // Parse script throws "UnsupportedOperationException" for 
> `toString()` from `DELETE` statement.
>         ScriptParseResult scriptRes = IgniteSqlParser.parse(query1 + query2, 
> ScriptParseResult.MODE);
>         for (StatementParseResult res : scriptRes.results()) {
>             System.out.println(res.statement().toString());
>         }
>     }
> {code}
> Output
> {noformat}
> SELECT 1
> DELETE FROM `TEST`
> WHERE `ID` = ?
> SELECT 1
> java.lang.UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlSyntax$7: SPECIAL
>       at org.apache.calcite.util.Util.needToImplement(Util.java:1119)
>       at org.apache.calcite.sql.SqlSyntax$7.unparse(SqlSyntax.java:129)
>       at org.apache.calcite.sql.SqlOperator.unparse(SqlOperator.java:385)
>       at org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:466)
>       at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:131)
>       at org.apache.calcite.sql.SqlNode.toSqlString(SqlNode.java:156)
>       at org.apache.calcite.sql.SqlNode.toString(SqlNode.java:131)
>       at 
> org.apache.ignite.internal.sql.engine.sql.IgniteSqlParserTest.testScriptDelete(IgniteSqlParserTest.java:59)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to