You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Shravya Nethula <sh...@aline-consulting.com> on 2020/09/02 17:27:02 UTC

Issue in Alter Table - Drop Column functionality

Hi,

When I am trying the following query from GridGain, it works as expected.
ALTER TABLE person DROP COLUMN (age)

But when I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));

Output:
javax.cache.CacheException
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
    at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
    at net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
    at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
    at net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
    at net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: null
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
    at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
    ... 6 more
Caused by: java.lang.NullPointerException
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)
    ... 18 more


On the other hand, ALTER TABLE ADD COLUMN functionality is working in both GridGain and also through thick client Java code.
Why is it so? Is there any parameter or configurations that are missing?
Please kindly let me know if you need any more details regarding the failure scenario.





Regards,

Shravya Nethula,

BigData Developer,

[cid:09c0df72-eaf4-487f-b018-60299eb21fc3]

Hyderabad.

Re: Issue in Alter Table - Drop Column functionality

Posted by Shravya Nethula <sh...@aline-consulting.com>.
Hi,

I have tried "ALTER TABLE PUBLIC.person DROP COLUMN (age)" query as well.
I am getting the same error message.



Regards,

Shravya Nethula,

BigData Developer,

[cid:6edeb691-d625-4f59-861d-33767b51c98d]

Hyderabad.

________________________________
From: Denis Mekhanikov <dm...@gmail.com>
Sent: Thursday, September 3, 2020 2:17 PM
To: user <us...@ignite.apache.org>
Subject: Re: Issue in Alter Table - Drop Column functionality

I mean, DROP COLUMN, not DROP TABLE.

Denis

чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>>:
Does the DROP TABLE statement work if you specify the schema name explicitly?
For example, if the table is in the PUBLIC schema, try running the following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)

Denis

ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <sh...@aline-consulting.com>>:
Hi,

When I am trying the following query from GridGain, it works as expected.
ALTER TABLE person DROP COLUMN (age)

But when I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));

Output:
javax.cache.CacheException
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
    at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
    at net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
    at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
    at net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
    at net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: null
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
    at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
    ... 6 more
Caused by: java.lang.NullPointerException
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)
    ... 18 more


On the other hand, ALTER TABLE ADD COLUMN functionality is working in both GridGain and also through thick client Java code.
Why is it so? Is there any parameter or configurations that are missing?
Please kindly let me know if you need any more details regarding the failure scenario.





Regards,

Shravya Nethula,

BigData Developer,

[cid:17453219a79676f7b2e1]

Hyderabad.

Re: Issue in Alter Table - Drop Column functionality

Posted by Shravya Nethula <sh...@aline-consulting.com>.
Thank you for the information Ilya.


Regards,

Shravya Nethula,

BigData Developer,

[cid:9d5782fd-7700-4644-9354-38435191aa05]

Hyderabad.

________________________________
From: Ilya Kasnacheev <il...@gmail.com>
Sent: Thursday, September 24, 2020 5:01 PM
To: user@ignite.apache.org <us...@ignite.apache.org>
Subject: Re: Issue in Alter Table - Drop Column functionality

Hello!

I think it will be in 2.10 or 2.9.1. Maybe early next year?

Regards,
--
Ilya Kasnacheev


чт, 24 сент. 2020 г. в 14:04, Shravya Nethula <sh...@aline-consulting.com>>:
Hi Ilya,

Thank you for the confirmation and the workaround is working as expected. Much appreciated.

Is there any rough release date or release version for this issue?



Regards,

Shravya Nethula,

BigData Developer,

[cid:174bfe19e70c0299585]

Hyderabad.

________________________________
From: Ilya Kasnacheev <il...@gmail.com>>
Sent: Thursday, September 24, 2020 3:53 PM
To: user@ignite.apache.org<ma...@ignite.apache.org> <us...@ignite.apache.org>>
Subject: Re: Issue in Alter Table - Drop Column functionality

Hello!

Thank you for this report, now I can indeed confirm I can see the issue! I have filed https://issues.apache.org/jira/browse/IGNITE-13482 on your behalf.

As a workaround you can do SELECT * FROM tbl LIMIT 0; before issuing ALTER TABLE on that node.

Regards,
--
Ilya Kasnacheev


чт, 24 сент. 2020 г. в 10:41, Shravya Nethula <sh...@aline-consulting.com>>:
Hi Ilya,

Yes, the code that you sent is working fine.

But can you please try the below code, by executing CREATE TABLE and ALTER TABLE in separate programs. In this scenario, its not working.
public class ClientNode {

    public static void main(String[] args) {
        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setClientMode(true);

        Ignite ignite = Ignition.start(igniteCfg);
        IgniteCache foo = ignite.getOrCreateCache("foo");

        foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
        foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
        //foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));

        //System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll());

} }

public class ClientNode {
    public static void main(String[] args) {
        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setClientMode(true);

        Ignite ignite = Ignition.start(igniteCfg);
        IgniteCache foo = ignite.getOrCreateCache("foo");

        //foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
        //foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
        foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));

        System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll())

} }

This second program is giving the following error:
Exception in thread "main" javax.cache.CacheException
at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
at net.aline.cloudedh.base.database.extra.ClientNode.main(ClientNode.java:28)
Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: null
at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
... 3 more
Caused by: java.lang.NullPointerException
at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)
... 15 more





Regards,

Shravya Nethula,

BigData Developer,

[cid:174bfe19e702d587d5b4]

Hyderabad.

________________________________
From: Ilya Kasnacheev <il...@gmail.com>>
Sent: Monday, September 21, 2020 3:04 PM
To: user@ignite.apache.org<ma...@ignite.apache.org> <us...@ignite.apache.org>>
Subject: Re: Issue in Alter Table - Drop Column functionality

Hello!

Sqlline can use both thin JDBC and thick JDBC driver. In this case it uses thick JDBC driver.

Do you have a reproducer project to demonstrate the issue? I can't get it to show up:


public class ClientNode {
    public static void main(String[] args) {
        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setClientMode(true);

        Ignite ignite = Ignition.start(igniteCfg);
        IgniteCache foo = ignite.getOrCreateCache("foo");

        foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
        foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
        foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));

        System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll());
    }
}

gives

[[1, Vassisualy]]

Regards,
--
Ilya Kasnacheev


пн, 21 сент. 2020 г. в 10:27, Shravya Nethula <sh...@aline-consulting.com>>:
Hi Ilya,

sqlLine is also a thin client if I am not wrong!
From thin clients like GridGain and sqlLine, its working as expected.

It is not working from thick client.
When I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));



Regards,

Shravya Nethula,

BigData Developer,

[cid:174bfe19e70ccd59d663]

Hyderabad.

________________________________
From: Ilya Kasnacheev <il...@gmail.com>>
Sent: Tuesday, September 15, 2020 3:07 PM
To: user@ignite.apache.org<ma...@ignite.apache.org> <us...@ignite.apache.org>>
Subject: Re: Issue in Alter Table - Drop Column functionality

Hello!

I have just validated it on 2.8.1. Seems to work!

