/** */ @Test public void testNonCollocatedRetryMessage() { SqlQuery<String, JoinSqlTestHelper.Person> qry = new SqlQuery<String, JoinSqlTestHelper.Person>( JoinSqlTestHelper.Person.class, JoinSqlTestHelper.JOIN_SQL).setArgs("Organization #0"); qry.setDistributedJoins(true); try { List<Cache.Entry<String, JoinSqlTestHelper.Person>> prsns = personCache.query(qry).getAll(); fail("No CacheException emitted. Collection size=" + prsns.size()); } catch (CacheException e) { assertTrue(e.getMessage(), e.getMessage().contains("Failed to execute non-collocated query")); } }
/** */ @Test public void testDisappearedCacheWasNotFoundMessage() { SqlQuery<String, Person> qry = new SqlQuery<String, Person>(Person.class, JoinSqlTestHelper.JOIN_SQL).setArgs("Organization #0"); qry.setDistributedJoins(true); try { personCache.query(qry).getAll(); fail("No CacheException emitted."); } catch (CacheException e) { boolean exp = e.getMessage().contains("Cache not found on local node (was concurrently destroyed?)"); if (!exp) throw e; } }
"where Person.orgId = Organization.id and Person.id = Account.personId and Organization.id = ?"); q.setDistributedJoins(distributedJoins());
/** */ @Test public void testDisappearedCacheCauseRetryMessage() { SqlQuery<String, JoinSqlTestHelper.Person> qry = new SqlQuery<String, JoinSqlTestHelper.Person>(JoinSqlTestHelper.Person.class, JoinSqlTestHelper.JOIN_SQL).setArgs("Organization #0"); qry.setDistributedJoins(true); try { personCache.query(qry).getAll(); fail("No CacheException emitted."); } catch (CacheException e) { assertTrue(e.getMessage(), e.getMessage().contains("Failed to reserve partitions for query (cache is not found on local node) [")); } }
((SqlQuery)q).setDistributedJoins(distributedJoins());
/** * Ctor. * * @param reader Reader. */ public ClientCacheSqlQueryRequest(BinaryRawReaderEx reader) { super(reader); qry = new SqlQuery(reader.readString(), reader.readString()) .setArgs(PlatformCache.readQueryArgs(reader)) .setDistributedJoins(reader.readBoolean()) .setLocal(reader.readBoolean()) .setReplicatedOnly(reader.readBoolean()) .setPageSize(reader.readInt()) .setTimeout((int) reader.readLong(), TimeUnit.MILLISECONDS); }
); qry2.setDistributedJoins(distributedJoins());
/** * Reads sql query. * * @param reader Binary reader. * @return Query. */ private Query readSqlQuery(BinaryRawReaderEx reader) { boolean loc = reader.readBoolean(); String sql = reader.readString(); String typ = reader.readString(); final int pageSize = reader.readInt(); Object[] args = readQueryArgs(reader); boolean distrJoins = reader.readBoolean(); int timeout = reader.readInt(); boolean replicated = reader.readBoolean(); return new SqlQuery(typ, sql) .setPageSize(pageSize) .setArgs(args) .setLocal(loc) .setDistributedJoins(distrJoins) .setTimeout(timeout, TimeUnit.MILLISECONDS) .setReplicatedOnly(replicated); }
((SqlQuery)qry).setDistributedJoins(req.distributedJoins());
qry.setDistributedJoins(true); try { personCache.query(qry).getAll();
qry.setDistributedJoins(true);
qry.setDistributedJoins(true);
qry.setDistributedJoins(true); try { personCache.query(qry).getAll();
qry.setDistributedJoins(true);
/** * @throws Exception If failed. */ @Test public void testNonCollocatedDistributedJoin() throws Exception { CacheConfiguration ccfg1 = cacheConfig("pers", true, String.class, Person.class); CacheConfiguration ccfg2 = cacheConfig("org", true, String.class, Organization.class); IgniteCache<String, Person> c1 = ignite(0).getOrCreateCache(ccfg1); IgniteCache<String, Organization> c2 = ignite(0).getOrCreateCache(ccfg2); try { awaitPartitionMapExchange(); populateDataIntoCaches(c1, c2); String joinSql = "select * from Person, \"org\".Organization as org " + "where Person.orgId = org.id " + "and lower(org.name) = lower(?)"; SqlQuery qry = new SqlQuery<String, Person>(Person.class, joinSql).setArgs("Organization #0"); qry.setDistributedJoins(true); List<Person> prns = c1.query(qry).getAll(); assertEquals(PERSON_PER_ORG_COUNT, prns.size()); } finally { c1.destroy(); c2.destroy(); } }
qry.setDistributedJoins(true);
/** * Ctor. * * @param reader Reader. */ public ClientCacheSqlQueryRequest(BinaryRawReaderEx reader) { super(reader); qry = new SqlQuery(reader.readString(), reader.readString()) .setArgs(PlatformCache.readQueryArgs(reader)) .setDistributedJoins(reader.readBoolean()) .setLocal(reader.readBoolean()) .setReplicatedOnly(reader.readBoolean()) .setPageSize(reader.readInt()) .setTimeout((int) reader.readLong(), TimeUnit.MILLISECONDS); }
/** * Reads sql query. * * @param reader Binary reader. * @return Query. */ private Query readSqlQuery(BinaryRawReaderEx reader) { boolean loc = reader.readBoolean(); String sql = reader.readString(); String typ = reader.readString(); final int pageSize = reader.readInt(); Object[] args = readQueryArgs(reader); boolean distrJoins = reader.readBoolean(); int timeout = reader.readInt(); boolean replicated = reader.readBoolean(); return new SqlQuery(typ, sql) .setPageSize(pageSize) .setArgs(args) .setLocal(loc) .setDistributedJoins(distrJoins) .setTimeout(timeout, TimeUnit.MILLISECONDS) .setReplicatedOnly(replicated); }
((SqlQuery)qry).setDistributedJoins(req.distributedJoins());