hi Igniters,

Can you pls advise below ?
 
It always prints out below WARN message in server side when I am trying to use 
the sql join .  Anything wrong with my configuration or testing code ? Is 
it possible  to eliminate that WARN message ?
 
 
 
[ WARN] org.apache.ignite.internal.processors.query.h2.QueryParser - For join 
two partitioned tables join condition should contain the equality  operation of 
affinity keys. Left side: PERSON; right side: COMPANY
 
 
 
Ignite version: 2.13.0
 
see below test code, which is extracted from 
https://ignite.apache.org/docs/latest/data-modeling/affinity-collocation and 
added with some additional annotation changes. 
 
 
 
public class AffinityCollocationExample2 {
 
    
 
    static class Person {
 
        @QuerySqlField(index = true)
 
        private int id;
 
        @QuerySqlField(index = true)
 
        private String companyId;
 
        @QuerySqlField
 
        private String name;
 
 
 
        public Person(int id, String 
companyId, String name) {
 
            this.id  = 
id;
 
            
this.companyId  = companyId;
 
            this.name  = 
name;
 
        }
 
 
 
        public int getId() {
 
            return id;
 
        }
 
    }
 
 
 
    static class PersonKey {
 
        private int id;
 
 
 
        @AffinityKeyMapped
 
        private String companyId;
 
 
 
        public PersonKey(int id, String 
companyId) {
 
            this.id  = 
id;
 
            
this.companyId  = companyId;
 
        }
 
    }
 
 
 
    static class Company {
 
        
 
        @QuerySqlField(index  = true)
 
        private String id;
 
        @QuerySqlField
 
        private String name;
 
 
 
        public Company(String id, String 
name) {
 
            this.id  = 
id;
 
            this.name  = 
name;
 
        }
 
 
 
        public String getId() {
 
            return id;
 
        }
 
    }
 
 
 
    public void configureAffinityKeyWithAnnotation() {
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CacheConfiguration<PersonKey, 
Person&gt; personCfg = new CacheConfiguration<PersonKey, Person&gt;("persons");
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; personCfg.setBackups(1);
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
personCfg.setIndexedTypes(PersonKey.class,  Person.class);
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; personCfg.setSqlSchema("pojo");
 
&nbsp;
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CacheConfiguration<String, 
Company&gt; companyCfg = new CacheConfiguration<&gt;("companies");
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; companyCfg.setBackups(1);
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
companyCfg.setIndexedTypes(String.class,  Company.class);
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; companyCfg.setSqlSchema("pojo");
 
&nbsp;
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ignite ignite = Ignition.start();
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IgniteCache<PersonKey, Person&gt; 
personCache = ignite.getOrCreateCache(personCfg);
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IgniteCache<String, Company&gt; 
companyCache = ignite.getOrCreateCache(companyCfg);
 
&nbsp;
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Company c1 = new Company("company1", 
"My company");
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Person p1 = new Person(1, 
c1.getId(), "John");
 
&nbsp;
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Both the p1 and c1 objects will 
be cached on the same node
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; personCache.put(new  
PersonKey(p1.getId(), c1.getId()), p1);
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; companyCache.put("company1", c1);
 
&nbsp;
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Get the person object
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p1 = personCache.get(new  
PersonKey(1, "company1"));
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 
&nbsp;&nbsp;&nbsp;&nbsp;}
 
&nbsp;&nbsp;&nbsp; 
 
&nbsp;&nbsp;&nbsp;&nbsp;public static void main(String[] args) throws Exception 
{
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AffinityCollocationExample2 main = 
new AffinityCollocationExample2();
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
main.configureAffinityKeyWithAnnotation();
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++");
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; main.test_sql_join_affinity();
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.exit(0);
 
&nbsp;&nbsp;&nbsp; }
 
&nbsp;&nbsp;&nbsp; 
 
&nbsp;&nbsp;&nbsp;&nbsp;public void test_sql_join_affinity() throws 
ClientException, Exception {
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String sql = "select a.companyId, 
b.name from pojo.Person a,&nbsp; pojo.Company b where a.companyId = b.id";
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ClientConfiguration cfg = new 
ClientConfiguration().setAddresses("127.0.0.1:10800");
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try  (IgniteClient client = 
Ignition.startClient(cfg))  {
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
SqlFieldsQuery query = new SqlFieldsQuery(sql);
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List<List<?&gt;&gt;
 rets= client.query(query).getAll();
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
for(List<?&gt; e : (List<List<?&gt;&gt;)rets)  {
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 System.out.println(e);
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
 
&nbsp;&nbsp;&nbsp; }
 
}
 
&nbsp;
 
&nbsp;
 
&nbsp;

Reply via email to