~/Downloads/apache-ignite-2.8.1-bin% bin/sqlline.sh
sqlline version 1.3.0
sqlline> !connect jdbc:ignite:cfg://config/default-config.xml
[12:33:33]    __________  ________________
[12:33:33]   /  _/ ___/ |/ /  _/_  __/ __/
[12:33:33]  _/ // (7 7    // /  / / / _/
[12:33:33] /___/\___/_/|_/___/ /_/ /___/
[12:33:33]
[12:33:33] ver. 2.8.1#20200521-sha1:86422096
[12:33:33] 2020 Copyright(C) Apache Software Foundation
[12:33:33]
[12:33:38] Topology snapshot [ver=2, locNode=16da55e5, servers=1, clients=1, state=ACTIVE, CPUs=4, offheap=3.1GB, heap=6.8GB]
[12:33:38]   ^-- Baseline [id=0, size=1, online=1, offline=0]
Error: Transactions are not supported. (state=,code=0)
0: jdbc:ignite:cfg://config/default-config.xm> CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);
0: jdbc:ignite:cfg://config/default-config.xm> INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);
0: jdbc:ignite:cfg://config/default-config.xm> ALTER TABLE person DROP COLUMN age;
0: jdbc:ignite:cfg://config/default-config.xm> SELECT * FROM person;
+--------------------------------+--------------------------------+
|               ID               |              NAME              |
+--------------------------------+--------------------------------+
| 1                              | Vassisualy                     |
+--------------------------------+--------------------------------+
1 row selected (0,059 seconds)

Do you have steps to reproduce?

Regards,
--
Ilya Kasnacheev


чт, 3 сент. 2020 г. в 20:46, Shravya Nethula <sh...@aline-consulting.com>>:
Hi,

I have tried "ALTER TABLE PUBLIC.person DROP COLUMN (age)" query as well.
I am getting the same error message.


Regards,

Shravya Nethula,

BigData Developer,

[cid:174bfe19e70fca9f7a62]

Hyderabad.

________________________________
From: Denis Mekhanikov <dm...@gmail.com>>
Sent: Thursday, September 3, 2020 2:17 PM
To: user <us...@ignite.apache.org>>
Subject: Re: Issue in Alter Table - Drop Column functionality

I mean, DROP COLUMN, not DROP TABLE.

Denis

чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>>:
Does the DROP TABLE statement work if you specify the schema name explicitly?
For example, if the table is in the PUBLIC schema, try running the following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)

Denis

ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <sh...@aline-consulting.com>>:
Hi,

When I am trying the following query from GridGain, it works as expected.
ALTER TABLE person DROP COLUMN (age)

But when I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));

Output:
javax.cache.CacheException
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
    at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
    at net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
    at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
    at net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
    at net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: null
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
    at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
    ... 6 more
Caused by: java.lang.NullPointerException
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)
    ... 18 more


On the other hand, ALTER TABLE ADD COLUMN functionality is working in both GridGain and also through thick client Java code.
Why is it so? Is there any parameter or configurations that are missing?
Please kindly let me know if you need any more details regarding the failure scenario.





Regards,

Shravya Nethula,

BigData Developer,

[cid:174bfe19e70676f7b2e1]

Hyderabad.

Re: Issue in Alter Table - Drop Column functionality

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

I think it will be in 2.10 or 2.9.1. Maybe early next year?

Regards,
-- 
Ilya Kasnacheev


чт, 24 сент. 2020 г. в 14:04, Shravya Nethula <
shravya.nethula@aline-consulting.com>:

> Hi Ilya,
>
> Thank you for the confirmation and the workaround is working as expected.
> Much appreciated.
>
> Is there any rough release date or release version for this issue?
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
> ------------------------------
> *From:* Ilya Kasnacheev <il...@gmail.com>
> *Sent:* Thursday, September 24, 2020 3:53 PM
> *To:* user@ignite.apache.org <us...@ignite.apache.org>
> *Subject:* Re: Issue in Alter Table - Drop Column functionality
>
> Hello!
>
> Thank you for this report, now I can indeed confirm I can see the issue! I
> have filed https://issues.apache.org/jira/browse/IGNITE-13482 on your
> behalf.
>
> As a workaround you can do SELECT * FROM tbl LIMIT 0; before issuing ALTER
> TABLE on that node.
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> чт, 24 сент. 2020 г. в 10:41, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
> Hi Ilya,
>
> Yes, the code that you sent is working fine.
>
> But can you please try the below code, by executing CREATE TABLE and ALTER
> TABLE in separate programs. In this scenario, its not working.
> public class ClientNode {
>
>     public static void main(String[] args) {
>         IgniteConfiguration igniteCfg = new IgniteConfiguration();
>         igniteCfg.setClientMode(true);
>
>         Ignite ignite = Ignition.start(igniteCfg);
>         IgniteCache foo = ignite.getOrCreateCache("foo");
>
>         *foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
>         foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));*
>         //foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));
>
>         //System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll());
>
> } }
>
> public class ClientNode {
>     public static void main(String[] args) {
>         IgniteConfiguration igniteCfg = new IgniteConfiguration();
>         igniteCfg.setClientMode(true);
>
>         Ignite ignite = Ignition.start(igniteCfg);
>         IgniteCache foo = ignite.getOrCreateCache("foo");
>
>         //foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
>         //foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
>         *foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));*
>
> *        System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll())*
>
> } }
>
> *This second program is giving the following error:*
> *Exception in thread "main" javax.cache.CacheException*
> at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
> at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
> at
> org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
> at
> net.aline.cloudedh.base.database.extra.ClientNode.main(ClientNode.java:28)
> *Caused by: class
> org.apache.ignite.internal.processors.query.IgniteSQLException: null*
> at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
> at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
> at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
> at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
> at
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
> at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
> ... 3 more
> *Caused by: java.lang.NullPointerException*
> *at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)*
> ... 15 more
>
>
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
> ------------------------------
> *From:* Ilya Kasnacheev <il...@gmail.com>
> *Sent:* Monday, September 21, 2020 3:04 PM
> *To:* user@ignite.apache.org <us...@ignite.apache.org>
> *Subject:* Re: Issue in Alter Table - Drop Column functionality
>
> Hello!
>
> Sqlline can use both thin JDBC and thick JDBC driver. In this case it uses
> thick JDBC driver.
>
> Do you have a reproducer project to demonstrate the issue? I can't get it
> to show up:
>
> public class ClientNode {
>     public static void main(String[] args) {
>         IgniteConfiguration igniteCfg = new IgniteConfiguration();
>         igniteCfg.setClientMode(true);
>
>         Ignite ignite = Ignition.start(igniteCfg);
>         IgniteCache foo = ignite.getOrCreateCache("foo");
>
>         foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
>         foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
>         foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));
>
>         System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll());
>     }
> }
>
>
> gives
>
> [[1, Vassisualy]]
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> пн, 21 сент. 2020 г. в 10:27, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
> Hi Ilya,
>
> sqlLine is also a thin client if I am not wrong!
> From thin clients like GridGain and sqlLine, its working as expected.
>
> It is not working from thick client.
> When I try to execute the same query as a thick client with following Java
> code, its throwing *IgniteSQLException.*
> *Java Code:*
> String sql = "*ALTER TABLE person DROP COLUMN (age)*";
> FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
> ------------------------------
> *From:* Ilya Kasnacheev <il...@gmail.com>
> *Sent:* Tuesday, September 15, 2020 3:07 PM
> *To:* user@ignite.apache.org <us...@ignite.apache.org>
> *Subject:* Re: Issue in Alter Table - Drop Column functionality
>
> Hello!
>
> I have just validated it on 2.8.1. Seems to work!
>
> ~/Downloads/apache-ignite-2.8.1-bin% bin/sqlline.sh
> sqlline version 1.3.0
> sqlline> !connect jdbc:ignite:cfg://config/default-config.xml
> [12:33:33]    __________  ________________
> [12:33:33]   /  _/ ___/ |/ /  _/_  __/ __/
> [12:33:33]  _/ // (7 7    // /  / / / _/
> [12:33:33] /___/\___/_/|_/___/ /_/ /___/
> [12:33:33]
> [12:33:33] ver. 2.8.1#20200521-sha1:86422096
> [12:33:33] 2020 Copyright(C) Apache Software Foundation
> [12:33:33]
> [12:33:38] Topology snapshot [ver=2, locNode=16da55e5, servers=1,
> clients=1, state=ACTIVE, CPUs=4, offheap=3.1GB, heap=6.8GB]
> [12:33:38]   ^-- Baseline [id=0, size=1, online=1, offline=0]
> Error: Transactions are not supported. (state=,code=0)
> 0: jdbc:ignite:cfg://config/default-config.xm> CREATE TABLE person (id INT
> PRIMARY KEY, name VARCHAR, age INT);
> 0: jdbc:ignite:cfg://config/default-config.xm> INSERT INTO person (id,
> name, age) VALUES (1, 'Vassisualy', 45);
> 0: jdbc:ignite:cfg://config/default-config.xm> ALTER TABLE person DROP
> COLUMN age;
> 0: jdbc:ignite:cfg://config/default-config.xm> SELECT * FROM person;
> +--------------------------------+--------------------------------+
> |               ID               |              NAME              |
> +--------------------------------+--------------------------------+
> | 1                              | Vassisualy                     |
> +--------------------------------+--------------------------------+
> 1 row selected (0,059 seconds)
>
> Do you have steps to reproduce?
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> чт, 3 сент. 2020 г. в 20:46, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
> Hi,
>
> I have tried "ALTER TABLE PUBLIC.person DROP COLUMN (age)" query as well.
> I am getting the same error message.
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
> ------------------------------
> *From:* Denis Mekhanikov <dm...@gmail.com>
> *Sent:* Thursday, September 3, 2020 2:17 PM
> *To:* user <us...@ignite.apache.org>
> *Subject:* Re: Issue in Alter Table - Drop Column functionality
>
> I mean, DROP COLUMN, not DROP TABLE.
>
> Denis
>
> чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>:
>
> Does the DROP TABLE statement work if you specify the schema name
> explicitly?
> For example, if the table is in the PUBLIC schema, try running the
> following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)
>
> Denis
>
> ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
> Hi,
>
> When I am trying the following query from GridGain, it works as expected.
> *ALTER TABLE person DROP COLUMN (age)*
>
> But when I try to execute the same query as a thick client with following
> Java code, its throwing * IgniteSQLException.*
> *Java Code:*
> String sql = "*ALTER TABLE person DROP COLUMN (age)*";
> FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));
>
> *Output:*
> *javax.cache.CacheException*
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
>     at
> org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
>     at
> net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
>     at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
>     at
> net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
>     at
> net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
> *Caused by: class
> org.apache.ignite.internal.processors.query.IgniteSQLException: null*
>     at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
>     at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
>     at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
>     at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
>     at
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
>     ... 6 more
> *Caused by: java.lang.NullPointerException*
> *    at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)*
>     ... 18 more
>
>
> On the other hand, ALTER TABLE ADD COLUMN functionality is working in both
> GridGain and also through thick client Java code.
> Why is it so? Is there any parameter or configurations that are missing?
> Please kindly let me know if you need any more details regarding the
> failure scenario.
>
>
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
>

