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

Pavel Pereslegin updated IGNITE-20976:
--------------------------------------
    Description: 
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.toString());
        System.out.println(res2.toString());
        
        // Parse script throws "UnsupportedOperationException" by `toString()` 
for `DELETE` statement. 
        ScriptParseResult scriptRes = IgniteSqlParser.parse(query1 + query2, 
ScriptParseResult.MODE);
        for (StatementParseResult res : scriptRes.results()) {
            System.out.println(res.toString());
        }
    }
{code}



  was:
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.toString());
        System.out.println(res2.toString());
        
        // Parse script throws "UnsupportedOperationException" by `toString()` 
for `DELETE` statement. 
        ScriptParseResult scriptRes = IgniteSqlParser.parse(query1 + query2, 
ScriptParseResult.MODE);
        for (StatementParseResult res : scriptRes.results()) {
            System.out.println(res.toString());
        }
    }
{code}




> 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.toString());
>         System.out.println(res2.toString());
>         
>         // Parse script throws "UnsupportedOperationException" by 
> `toString()` for `DELETE` statement. 
>         ScriptParseResult scriptRes = IgniteSqlParser.parse(query1 + query2, 
> ScriptParseResult.MODE);
>         for (StatementParseResult res : scriptRes.results()) {
>             System.out.println(res.toString());
>         }
>     }
> {code}



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

Reply via email to