Insert with JDBC Thin driver into caches

classic Classic list List threaded Threaded
5 messages Options
Benjamin Benjamin
Reply | Threaded
Open this post in threaded view
|

Insert with JDBC Thin driver into caches

Hi,

I have the following scenario:
1. I create a cache using the java API with a CacheConfiguration with a
QueryEntity<Key, Value> and some fields on it.
2. I put some data into that cache using SQL INSERT statements with the JDBC
Thin driver
3. I read this data using the java API with IgniteCache.get(Key)

If the fields on the QueryEntity are in the same order than the declared
fields of the Key class, everything works fine.

But if the fields on the QueryEntity are in a different order than the
declared field of the Key class, then I'm unable to read my data using
IgniteCache.get(Key) on step 3

The documentation says that the order of the fields on QueryEntity defines
the order of the returned columns for select * statements. But it says
nothing about inserts.
Am I missing something, or is this correct behavior?

I've attached a main(String[]) that reproduces the issue:  Main.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t2439/Main.java>  
I'm using Ignite 2.9.1

Regards,

Benjamin





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Ilya Kazakov Ilya Kazakov
Reply | Threaded
Open this post in threaded view
|

Re: Insert with JDBC Thin driver into caches

Hello, Benjamin!

Try to run your Ignite with system property: -DIGNITE_BINARY_SORT_OBJECT_FIELDS=true
Or from Java: 

public static void
main(String[] args) throws SQLException {
    System.setProperty("IGNITE_BINARY_SORT_OBJECT_FIELDS", "true");
...
-------------------------------------
Thanks, Ilya!

пн, 15 февр. 2021 г. в 21:21, Benjamin <[hidden email]>:
Hi,

I have the following scenario:
1. I create a cache using the java API with a CacheConfiguration with a
QueryEntity<Key, Value> and some fields on it.
2. I put some data into that cache using SQL INSERT statements with the JDBC
Thin driver
3. I read this data using the java API with IgniteCache.get(Key)

If the fields on the QueryEntity are in the same order than the declared
fields of the Key class, everything works fine.

But if the fields on the QueryEntity are in a different order than the
declared field of the Key class, then I'm unable to read my data using
IgniteCache.get(Key) on step 3

The documentation says that the order of the fields on QueryEntity defines
the order of the returned columns for select * statements. But it says
nothing about inserts.
Am I missing something, or is this correct behavior?

I've attached a main(String[]) that reproduces the issue:  Main.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t2439/Main.java
I'm using Ignite 2.9.1

Regards,

Benjamin





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Ilya Kazakov Ilya Kazakov
Reply | Threaded
Open this post in threaded view
|

Re: Insert with JDBC Thin driver into caches

But this property should be set on the empty cluster before you create your schema

-----------------------------
Ilya

вт, 16 февр. 2021 г. в 16:53, Ilya Kazakov <[hidden email]>:
Hello, Benjamin!

Try to run your Ignite with system property: -DIGNITE_BINARY_SORT_OBJECT_FIELDS=true
Or from Java: 

public static void
main(String[] args) throws SQLException {
    System.setProperty("IGNITE_BINARY_SORT_OBJECT_FIELDS", "true");
...
-------------------------------------
Thanks, Ilya!

пн, 15 февр. 2021 г. в 21:21, Benjamin <[hidden email]>:
Hi,

I have the following scenario:
1. I create a cache using the java API with a CacheConfiguration with a
QueryEntity<Key, Value> and some fields on it.
2. I put some data into that cache using SQL INSERT statements with the JDBC
Thin driver
3. I read this data using the java API with IgniteCache.get(Key)

If the fields on the QueryEntity are in the same order than the declared
fields of the Key class, everything works fine.

But if the fields on the QueryEntity are in a different order than the
declared field of the Key class, then I'm unable to read my data using
IgniteCache.get(Key) on step 3

The documentation says that the order of the fields on QueryEntity defines
the order of the returned columns for select * statements. But it says
nothing about inserts.
Am I missing something, or is this correct behavior?

I've attached a main(String[]) that reproduces the issue:  Main.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t2439/Main.java
I'm using Ignite 2.9.1

Regards,

Benjamin





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Benjamin Benjamin
Reply | Threaded
Open this post in threaded view
|

Re: Insert with JDBC Thin driver into caches

Thanks. It fixes the issue.

However, the javadoc for
IgniteSystemProperties.IGNITE_BINARY_SORT_OBJECT_FIELDS says:

@deprecated Should be removed in Apache Ignite 2.0.

Is it ok to use it? Does it have any other impact?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Ilya Kazakov Ilya Kazakov
Reply | Threaded
Open this post in threaded view
|

Re: Insert with JDBC Thin driver into caches

It is marked as deprecated because there were plans to make it enabled by default. But it is still not...

Now the property is already deprecated, but the feature is still disabled by default.

--------------
Thanks

вт, 16 февр. 2021 г. в 20:06, Benjamin <[hidden email]>:
Thanks. It fixes the issue.

However, the javadoc for
IgniteSystemProperties.IGNITE_BINARY_SORT_OBJECT_FIELDS says:

@deprecated Should be removed in Apache Ignite 2.0.

Is it ok to use it? Does it have any other impact?



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