Re: Issue in Alter Table - Drop Column functionality

Posted by Shravya Nethula <sh...@aline-consulting.com>.
Hi Ilya,

Thank you for the confirmation and the workaround is working as expected. Much appreciated.

Is there any rough release date or release version for this issue?



Regards,

Shravya Nethula,

BigData Developer,

[cid:357d40f2-e612-4cef-b899-fb17a36896bb]

Hyderabad.

________________________________
From: Ilya Kasnacheev <il...@gmail.com>
Sent: Thursday, September 24, 2020 3:53 PM
To: user@ignite.apache.org <us...@ignite.apache.org>
Subject: Re: Issue in Alter Table - Drop Column functionality

Hello!

Thank you for this report, now I can indeed confirm I can see the issue! I have filed https://issues.apache.org/jira/browse/IGNITE-13482 on your behalf.

As a workaround you can do SELECT * FROM tbl LIMIT 0; before issuing ALTER TABLE on that node.

Regards,
--
Ilya Kasnacheev


чт, 24 сент. 2020 г. в 10:41, Shravya Nethula <sh...@aline-consulting.com>>:
Hi Ilya,

Yes, the code that you sent is working fine.

But can you please try the below code, by executing CREATE TABLE and ALTER TABLE in separate programs. In this scenario, its not working.
public class ClientNode {

    public static void main(String[] args) {
        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setClientMode(true);

        Ignite ignite = Ignition.start(igniteCfg);
        IgniteCache foo = ignite.getOrCreateCache("foo");

        foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
        foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
        //foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));

        //System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll());

} }

public class ClientNode {
    public static void main(String[] args) {
        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setClientMode(true);

        Ignite ignite = Ignition.start(igniteCfg);
        IgniteCache foo = ignite.getOrCreateCache("foo");

        //foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
        //foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
        foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));

        System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll())

} }

This second program is giving the following error:
Exception in thread "main" javax.cache.CacheException
at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
at net.aline.cloudedh.base.database.extra.ClientNode.main(ClientNode.java:28)
Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: null
at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
... 3 more
Caused by: java.lang.NullPointerException
at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)
... 15 more





Regards,

Shravya Nethula,

BigData Developer,

[cid:174bfa1c3c42d587d5b4]

Hyderabad.

________________________________
From: Ilya Kasnacheev <il...@gmail.com>>
Sent: Monday, September 21, 2020 3:04 PM
To: user@ignite.apache.org<ma...@ignite.apache.org> <us...@ignite.apache.org>>
Subject: Re: Issue in Alter Table - Drop Column functionality

Hello!

Sqlline can use both thin JDBC and thick JDBC driver. In this case it uses thick JDBC driver.

Do you have a reproducer project to demonstrate the issue? I can't get it to show up:


public class ClientNode {
    public static void main(String[] args) {
        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setClientMode(true);

        Ignite ignite = Ignition.start(igniteCfg);
        IgniteCache foo = ignite.getOrCreateCache("foo");

        foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
        foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
        foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));

        System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll());
    }
}

gives

[[1, Vassisualy]]

Regards,
--
Ilya Kasnacheev


пн, 21 сент. 2020 г. в 10:27, Shravya Nethula <sh...@aline-consulting.com>>:
Hi Ilya,

sqlLine is also a thin client if I am not wrong!
From thin clients like GridGain and sqlLine, its working as expected.

It is not working from thick client.
When I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));



Regards,

Shravya Nethula,

BigData Developer,

[cid:174bfa1c3c4ccd59d663]

Hyderabad.

________________________________
From: Ilya Kasnacheev <il...@gmail.com>>
Sent: Tuesday, September 15, 2020 3:07 PM
To: user@ignite.apache.org<ma...@ignite.apache.org> <us...@ignite.apache.org>>
Subject: Re: Issue in Alter Table - Drop Column functionality

