[ 
https://issues.apache.org/jira/browse/IGNITE-20976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17794130#comment-17794130
 ] 

Pavel Pereslegin edited comment on IGNITE-20976 at 12/7/23 11:08 AM:
---------------------------------------------------------------------

[~mzhuravkov], thanks for the contribution!
[Merged|https://github.com/apache/ignite-3/commit/171fa1220c7834b63e5190898c850f9325559106]
 to the main branch.


was (Author: xtern):
[~mzhuravkov], thanks for the contribution!
Merged to the main branch.

> 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
>            Assignee: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>             Fix For: 3.0.0-beta2
>
>         Attachments: overwrite_sql_call_create.png
>
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> 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