ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Mekhanikov <dmekhani...@gmail.com>
Subject Re: SQL SELECT with AffinityKeyMapped - no results
Date Fri, 03 Aug 2018 15:35:28 GMT
Floris,

Binary metadata may be saved in work/binary_meta directory.
Try cleaning this directory and see if it helps. You will also need to
restart the whole cluster.
Note, that it may lead to impossibility to read persisted data, if you have
any.

Denis

пт, 3 авг. 2018 г. в 18:15, Floris Van Nee <florisvannee@optiver.com>:

> Thank you for your quick reply. That does look a lot like what I’m
> experiencing.
>
>
>
> However, I did some testing but so far I did not get the workaround to
> work. I put the following in the XML config file:
>
>
>
>         <property name="binaryConfiguration">
>
>             <bean
> class="org.apache.ignite.configuration.BinaryConfiguration">
>
>                 <property name="classNames">
>
>                     <list>
>
>
> <value>org.apache.ignite.examples.streaming.TestKey</value>
>
>                     </list>
>
>                 </property>
>
>             </bean>
>
>         </property>
>
>
>
> Furthermore, when I create the cache, I pass a config with:
>
> cfg.setKeyConfiguration(new CacheKeyConfiguration(TestKey.class.getName(),
> "b"));
>
>
>
> According to the ticket this should be sufficient. Could I still be
> missing something here?
>
>
>
> -Floris
>
>
>
> *From:* Denis Mekhanikov [mailto:dmekhanikov@gmail.com]
> *Sent:* Friday 03 August 2018 4:05 PM
> *To:* user@ignite.apache.org
> *Subject:* Re: SQL SELECT with AffinityKeyMapped - no results [External]
>
>
>
> Floris,
>
>
>
> Most probably, you hit a bug, that was introduced in Ignite 2.0:
> https://issues.apache.org/jira/browse/IGNITE-5795
>
> Because of this bug @AffinityKeyMapped annotation is ignored in classes,
> that are used in query entity configuration.
>
> As far as I can see, this is exactly your case.
>
> It's going to be fixed in Ignite 2.7.
>
> There is a workaround for this problem: you can list the problematic
> classes in BinaryConfiguration#classNames
> <https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/configuration/BinaryConfiguration.html#setClassNames-java.util.Collection->
> configuration property.
>
> Binary configuration should be specified as
> IgniteConfiguration#binaryConfiguration
> <https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/configuration/IgniteConfiguration.html#setBinaryConfiguration-org.apache.ignite.configuration.BinaryConfiguration->
> .
>
> This configuration should be the same on all nodes.
>
> You may also need to configure CacheConfiguration#keyConfiguration
> <https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/configuration/CacheConfiguration.html#setKeyConfiguration-org.apache.ignite.cache.CacheKeyConfiguration...->
> for your cache.
>
>
>
> Denis
>
>
>
> пт, 3 авг. 2018 г. в 16:58, Floris Van Nee <florisvannee@optiver.com>:
>
> Hi all,
>
>
>
> I have defined two classes in Java – one for a key and one for a value.
> Suppose they look like this:
>
>
>
>     public static class Key implements Serializable {
>
>         public String a;
>
>         @QuerySqlField
>
>         @AffinityKeyMapped
>
>         public String b;
>
>     }
>
>     public static class Value implements Serializable {
>
>         @QuerySqlField
>
>         public int c;
>
>     }
>
>
>
> I then define a distributed cache (in Java) for this key/value pair and
> fill it with values (in Java).
>
> Now, I run the following in SQL:
>
> SELECT * FROM kv_table;
>
> I indeed see results of all the stuff that I inserted into the cache.
>
>
>
> However, when I try to select a certain value, it returns no results:
>
> SELECT * FROM kv_table WHERE b = ‘test’;
>
> I get expected results when filtering on any column that is not defined as
> AffinityKeyMapped.
>
> The only case where I get wrong results is for the AffinityKeyMapped
> column - I always get a wrong result (most of the time zero rows, for some
> values I do get one row, but I expect to see more rows). Also when I remove
> the AffinityKeyMapped annotation and run my test again, everything works as
> expected.
>
> I run just a single server node and execute my query using the SQLLine
> tool that Ignite ships with.
>
>
>
> Is it possible that there is a bug in the code that handles this affinity
> key mapping for SQL queries? Or am I doing something wrong here?
>
>
>
> -Floris
>
>

Mime
View raw message