Hello!

I have just validated it on 2.8.1. Seems to work!

~/Downloads/apache-ignite-2.8.1-bin% bin/sqlline.sh
sqlline version 1.3.0
sqlline> !connect jdbc:ignite:cfg://config/default-config.xml
[12:33:33]    __________  ________________
[12:33:33]   /  _/ ___/ |/ /  _/_  __/ __/
[12:33:33]  _/ // (7 7    // /  / / / _/
[12:33:33] /___/\___/_/|_/___/ /_/ /___/
[12:33:33]
[12:33:33] ver. 2.8.1#20200521-sha1:86422096
[12:33:33] 2020 Copyright(C) Apache Software Foundation
[12:33:33]
[12:33:38] Topology snapshot [ver=2, locNode=16da55e5, servers=1, clients=1, state=ACTIVE, CPUs=4, offheap=3.1GB, heap=6.8GB]
[12:33:38]   ^-- Baseline [id=0, size=1, online=1, offline=0]
Error: Transactions are not supported. (state=,code=0)
0: jdbc:ignite:cfg://config/default-config.xm> CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);
0: jdbc:ignite:cfg://config/default-config.xm> INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);
0: jdbc:ignite:cfg://config/default-config.xm> ALTER TABLE person DROP COLUMN age;
0: jdbc:ignite:cfg://config/default-config.xm> SELECT * FROM person;
+--------------------------------+--------------------------------+
|               ID               |              NAME              |
+--------------------------------+--------------------------------+
| 1                              | Vassisualy                     |
+--------------------------------+--------------------------------+
1 row selected (0,059 seconds)

Do you have steps to reproduce?

Regards,
--
Ilya Kasnacheev


чт, 3 сент. 2020 г. в 20:46, Shravya Nethula <sh...@aline-consulting.com>>:
Hi,

I have tried "ALTER TABLE PUBLIC.person DROP COLUMN (age)" query as well.
I am getting the same error message.


Regards,

Shravya Nethula,

BigData Developer,

[cid:174bfa1c3c3fca9f7a62]

Hyderabad.

________________________________
From: Denis Mekhanikov <dm...@gmail.com>>
Sent: Thursday, September 3, 2020 2:17 PM
To: user <us...@ignite.apache.org>>
Subject: Re: Issue in Alter Table - Drop Column functionality

I mean, DROP COLUMN, not DROP TABLE.

Denis

чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>>:
Does the DROP TABLE statement work if you specify the schema name explicitly?
For example, if the table is in the PUBLIC schema, try running the following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)

Denis

ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <sh...@aline-consulting.com>>:
Hi,

When I am trying the following query from GridGain, it works as expected.
ALTER TABLE person DROP COLUMN (age)

But when I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));

Output:
javax.cache.CacheException
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
    at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
    at net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
    at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
    at net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
    at net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: null
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
    at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
    ... 6 more
Caused by: java.lang.NullPointerException
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)
    ... 18 more


On the other hand, ALTER TABLE ADD COLUMN functionality is working in both GridGain and also through thick client Java code.
Why is it so? Is there any parameter or configurations that are missing?
Please kindly let me know if you need any more details regarding the failure scenario.





Regards,

Shravya Nethula,

BigData Developer,

[cid:174bfa1c3c3676f7b2e1]

Hyderabad.

Re: Issue in Alter Table - Drop Column functionality

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Thank you for this report, now I can indeed confirm I can see the issue! I
have filed https://issues.apache.org/jira/browse/IGNITE-13482 on your
behalf.

As a workaround you can do SELECT * FROM tbl LIMIT 0; before issuing ALTER
TABLE on that node.

Regards,
-- 
Ilya Kasnacheev


чт, 24 сент. 2020 г. в 10:41, Shravya Nethula <
shravya.nethula@aline-consulting.com>:

