Re: Failed to Scan query data by partition index after insert data using DML

2021-05-13 Thread Ilya Kasnacheev
Hello!

You need to either use .withKeepBinary(), or provide a Java class with same
fields as your table value has, so that it can be natively mapped.

Please see
https://www.gridgain.com/docs/latest/developers-guide/SQL/sql-key-value-storage

Regards,
-- 
Ilya Kasnacheev


сб, 8 мая 2021 г. в 03:02, Henric :

> Hi,
> Thanks for replay
> I tried to used cache_name, but I still get Exception as below, I have
> specify the cache name, I don't know why I still get this error.
> I tried to set WRAP_VALUE to false, but it only works for single column.
> Did I miss something important?
>
> Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException:
> SQL_PUBLIC_CITY_5c1c4ecf_745a_4a99_bfbf_fde6de0bc215
> at
>
> org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:689)
> at
>
> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1757)
> at
>
> org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1716)
> at
>
> org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:796)
> at
>
> org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:142)
> at
>
> org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinary(CacheObjectUtils.java:176)
> at
>
> org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinaryIfNeeded(CacheObjectUtils.java:62)
> at
>
> org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinariesIfNeeded(CacheObjectUtils.java:135)
> at
>
> org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinariesIfNeeded(CacheObjectUtils.java:77)
> at
>
> org.apache.ignite.internal.processors.cache.GridCacheContext.unwrapBinariesIfNeeded(GridCacheContext.java:1796)
> at
>
> org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter.onPage(GridCacheQueryFutureAdapter.java:351)
> at
>
> org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager.processQueryResponse(GridCacheDistributedQueryManager.java:403)
> at
>
> org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager.access$000(GridCacheDistributedQueryManager.java:64)
> at
>
> org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$1.apply(GridCacheDistributedQueryManager.java:94)
> at
>
> org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$1.apply(GridCacheDistributedQueryManager.java:92)
> at
>
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:1142)
> at
>
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:591)
> at
>
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$800(GridCacheIoManager.java:109)
> at
>
> org.apache.ignite.internal.processors.cache.GridCacheIoManager$OrderedMessageListener.onMessage(GridCacheIoManager.java:1707)
> at
>
> org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1907)
> at
>
> org.apache.ignite.internal.managers.communication.GridIoManager.access$5200(GridIoManager.java:241)
> at
>
> org.apache.ignite.internal.managers.communication.GridIoManager$GridCommunicationMessageSet.unwind(GridIoManager.java:3916)
> at
>
> org.apache.ignite.internal.managers.communication.GridIoManager.unwindMessageSet(GridIoManager.java:1862)
> at
>
> org.apache.ignite.internal.managers.communication.GridIoManager.access$5500(GridIoManager.java:241)
> at
>
> org.apache.ignite.internal.managers.communication.GridIoManager$10.run(GridIoManager.java:1829)
> at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.ClassNotFoundException:
> SQL_PUBLIC_CITY_5c1c4ecf_745a_4a99_bfbf_fde6de0bc215
> at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:348)
> at
> org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8900)
> at
>
> org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:376)
> at
>
> org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:680)
> ... 27 more
>
>
> Taras Ledkov wrote
> > Hi,
> >
> > Please ta

Re: Failed to Scan query data by partition index after insert data using DML

2021-05-11 Thread Taras Ledkov

Hi,

Please provide steps to reproduce.
I don't catch a case by the stacktrace.

On 08.05.2021 3:02, Henric wrote:

