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

Pavel Pereslegin updated IGNITE-22197:
--------------------------------------
    Description: 
Currently, the catalog command itself does not handle the 'IF EXISTS' 'IF NOT 
EXISTS' flags. We handle the exception thrown by the command and set the result 
to false if the flag was set. And this result (true/false) can be obtained by 
the user using {{AsyncResultSet#wasApplied}} method.

With the current approach, a problem may arise when processing a batch command.
For example
{code:sql}
CREATE TABLE IF NOT EXISTS Person...   -- command 1
CREATE TABLE IF NOT EXISTS City...     -- command 2
{code}
If the Person table exists, the batch will not be fully executed.

To address this we can move flag handling inside the command itself.
To keep "wasApplied" working, we can rework a bit {{CatalogManager#execute}} so 
that it returns not only the catalog version, but also a flag indicating that 
something was changed when this command was executed.

  was:
Currently, the catalog command itself does not handle the 'IF EXISTS' 'IF NOT 
EXISTS' flags. We handle the exception thrown by the command and set the result 
to false if the flag was set. And this result (true/false) can be obtained by 
the user using {{AsyncResultSet#wasApplied}} method.

With the current approach, a problem may arise when processing a batch command.
For example
{code:sql}
CREATE TABLE IF NOT EXISTS Person...   -- command 1
CREATE TABLE IF NOT EXISTS City...        -- command 2
{code}
If the Person table exists, the batch will not be fully executed.

To address this we can move flag handling inside the command itself.
To keep "wasApplied" working, we can rework a bit {{CatalogManager#execute}} so 
that it returns not only the catalog version, but also a flag indicating that 
something was changed when this command was executed.


> Move DDL 'IF EXISTS` flag handling inside the catalog command
> -------------------------------------------------------------
>
>                 Key: IGNITE-22197
>                 URL: https://issues.apache.org/jira/browse/IGNITE-22197
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>            Reporter: Pavel Pereslegin
>            Priority: Major
>              Labels: ignite-3
>
> Currently, the catalog command itself does not handle the 'IF EXISTS' 'IF NOT 
> EXISTS' flags. We handle the exception thrown by the command and set the 
> result to false if the flag was set. And this result (true/false) can be 
> obtained by the user using {{AsyncResultSet#wasApplied}} method.
> With the current approach, a problem may arise when processing a batch 
> command.
> For example
> {code:sql}
> CREATE TABLE IF NOT EXISTS Person...   -- command 1
> CREATE TABLE IF NOT EXISTS City...     -- command 2
> {code}
> If the Person table exists, the batch will not be fully executed.
> To address this we can move flag handling inside the command itself.
> To keep "wasApplied" working, we can rework a bit {{CatalogManager#execute}} 
> so that it returns not only the catalog version, but also a flag indicating 
> that something was changed when this command was executed.



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

Reply via email to