> Hi Ilya,
>
> Yes, the code that you sent is working fine.
>
> But can you please try the below code, by executing CREATE TABLE and ALTER
> TABLE in separate programs. In this scenario, its not working.
> public class ClientNode {
>
>     public static void main(String[] args) {
>         IgniteConfiguration igniteCfg = new IgniteConfiguration();
>         igniteCfg.setClientMode(true);
>
>         Ignite ignite = Ignition.start(igniteCfg);
>         IgniteCache foo = ignite.getOrCreateCache("foo");
>
>         *foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
>         foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));*
>         //foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));
>
>         //System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll());
>
> } }
>
> public class ClientNode {
>     public static void main(String[] args) {
>         IgniteConfiguration igniteCfg = new IgniteConfiguration();
>         igniteCfg.setClientMode(true);
>
>         Ignite ignite = Ignition.start(igniteCfg);
>         IgniteCache foo = ignite.getOrCreateCache("foo");
>
>         //foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
>         //foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
>         *foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));*
>
> *        System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll())*
>
> } }
>
> *This second program is giving the following error:*
> *Exception in thread "main" javax.cache.CacheException*
> at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
> at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
> at
> org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
> at
> net.aline.cloudedh.base.database.extra.ClientNode.main(ClientNode.java:28)
> *Caused by: class
> org.apache.ignite.internal.processors.query.IgniteSQLException: null*
> at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
> at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
> at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
> at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
> at
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
> at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
> at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
> ... 3 more
> *Caused by: java.lang.NullPointerException*
> *at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)*
> ... 15 more
>
>
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
> ------------------------------
> *From:* Ilya Kasnacheev <il...@gmail.com>
> *Sent:* Monday, September 21, 2020 3:04 PM
> *To:* user@ignite.apache.org <us...@ignite.apache.org>
> *Subject:* Re: Issue in Alter Table - Drop Column functionality
>
> Hello!
>
> Sqlline can use both thin JDBC and thick JDBC driver. In this case it uses
> thick JDBC driver.
>
> Do you have a reproducer project to demonstrate the issue? I can't get it
> to show up:
>
> public class ClientNode {
>     public static void main(String[] args) {
>         IgniteConfiguration igniteCfg = new IgniteConfiguration();
>         igniteCfg.setClientMode(true);
>
>         Ignite ignite = Ignition.start(igniteCfg);
>         IgniteCache foo = ignite.getOrCreateCache("foo");
>
>         foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
>         foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
>         foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));
>
>         System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll());
>     }
> }
>
>
> gives
>
> [[1, Vassisualy]]
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> пн, 21 сент. 2020 г. в 10:27, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
> Hi Ilya,
>
> sqlLine is also a thin client if I am not wrong!
> From thin clients like GridGain and sqlLine, its working as expected.
>
> It is not working from thick client.
> When I try to execute the same query as a thick client with following Java
> code, its throwing *IgniteSQLException.*
> *Java Code:*
> String sql = "*ALTER TABLE person DROP COLUMN (age)*";
> FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
> ------------------------------
> *From:* Ilya Kasnacheev <il...@gmail.com>
> *Sent:* Tuesday, September 15, 2020 3:07 PM
> *To:* user@ignite.apache.org <us...@ignite.apache.org>
> *Subject:* Re: Issue in Alter Table - Drop Column functionality
>
> Hello!
>
> I have just validated it on 2.8.1. Seems to work!
>
> ~/Downloads/apache-ignite-2.8.1-bin% bin/sqlline.sh
> sqlline version 1.3.0
> sqlline> !connect jdbc:ignite:cfg://config/default-config.xml
> [12:33:33]    __________  ________________
> [12:33:33]   /  _/ ___/ |/ /  _/_  __/ __/
> [12:33:33]  _/ // (7 7    // /  / / / _/
> [12:33:33] /___/\___/_/|_/___/ /_/ /___/
> [12:33:33]
> [12:33:33] ver. 2.8.1#20200521-sha1:86422096
> [12:33:33] 2020 Copyright(C) Apache Software Foundation
> [12:33:33]
> [12:33:38] Topology snapshot [ver=2, locNode=16da55e5, servers=1,
> clients=1, state=ACTIVE, CPUs=4, offheap=3.1GB, heap=6.8GB]
> [12:33:38]   ^-- Baseline [id=0, size=1, online=1, offline=0]
> Error: Transactions are not supported. (state=,code=0)
> 0: jdbc:ignite:cfg://config/default-config.xm> CREATE TABLE person (id INT
> PRIMARY KEY, name VARCHAR, age INT);
> 0: jdbc:ignite:cfg://config/default-config.xm> INSERT INTO person (id,
> name, age) VALUES (1, 'Vassisualy', 45);
> 0: jdbc:ignite:cfg://config/default-config.xm> ALTER TABLE person DROP
> COLUMN age;
> 0: jdbc:ignite:cfg://config/default-config.xm> SELECT * FROM person;
> +--------------------------------+--------------------------------+
> |               ID               |              NAME              |
> +--------------------------------+--------------------------------+
> | 1                              | Vassisualy                     |
> +--------------------------------+--------------------------------+
> 1 row selected (0,059 seconds)
>
> Do you have steps to reproduce?
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> чт, 3 сент. 2020 г. в 20:46, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
> Hi,
>
> I have tried "ALTER TABLE PUBLIC.person DROP COLUMN (age)" query as well.
> I am getting the same error message.
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
> ------------------------------
> *From:* Denis Mekhanikov <dm...@gmail.com>
> *Sent:* Thursday, September 3, 2020 2:17 PM
> *To:* user <us...@ignite.apache.org>
> *Subject:* Re: Issue in Alter Table - Drop Column functionality
>
> I mean, DROP COLUMN, not DROP TABLE.
>
> Denis
>
> чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>:
>
> Does the DROP TABLE statement work if you specify the schema name
> explicitly?
> For example, if the table is in the PUBLIC schema, try running the
> following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)
>
> Denis
>
> ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
> Hi,
>
> When I am trying the following query from GridGain, it works as expected.
> *ALTER TABLE person DROP COLUMN (age)*
>
> But when I try to execute the same query as a thick client with following
> Java code, its throwing * IgniteSQLException.*
> *Java Code:*
> String sql = "*ALTER TABLE person DROP COLUMN (age)*";
> FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));
>
> *Output:*
> *javax.cache.CacheException*
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
>     at
> org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
>     at
> net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
>     at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
>     at
> net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
>     at
> net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
> *Caused by: class
> org.apache.ignite.internal.processors.query.IgniteSQLException: null*
>     at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
>     at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
>     at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
>     at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
>     at
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
>     ... 6 more
> *Caused by: java.lang.NullPointerException*
> *    at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)*
>     ... 18 more
>
>
> On the other hand, ALTER TABLE ADD COLUMN functionality is working in both
> GridGain and also through thick client Java code.
> Why is it so? Is there any parameter or configurations that are missing?
> Please kindly let me know if you need any more details regarding the
> failure scenario.
>
>
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
>

Re: Issue in Alter Table - Drop Column functionality

Posted by Shravya Nethula <sh...@aline-consulting.com>.
Hi Ilya,

Yes, the code that you sent is working fine.

But can you please try the below code, by executing CREATE TABLE and ALTER TABLE in separate programs. In this scenario, its not working.
public class ClientNode {

    public static void main(String[] args) {
        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setClientMode(true);

        Ignite ignite = Ignition.start(igniteCfg);
        IgniteCache foo = ignite.getOrCreateCache("foo");

        foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
        foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
        //foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));

        //System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll());

} }

public class ClientNode {
    public static void main(String[] args) {
        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setClientMode(true);

        Ignite ignite = Ignition.start(igniteCfg);
        IgniteCache foo = ignite.getOrCreateCache("foo");

        //foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
        //foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
        foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));

        System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll())

} }

This second program is giving the following error:
Exception in thread "main" javax.cache.CacheException
at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
at net.aline.cloudedh.base.database.extra.ClientNode.main(ClientNode.java:28)
Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: null
at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
... 3 more
Caused by: java.lang.NullPointerException
at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)
... 15 more





Regards,

Shravya Nethula,

BigData Developer,

[cid:377ac046-a8f4-47d0-b6d7-74fce693a1d0]

Hyderabad.

________________________________
From: Ilya Kasnacheev <il...@gmail.com>
Sent: Monday, September 21, 2020 3:04 PM
To: user@ignite.apache.org <us...@ignite.apache.org>
Subject: Re: Issue in Alter Table - Drop Column functionality

Hello!

Sqlline can use both thin JDBC and thick JDBC driver. In this case it uses thick JDBC driver.

Do you have a reproducer project to demonstrate the issue? I can't get it to show up:


public class ClientNode {
    public static void main(String[] args) {
        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setClientMode(true);

        Ignite ignite = Ignition.start(igniteCfg);
        IgniteCache foo = ignite.getOrCreateCache("foo");

        foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);"));
        foo.query(new SqlFieldsQuery("INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);"));
        foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));

        System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM person;")).getAll());
    }
}

gives

[[1, Vassisualy]]

Regards,
--
Ilya Kasnacheev


пн, 21 сент. 2020 г. в 10:27, Shravya Nethula <sh...@aline-consulting.com>>:
Hi Ilya,

sqlLine is also a thin client if I am not wrong!
From thin clients like GridGain and sqlLine, its working as expected.

It is not working from thick client.
When I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));



Regards,

Shravya Nethula,

BigData Developer,

[cid:174aff8c692ccd59d663]

Hyderabad.

________________________________
From: Ilya Kasnacheev <il...@gmail.com>>
Sent: Tuesday, September 15, 2020 3:07 PM
To: user@ignite.apache.org<ma...@ignite.apache.org> <us...@ignite.apache.org>>
Subject: Re: Issue in Alter Table - Drop Column functionality

Hello!

I have just validated it on 2.8.1. Seems to work!

~/Downloads/apache-ignite-2.8.1-bin% bin/sqlline.sh
sqlline version 1.3.0
sqlline> !connect jdbc:ignite:cfg://config/default-config.xml
[12:33:33]    __________  ________________
[12:33:33]   /  _/ ___/ |/ /  _/_  __/ __/
[12:33:33]  _/ // (7 7    // /  / / / _/
[12:33:33] /___/\___/_/|_/___/ /_/ /___/
[12:33:33]
[12:33:33] ver. 2.8.1#20200521-sha1:86422096
[12:33:33] 2020 Copyright(C) Apache Software Foundation
[12:33:33]
[12:33:38] Topology snapshot [ver=2, locNode=16da55e5, servers=1, clients=1, state=ACTIVE, CPUs=4, offheap=3.1GB, heap=6.8GB]
[12:33:38]   ^-- Baseline [id=0, size=1, online=1, offline=0]
Error: Transactions are not supported. (state=,code=0)
0: jdbc:ignite:cfg://config/default-config.xm> CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);
0: jdbc:ignite:cfg://config/default-config.xm> INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);
0: jdbc:ignite:cfg://config/default-config.xm> ALTER TABLE person DROP COLUMN age;
0: jdbc:ignite:cfg://config/default-config.xm> SELECT * FROM person;
+--------------------------------+--------------------------------+
|               ID               |              NAME              |
+--------------------------------+--------------------------------+
| 1                              | Vassisualy                     |
+--------------------------------+--------------------------------+
1 row selected (0,059 seconds)