Hi,
Thanks for replay
I tried to used cache_name, but I still get Exception as below, I have
specify the cache name, I don't know why I still get this error.
I tried to set WRAP_VALUE to false, but it only works for single column.
Did I miss something important?

Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException:
SQL_PUBLIC_CITY_5c1c4ecf_745a_4a99_bfbf_fde6de0bc215
at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:689)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1757)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1716)
at
org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:796)
at
org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:142)
at
org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinary(CacheObjectUtils.java:176)
at
org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinaryIfNeeded(CacheObjectUtils.java:62)
at
org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinariesIfNeeded(CacheObjectUtils.java:135)
at
org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinariesIfNeeded(CacheObjectUtils.java:77)
at
org.apache.ignite.internal.processors.cache.GridCacheContext.unwrapBinariesIfNeeded(GridCacheContext.java:1796)
at
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter.onPage(GridCacheQueryFutureAdapter.java:351)
at
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager.processQueryResponse(GridCacheDistributedQueryManager.java:403)
at
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager.access$000(GridCacheDistributedQueryManager.java:64)
at
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$1.apply(GridCacheDistributedQueryManager.java:94)
at
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$1.apply(GridCacheDistributedQueryManager.java:92)
at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:1142)
at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:591)
at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$800(GridCacheIoManager.java:109)
at
org.apache.ignite.internal.processors.cache.GridCacheIoManager$OrderedMessageListener.onMessage(GridCacheIoManager.java:1707)
at
org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1907)
at
org.apache.ignite.internal.managers.communication.GridIoManager.access$5200(GridIoManager.java:241)
at
org.apache.ignite.internal.managers.communication.GridIoManager$GridCommunicationMessageSet.unwind(GridIoManager.java:3916)
at
org.apache.ignite.internal.managers.communication.GridIoManager.unwindMessageSet(GridIoManager.java:1862)
at
org.apache.ignite.internal.managers.communication.GridIoManager.access$5500(GridIoManager.java:241)
at
org.apache.ignite.internal.managers.communication.GridIoManager$10.run(GridIoManager.java:1829)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException:
SQL_PUBLIC_CITY_5c1c4ecf_745a_4a99_bfbf_fde6de0bc215
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at
org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8900)
at
org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:376)
at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:680)
... 27 more


Taras Ledkov wrote

Hi,

Please take a look at the documentation of the CREATE TABLE [1]

Use:

CREATE TABLE tableName (id LONG PRIMARY KEY, name VARCHAR)
WITH "|CACHE_NAME=|cacheName"

Please pay attention to other options. Its may be useful to use cache
API & SQL together.
Also be careful when you use cache API & SQL together.
You can get unexpected behavior on this way for several cases. See [2]


1. https://apacheignite-sql.readme.io/docs/create-tabl

Re: Failed to Scan query data by partition index after insert data using DML

2021-05-07 Thread Henric
Hi,
Thanks for replay
I tried to used cache_name, but I still get Exception as below, I have
specify the cache name, I don't know why I still get this error.
I tried to set WRAP_VALUE to false, but it only works for single column.
Did I miss something important?

Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException:
SQL_PUBLIC_CITY_5c1c4ecf_745a_4a99_bfbf_fde6de0bc215
at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:689)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1757)
at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1716)
at
org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:796)
at
org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:142)
at
org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinary(CacheObjectUtils.java:176)
at
org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinaryIfNeeded(CacheObjectUtils.java:62)
at
org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinariesIfNeeded(CacheObjectUtils.java:135)
at
org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinariesIfNeeded(CacheObjectUtils.java:77)
at
org.apache.ignite.internal.processors.cache.GridCacheContext.unwrapBinariesIfNeeded(GridCacheContext.java:1796)
at
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter.onPage(GridCacheQueryFutureAdapter.java:351)
at
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager.processQueryResponse(GridCacheDistributedQueryManager.java:403)
at
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager.access$000(GridCacheDistributedQueryManager.java:64)
at
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$1.apply(GridCacheDistributedQueryManager.java:94)
at
org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$1.apply(GridCacheDistributedQueryManager.java:92)
at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:1142)
at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:591)
at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$800(GridCacheIoManager.java:109)
at
org.apache.ignite.internal.processors.cache.GridCacheIoManager$OrderedMessageListener.onMessage(GridCacheIoManager.java:1707)
at
org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1907)
at
org.apache.ignite.internal.managers.communication.GridIoManager.access$5200(GridIoManager.java:241)
at
org.apache.ignite.internal.managers.communication.GridIoManager$GridCommunicationMessageSet.unwind(GridIoManager.java:3916)
at
org.apache.ignite.internal.managers.communication.GridIoManager.unwindMessageSet(GridIoManager.java:1862)
at
org.apache.ignite.internal.managers.communication.GridIoManager.access$5500(GridIoManager.java:241)
at
org.apache.ignite.internal.managers.communication.GridIoManager$10.run(GridIoManager.java:1829)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException:
SQL_PUBLIC_CITY_5c1c4ecf_745a_4a99_bfbf_fde6de0bc215
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at
org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8900)
at
org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:376)
at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:680)
... 27 more


Taras Ledkov wrote
> Hi,
> 
> Please take a look at the documentation of the CREATE TABLE [1]
> 
> Use:
> 
> CREATE TABLE tableName (id LONG PRIMARY KEY, name VARCHAR)
> WITH "|CACHE_NAME=|cacheName"
> 
> Please pay attention to other options. Its may be useful to use cache 
> API & SQL together.
> Also be careful when you use cache API & SQL together.
> You can get unexpected behavior on this way for several cases. See [2]
> 
> 
> 1. https://apacheignite-sql.readme.io/docs/create-table
> 2. https://youtu.be/0lQy5J5hLJI?t=2051
> 
> On 07.05.2021 17:10, Henric wrote:
>>

Re: Failed to Scan query data by partition index after insert data using DML

2021-05-07 Thread Taras Ledkov

Hi,

Please take a look at the documentation of the CREATE TABLE [1]

Use:

CREATE TABLE tableName (id LONG PRIMARY KEY, name VARCHAR)
WITH "|CACHE_NAME=|cacheName"

Please pay attention to other options. Its may be useful to use cache 
API & SQL together.

Also be careful when you use cache API & SQL together.
You can get unexpected behavior on this way for several cases. See [2]


1. https://apacheignite-sql.readme.io/docs/create-table
2. https://youtu.be/0lQy5J5hLJI?t=2051

On 07.05.2021 17:10, Henric wrote:

I tried to query data by partition index, when I insert data using cache API,
I can get data successfully, when I insert data using DML, I can't get data.

*I can get data by partition index using cache API*

IgniteCache cache = ignite.getOrCreateCache("cacheName");
cache.put(1, "v1");
ScanQuery sq = new ScanQuery(1); //1 is the id of partition used to store
entry created above
cache.query(sq).getAll();

*I can't get data using partition index which is insert by DML*

IgniteCache cache = ignite.getOrCreateCache("tableName");
cache.query(new SqlFieldsQuery("CREATE TABLE tableName (id LONG PRIMARY KEY,
name VARCHAR)")).getAll();
SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO tableName (id, name)
value (?,?)");
cache.query(qry.setArgs(11L, "Mary Major")).getAll();

ScanQuery sq = new ScanQuery(11); //11 is the id of partition used to store
entry created above
cache.query(sq).getAll(); //nothing return here!
I tried SQL_PUBLIC_TABLENAME as cache name, I got Exception:
java.lang.ClassNotFoundException:
SQL_PUBLIC_TABLENAME_7b146bba_cd7f_452f_8abc

*Q: How can I query data inserted by DML using partition index? Thanks.*



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


--
Taras Ledkov
Mail-To: tled...@gridgain.com



Failed to Scan query data by partition index after insert data using DML

2021-05-07 Thread Henric
I tried to query data by partition index, when I insert data using cache API,
I can get data successfully, when I insert data using DML, I can't get data.

*I can get data by partition index using cache API*

IgniteCache cache = ignite.getOrCreateCache("cacheName");
cache.put(1, "v1");
ScanQuery sq = new ScanQuery(1); //1 is the id of partition used to store
entry created above
cache.query(sq).getAll();

*I can't get data using partition index which is insert by DML*

IgniteCache cache = ignite.getOrCreateCache("tableName");
cache.query(new SqlFieldsQuery("CREATE TABLE tableName (id LONG PRIMARY KEY,
name VARCHAR)")).getAll();
SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO tableName (id, name)
value (?,?)");
cache.query(qry.setArgs(11L, "Mary Major")).getAll();

ScanQuery sq = new ScanQuery(11); //11 is the id of partition used to store
entry created above
cache.query(sq).getAll(); //nothing return here!
I tried SQL_PUBLIC_TABLENAME as cache name, I got Exception:
java.lang.ClassNotFoundException:
SQL_PUBLIC_TABLENAME_7b146bba_cd7f_452f_8abc

*Q: How can I query data inserted by DML using partition index? Thanks.*



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/