Do you have steps to reproduce?

Regards,
--
Ilya Kasnacheev


чт, 3 сент. 2020 г. в 20:46, Shravya Nethula <sh...@aline-consulting.com>>:
Hi,

I have tried "ALTER TABLE PUBLIC.person DROP COLUMN (age)" query as well.
I am getting the same error message.


Regards,

Shravya Nethula,

BigData Developer,

[cid:174aff8c691fca9f7a62]

Hyderabad.

________________________________
From: Denis Mekhanikov <dm...@gmail.com>>
Sent: Thursday, September 3, 2020 2:17 PM
To: user <us...@ignite.apache.org>>
Subject: Re: Issue in Alter Table - Drop Column functionality

I mean, DROP COLUMN, not DROP TABLE.

Denis

чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>>:
Does the DROP TABLE statement work if you specify the schema name explicitly?
For example, if the table is in the PUBLIC schema, try running the following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)

Denis

ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <sh...@aline-consulting.com>>:
Hi,

When I am trying the following query from GridGain, it works as expected.
ALTER TABLE person DROP COLUMN (age)

But when I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));

Output:
javax.cache.CacheException
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
    at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
    at net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
    at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
    at net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
    at net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: null
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
    at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
    ... 6 more
Caused by: java.lang.NullPointerException
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)
    ... 18 more


On the other hand, ALTER TABLE ADD COLUMN functionality is working in both GridGain and also through thick client Java code.
Why is it so? Is there any parameter or configurations that are missing?
Please kindly let me know if you need any more details regarding the failure scenario.





Regards,

Shravya Nethula,

BigData Developer,

[cid:174aff8c690676f7b2e1]

Hyderabad.

Re: Issue in Alter Table - Drop Column functionality

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Sqlline can use both thin JDBC and thick JDBC driver. In this case it uses
thick JDBC driver.

Do you have a reproducer project to demonstrate the issue? I can't get it
to show up:

public class ClientNode {
    public static void main(String[] args) {
        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setClientMode(true);

        Ignite ignite = Ignition.start(igniteCfg);
        IgniteCache foo = ignite.getOrCreateCache("foo");

        foo.query(new SqlFieldsQuery("CREATE TABLE person (id INT
PRIMARY KEY, name VARCHAR, age INT);"));
        foo.query(new SqlFieldsQuery("INSERT INTO person (id, name,
age) VALUES (1, 'Vassisualy', 45);"));
        foo.query(new SqlFieldsQuery("ALTER TABLE person DROP COLUMN (age);"));

        System.err.println(foo.query(new SqlFieldsQuery("SELECT * FROM
person;")).getAll());
    }
}


gives

[[1, Vassisualy]]

Regards,
-- 
Ilya Kasnacheev


пн, 21 сент. 2020 г. в 10:27, Shravya Nethula <
shravya.nethula@aline-consulting.com>:

> Hi Ilya,
>
> sqlLine is also a thin client if I am not wrong!
> From thin clients like GridGain and sqlLine, its working as expected.
>
> It is not working from thick client.
> When I try to execute the same query as a thick client with following Java
> code, its throwing *IgniteSQLException.*
> *Java Code:*
> String sql = "*ALTER TABLE person DROP COLUMN (age)*";
> FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
> ------------------------------
> *From:* Ilya Kasnacheev <il...@gmail.com>
> *Sent:* Tuesday, September 15, 2020 3:07 PM
> *To:* user@ignite.apache.org <us...@ignite.apache.org>
> *Subject:* Re: Issue in Alter Table - Drop Column functionality
>
> Hello!
>
> I have just validated it on 2.8.1. Seems to work!
>
> ~/Downloads/apache-ignite-2.8.1-bin% bin/sqlline.sh
> sqlline version 1.3.0
> sqlline> !connect jdbc:ignite:cfg://config/default-config.xml
> [12:33:33]    __________  ________________
> [12:33:33]   /  _/ ___/ |/ /  _/_  __/ __/
> [12:33:33]  _/ // (7 7    // /  / / / _/
> [12:33:33] /___/\___/_/|_/___/ /_/ /___/
> [12:33:33]
> [12:33:33] ver. 2.8.1#20200521-sha1:86422096
> [12:33:33] 2020 Copyright(C) Apache Software Foundation
> [12:33:33]
> [12:33:38] Topology snapshot [ver=2, locNode=16da55e5, servers=1,
> clients=1, state=ACTIVE, CPUs=4, offheap=3.1GB, heap=6.8GB]
> [12:33:38]   ^-- Baseline [id=0, size=1, online=1, offline=0]
> Error: Transactions are not supported. (state=,code=0)
> 0: jdbc:ignite:cfg://config/default-config.xm> CREATE TABLE person (id INT
> PRIMARY KEY, name VARCHAR, age INT);
> 0: jdbc:ignite:cfg://config/default-config.xm> INSERT INTO person (id,
> name, age) VALUES (1, 'Vassisualy', 45);
> 0: jdbc:ignite:cfg://config/default-config.xm> ALTER TABLE person DROP
> COLUMN age;
> 0: jdbc:ignite:cfg://config/default-config.xm> SELECT * FROM person;
> +--------------------------------+--------------------------------+
> |               ID               |              NAME              |
> +--------------------------------+--------------------------------+
> | 1                              | Vassisualy                     |
> +--------------------------------+--------------------------------+
> 1 row selected (0,059 seconds)
>
> Do you have steps to reproduce?
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> чт, 3 сент. 2020 г. в 20:46, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
> Hi,
>
> I have tried "ALTER TABLE PUBLIC.person DROP COLUMN (age)" query as well.
> I am getting the same error message.
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
> ------------------------------
> *From:* Denis Mekhanikov <dm...@gmail.com>
> *Sent:* Thursday, September 3, 2020 2:17 PM
> *To:* user <us...@ignite.apache.org>
> *Subject:* Re: Issue in Alter Table - Drop Column functionality
>
> I mean, DROP COLUMN, not DROP TABLE.
>
> Denis
>
> чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>:
>
> Does the DROP TABLE statement work if you specify the schema name
> explicitly?
> For example, if the table is in the PUBLIC schema, try running the
> following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)
>
> Denis
>
> ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
> Hi,
>
> When I am trying the following query from GridGain, it works as expected.
> *ALTER TABLE person DROP COLUMN (age)*
>
> But when I try to execute the same query as a thick client with following
> Java code, its throwing * IgniteSQLException.*
> *Java Code:*
> String sql = "*ALTER TABLE person DROP COLUMN (age)*";
> FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));
>
> *Output:*
> *javax.cache.CacheException*
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
>     at
> org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
>     at
> net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
>     at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
>     at
> net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
>     at
> net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
> *Caused by: class
> org.apache.ignite.internal.processors.query.IgniteSQLException: null*
>     at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
>     at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
>     at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
>     at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
>     at
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
>     ... 6 more
> *Caused by: java.lang.NullPointerException*
> *    at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)*
>     ... 18 more
>
>
> On the other hand, ALTER TABLE ADD COLUMN functionality is working in both
> GridGain and also through thick client Java code.
> Why is it so? Is there any parameter or configurations that are missing?
> Please kindly let me know if you need any more details regarding the
> failure scenario.
>
>
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
>

Re: Issue in Alter Table - Drop Column functionality

Posted by Shravya Nethula <sh...@aline-consulting.com>.
Hi Ilya,

sqlLine is also a thin client if I am not wrong!
From thin clients like GridGain and sqlLine, its working as expected.

It is not working from thick client.
When I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));



Regards,

Shravya Nethula,

BigData Developer,

[cid:b616dee9-4b10-4059-a473-8cc8c4fc7342]

Hyderabad.

________________________________
From: Ilya Kasnacheev <il...@gmail.com>
Sent: Tuesday, September 15, 2020 3:07 PM
To: user@ignite.apache.org <us...@ignite.apache.org>
Subject: Re: Issue in Alter Table - Drop Column functionality

Hello!

I have just validated it on 2.8.1. Seems to work!

~/Downloads/apache-ignite-2.8.1-bin% bin/sqlline.sh
sqlline version 1.3.0
sqlline> !connect jdbc:ignite:cfg://config/default-config.xml
[12:33:33]    __________  ________________
[12:33:33]   /  _/ ___/ |/ /  _/_  __/ __/
[12:33:33]  _/ // (7 7    // /  / / / _/
[12:33:33] /___/\___/_/|_/___/ /_/ /___/
[12:33:33]
[12:33:33] ver. 2.8.1#20200521-sha1:86422096
[12:33:33] 2020 Copyright(C) Apache Software Foundation
[12:33:33]
[12:33:38] Topology snapshot [ver=2, locNode=16da55e5, servers=1, clients=1, state=ACTIVE, CPUs=4, offheap=3.1GB, heap=6.8GB]
[12:33:38]   ^-- Baseline [id=0, size=1, online=1, offline=0]
Error: Transactions are not supported. (state=,code=0)
0: jdbc:ignite:cfg://config/default-config.xm> CREATE TABLE person (id INT PRIMARY KEY, name VARCHAR, age INT);
0: jdbc:ignite:cfg://config/default-config.xm> INSERT INTO person (id, name, age) VALUES (1, 'Vassisualy', 45);
0: jdbc:ignite:cfg://config/default-config.xm> ALTER TABLE person DROP COLUMN age;
0: jdbc:ignite:cfg://config/default-config.xm> SELECT * FROM person;
+--------------------------------+--------------------------------+
|               ID               |              NAME              |
+--------------------------------+--------------------------------+
| 1                              | Vassisualy                     |
+--------------------------------+--------------------------------+
1 row selected (0,059 seconds)

Do you have steps to reproduce?

Regards,
--
Ilya Kasnacheev


чт, 3 сент. 2020 г. в 20:46, Shravya Nethula <sh...@aline-consulting.com>>:
Hi,

I have tried "ALTER TABLE PUBLIC.person DROP COLUMN (age)" query as well.
I am getting the same error message.


Regards,

Shravya Nethula,

BigData Developer,

[cid:174911e79b1fca9f7a62]

Hyderabad.

________________________________
From: Denis Mekhanikov <dm...@gmail.com>>
Sent: Thursday, September 3, 2020 2:17 PM
To: user <us...@ignite.apache.org>>
Subject: Re: Issue in Alter Table - Drop Column functionality

I mean, DROP COLUMN, not DROP TABLE.

Denis

чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>>:
Does the DROP TABLE statement work if you specify the schema name explicitly?
For example, if the table is in the PUBLIC schema, try running the following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)

Denis

ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <sh...@aline-consulting.com>>:
Hi,

When I am trying the following query from GridGain, it works as expected.
ALTER TABLE person DROP COLUMN (age)

But when I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));

Output:
javax.cache.CacheException
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
    at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
    at net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
    at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
    at net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
    at net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: null
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
    at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
    ... 6 more
Caused by: java.lang.NullPointerException
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)
    ... 18 more


On the other hand, ALTER TABLE ADD COLUMN functionality is working in both GridGain and also through thick client Java code.
Why is it so? Is there any parameter or configurations that are missing?
Please kindly let me know if you need any more details regarding the failure scenario.





Regards,

Shravya Nethula,

BigData Developer,

[cid:174911e79b0676f7b2e1]

Hyderabad.

Re: Issue in Alter Table - Drop Column functionality

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

I have just validated it on 2.8.1. Seems to work!

~/Downloads/apache-ignite-2.8.1-bin% bin/sqlline.sh
sqlline version 1.3.0
sqlline> !connect jdbc:ignite:cfg://config/default-config.xml
[12:33:33]    __________  ________________
[12:33:33]   /  _/ ___/ |/ /  _/_  __/ __/
[12:33:33]  _/ // (7 7    // /  / / / _/
[12:33:33] /___/\___/_/|_/___/ /_/ /___/
[12:33:33]
[12:33:33] ver. 2.8.1#20200521-sha1:86422096
[12:33:33] 2020 Copyright(C) Apache Software Foundation
[12:33:33]
[12:33:38] Topology snapshot [ver=2, locNode=16da55e5, servers=1,
clients=1, state=ACTIVE, CPUs=4, offheap=3.1GB, heap=6.8GB]
[12:33:38]   ^-- Baseline [id=0, size=1, online=1, offline=0]
Error: Transactions are not supported. (state=,code=0)
0: jdbc:ignite:cfg://config/default-config.xm> CREATE TABLE person (id INT
PRIMARY KEY, name VARCHAR, age INT);
0: jdbc:ignite:cfg://config/default-config.xm> INSERT INTO person (id,
name, age) VALUES (1, 'Vassisualy', 45);
0: jdbc:ignite:cfg://config/default-config.xm> ALTER TABLE person DROP
COLUMN age;
0: jdbc:ignite:cfg://config/default-config.xm> SELECT * FROM person;
+--------------------------------+--------------------------------+
|               ID               |              NAME              |
+--------------------------------+--------------------------------+
| 1                              | Vassisualy                     |
+--------------------------------+--------------------------------+
1 row selected (0,059 seconds)

Do you have steps to reproduce?

Regards,
-- 
Ilya Kasnacheev


чт, 3 сент. 2020 г. в 20:46, Shravya Nethula <
shravya.nethula@aline-consulting.com>:

> Hi,
>
> I have tried "ALTER TABLE PUBLIC.person DROP COLUMN (age)" query as well.
> I am getting the same error message.
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
> ------------------------------
> *From:* Denis Mekhanikov <dm...@gmail.com>
> *Sent:* Thursday, September 3, 2020 2:17 PM
> *To:* user <us...@ignite.apache.org>
> *Subject:* Re: Issue in Alter Table - Drop Column functionality
>
> I mean, DROP COLUMN, not DROP TABLE.
>
> Denis
>
> чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>:
>
> Does the DROP TABLE statement work if you specify the schema name
> explicitly?
> For example, if the table is in the PUBLIC schema, try running the
> following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)
>
> Denis
>
> ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
> Hi,
>
> When I am trying the following query from GridGain, it works as expected.
> *ALTER TABLE person DROP COLUMN (age)*
>
> But when I try to execute the same query as a thick client with following
> Java code, its throwing * IgniteSQLException.*
> *Java Code:*
> String sql = "*ALTER TABLE person DROP COLUMN (age)*";
> FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));
>
> *Output:*
> *javax.cache.CacheException*
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
>     at
> org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
>     at
> net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
>     at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
>     at
> net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
>     at
> net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
> *Caused by: class
> org.apache.ignite.internal.processors.query.IgniteSQLException: null*
>     at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
>     at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
>     at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
>     at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
>     at
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
>     ... 6 more
> *Caused by: java.lang.NullPointerException*
> *    at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)*
>     ... 18 more
>
>
> On the other hand, ALTER TABLE ADD COLUMN functionality is working in both
> GridGain and also through thick client Java code.
> Why is it so? Is there any parameter or configurations that are missing?
> Please kindly let me know if you need any more details regarding the
> failure scenario.
>
>
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
>

Re: Issue in Alter Table - Drop Column functionality

Posted by Shravya Nethula <sh...@aline-consulting.com>.
Hi,

I have tried "ALTER TABLE PUBLIC.person DROP COLUMN (age)" query as well.
I am getting the same error message.


Regards,

Shravya Nethula,

BigData Developer,

[cid:d1e7061d-22a5-4a9b-a80b-53eeae872f21]

Hyderabad.

________________________________
From: Denis Mekhanikov <dm...@gmail.com>
Sent: Thursday, September 3, 2020 2:17 PM
To: user <us...@ignite.apache.org>
Subject: Re: Issue in Alter Table - Drop Column functionality

I mean, DROP COLUMN, not DROP TABLE.

Denis

чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>>:
Does the DROP TABLE statement work if you specify the schema name explicitly?
For example, if the table is in the PUBLIC schema, try running the following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)

Denis

ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <sh...@aline-consulting.com>>:
Hi,

When I am trying the following query from GridGain, it works as expected.
ALTER TABLE person DROP COLUMN (age)

But when I try to execute the same query as a thick client with following Java code, its throwing IgniteSQLException.
Java Code:
String sql = "ALTER TABLE person DROP COLUMN (age)";
FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));

Output:
javax.cache.CacheException
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
    at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
    at net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
    at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
    at net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
    at net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: null
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
    at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
    ... 6 more
Caused by: java.lang.NullPointerException
    at org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)
    ... 18 more


On the other hand, ALTER TABLE ADD COLUMN functionality is working in both GridGain and also through thick client Java code.
Why is it so? Is there any parameter or configurations that are missing?
Please kindly let me know if you need any more details regarding the failure scenario.





Regards,

Shravya Nethula,

BigData Developer,

[cid:17453219a79676f7b2e1]

Hyderabad.

Re: Issue in Alter Table - Drop Column functionality

Posted by Denis Mekhanikov <dm...@gmail.com>.
I mean, DROP COLUMN, not DROP TABLE.

Denis

чт, 3 сент. 2020 г. в 11:46, Denis Mekhanikov <dm...@gmail.com>:

> Does the DROP TABLE statement work if you specify the schema name
> explicitly?
> For example, if the table is in the PUBLIC schema, try running the
> following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)
>
> Denis
>
> ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <
> shravya.nethula@aline-consulting.com>:
>
>> Hi,
>>
>> When I am trying the following query from GridGain, it works as expected.
>> *ALTER TABLE person DROP COLUMN (age)*
>>
>> But when I try to execute the same query as a thick client with following
>> Java code, its throwing * IgniteSQLException.*
>> *Java Code:*
>> String sql = "*ALTER TABLE person DROP COLUMN (age)*";
>> FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));
>>
>> *Output:*
>> *javax.cache.CacheException*
>>     at
>> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
>>     at
>> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
>>     at
>> org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
>>     at
>> net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
>>     at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
>>     at
>> net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
>>     at
>> net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
>> *Caused by: class
>> org.apache.ignite.internal.processors.query.IgniteSQLException: null*
>>     at
>> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
>>     at
>> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
>>     at
>> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
>>     at
>> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
>>     at
>> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
>>     at
>> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
>>     at
>> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
>>     at
>> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
>>     at
>> org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
>>     at
>> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
>>     at
>> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
>>     at
>> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
>>     at
>> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
>>     ... 6 more
>> *Caused by: java.lang.NullPointerException*
>> *    at
>> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)*
>>     ... 18 more
>>
>>
>> On the other hand, ALTER TABLE ADD COLUMN functionality is working in
>> both GridGain and also through thick client Java code.
>> Why is it so? Is there any parameter or configurations that are missing?
>> Please kindly let me know if you need any more details regarding the
>> failure scenario.
>>
>>
>>
>>
>> Regards,
>>
>> Shravya Nethula,
>>
>> BigData Developer,
>>
>>
>> Hyderabad.
>>
>>

Re: Issue in Alter Table - Drop Column functionality

Posted by Denis Mekhanikov <dm...@gmail.com>.
Does the DROP TABLE statement work if you specify the schema name
explicitly?
For example, if the table is in the PUBLIC schema, try running the
following query: ALTER TABLE PUBLIC.person DROP COLUMN (age)

Denis

ср, 2 сент. 2020 г. в 20:27, Shravya Nethula <
shravya.nethula@aline-consulting.com>:

> Hi,
>
> When I am trying the following query from GridGain, it works as expected.
> *ALTER TABLE person DROP COLUMN (age)*
>
> But when I try to execute the same query as a thick client with following
> Java code, its throwing * IgniteSQLException.*
> *Java Code:*
> String sql = "*ALTER TABLE person DROP COLUMN (age)*";
> FieldsQueryCursor cursor = cache.query(new SqlFieldsQuery(sql));
>
> *Output:*
> *javax.cache.CacheException*
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:817)
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:750)
>     at
> org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.query(GatewayProtectedCacheProxy.java:424)
>     at
> net.aline.cloudedh.base.database.IgniteTable._alterTable(IgniteTable.java:138)
>     at net.aline.cloudedh.base.database.BigTable.alter(BigTable.java:697)
>     at
> net.aline.cloudedh.base.framework.DACEngine.alterTable(DACEngine.java:1015)
>     at
> net.aline.cloudedh.base.framework.DACOperationsTest.main(DACOperationsTest.java:89)
> *Caused by: class
> org.apache.ignite.internal.processors.query.IgniteSQLException: null*
>     at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:888)
>     at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommand(CommandProcessor.java:418)
>     at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeCommand(IgniteH2Indexing.java:1048)
>     at
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1130)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
>     at
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
>     at
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2323)
>     at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.query(IgniteCacheProxyImpl.java:802)
>     ... 6 more
> *Caused by: java.lang.NullPointerException*
> *    at
> org.apache.ignite.internal.processors.query.h2.CommandProcessor.runCommandH2(CommandProcessor.java:834)*
>     ... 18 more
>
>
> On the other hand, ALTER TABLE ADD COLUMN functionality is working in both
> GridGain and also through thick client Java code.
> Why is it so? Is there any parameter or configurations that are missing?
> Please kindly let me know if you need any more details regarding the
> failure scenario.
>
>
>
>
> Regards,
>
> Shravya Nethula,
>
> BigData Developer,
>
>
> Hyderabad.
>
>