org.apache.ignite.cache.query.SqlQuery Java Examples
The following examples show how to use
org.apache.ignite.cache.query.SqlQuery.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GridCacheOffheapIndexGetSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testWithExpiryPolicy() throws Exception { IgniteCache<Long, Long> cache = jcache(grid(0), cacheConfiguration(), Long.class, Long.class); cache = cache.withExpiryPolicy(new TestExiryPolicy()); for (long i = 0; i < 100; i++) cache.put(i, i); for (long i = 0; i < 100; i++) assertEquals((Long)i, cache.get(i)); SqlQuery<Long, Long> qry = new SqlQuery<>(Long.class, "_val >= 90"); List<Cache.Entry<Long, Long>> res = cache.query(qry).getAll(); assertEquals(10, res.size()); for (Cache.Entry<Long, Long> e : res) { assertNotNull(e.getKey()); assertNotNull(e.getValue()); } }
Example #2
Source File: TcpClientCache.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public <R> QueryCursor<R> query(Query<R> qry) { if (qry == null) throw new NullPointerException("qry"); QueryCursor<R> res; if (qry instanceof ScanQuery) res = scanQuery((ScanQuery)qry); else if (qry instanceof SqlQuery) res = (QueryCursor<R>)sqlQuery((SqlQuery)qry); else if (qry instanceof SqlFieldsQuery) res = (QueryCursor<R>)query((SqlFieldsQuery)qry); else throw new IllegalArgumentException( String.format("Query of type [%s] is not supported", qry.getClass().getSimpleName()) ); return res; }
Example #3
Source File: IgniteCacheAbstractQuerySelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testLocalSqlQueryFromClient() throws Exception { try (Ignite g = startClientGrid("client")) { IgniteCache<Integer, Integer> c = jcache(g, Integer.class, Integer.class); for (int i = 0; i < 10; i++) c.put(i, i); SqlQuery<Integer, Integer> qry = new SqlQuery<>(Integer.class, "_key >= 5 order by _key"); qry.setLocal(true); assertThrowsWithCause(() -> c.query(qry), CacheException.class); } }
Example #4
Source File: PlatformCache.java From ignite with Apache License 2.0 | 6 votes |
/** * 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); }
Example #5
Source File: H2RowCacheSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @param cacheName Cache name. * @param rowCache Row cache. * @param key Key to find. * @return Row's link. */ private long getLinkForKey(String cacheName, H2RowCache rowCache, int key) { grid().cache(cacheName) .query(new SqlQuery(Value.class, "_key = " + key)).getAll().size(); ConcurrentLinkedHashMap<Long, H2CacheRow> rowsMap = GridTestUtils.getFieldValue(rowCache, "rows"); for (Map.Entry<Long, H2CacheRow> e : rowsMap.entrySet()) { H2CacheRow val = e.getValue(); KeyCacheObject rowKey = val.key(); if ((Integer)rowKey.value(null, false) == key) return e.getKey(); } fail("Row cache doesn't contain key [key=" + key + ']'); return -1; }
Example #6
Source File: GridIndexingWithNoopSwapSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** @throws Exception If failed. */ @Test public void testQuery() throws Exception { IgniteCache<Integer, ObjectValue> cache = ignite.cache(DEFAULT_CACHE_NAME); int cnt = 10; for (int i = 0; i < cnt; i++) cache.getAndPut(i, new ObjectValue("test" + i, i)); for (int i = 0; i < cnt; i++) { assertNotNull(cache.localPeek(i, ONHEAP_PEEK_MODES)); cache.localEvict(Collections.singleton(i)); // Swap. } SqlQuery<Integer, ObjectValue> qry = new SqlQuery(ObjectValue.class, "intVal >= ? order by intVal"); assertEquals(10, cache.query(qry.setArgs(0)).getAll().size()); }
Example #7
Source File: CacheTtlAbstractSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @param gridCnt Number of nodes. * @throws Exception If failed. */ private void checkSizeAfterLive(int gridCnt) throws Exception { for (int i = 0; i < gridCnt; ++i) { IgniteCache<Integer, Integer> cache = jcache(i); log.info("Size [node=" + i + ", heap=" + cache.localSize(ONHEAP) + ", offheap=" + cache.localSize(OFFHEAP) + ']'); assertEquals(0, cache.localSize()); assertEquals(0, cache.localSize(OFFHEAP)); assertEquals(0, cache.query(new SqlQuery<>(Integer.class, "_val >= 0")).getAll().size()); for (int key = 0; key < SIZE; key++) assertNull(cache.localPeek(key)); } }
Example #8
Source File: IgniteProducerDao.java From joyqueue with Apache License 2.0 | 6 votes |
private SqlQuery buildQuery(ProducerQuery query) { IgniteDao.SimpleSqlBuilder sqlBuilder = IgniteDao.SimpleSqlBuilder.create(IgniteProducer.class); if (query != null) { if (query.getTopic() != null && !query.getTopic().isEmpty()) { sqlBuilder.and(COLUMN_TOPIC, query.getTopic()); } if (query.getNamespace() != null && !query.getNamespace().isEmpty()) { sqlBuilder.and(COLUMN_NAMESPACE, query.getNamespace()); } if (query.getApp() != null && !query.getApp().isEmpty()) { sqlBuilder.and(COLUMN_APP, query.getApp()); } if (query.getClientType() > 0) { sqlBuilder.and(COLUMN_CLIENT_TYPE, query.getClientType()); } if (query.getAppList() != null) { sqlBuilder.in(COLUMN_APP,query.getAppList()); } } return sqlBuilder.build(); }
Example #9
Source File: IgniteTopicDao.java From joyqueue with Apache License 2.0 | 6 votes |
private SqlQuery buildQuery(TopicQuery query) { IgniteDao.SimpleSqlBuilder sqlBuilder = IgniteDao.SimpleSqlBuilder.create(IgniteTopic.class); if (query != null) { // sqlBuilder.and("id !","__group_coordinators"); if (query.getCode() != null && !query.getCode().isEmpty()) { sqlBuilder.and(IgniteTopic.COLUMN_CODE, query.getCode()); } if (query.getNamespace() != null && !query.getNamespace().isEmpty()) { sqlBuilder.and(IgniteTopic.COLUMN_NAMESPACE, query.getNamespace()); } if (query.getType() != null) { sqlBuilder.and(IgniteTopic.COLUMN_TYPE,query.getType()); } if (StringUtils.isNotEmpty(query.getKeyword())) { sqlBuilder.like(IgniteTopic.COLUMN_CODE, query.getKeyword()); } } return sqlBuilder.build(); }
Example #10
Source File: IgniteCacheProxyImpl.java From ignite with Apache License 2.0 | 6 votes |
/** * Convert query arguments to BinaryObjects if binary marshaller used. * * @param qry Query. */ private void convertToBinary(final Query qry) { GridCacheContext<K, V> ctx = getContextSafe(); if (ctx.binaryMarshaller()) { if (qry instanceof SqlQuery) { final SqlQuery sqlQry = (SqlQuery) qry; convertToBinary(sqlQry.getArgs()); } else if (qry instanceof SpiQuery) { final SpiQuery spiQry = (SpiQuery) qry; convertToBinary(spiQry.getArgs()); } else if (qry instanceof SqlFieldsQuery) { final SqlFieldsQuery fieldsQry = (SqlFieldsQuery) qry; convertToBinary(fieldsQry.getArgs()); } } }
Example #11
Source File: DisappearedCacheCauseRetryMessageSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** */ @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) { if (!e.getMessage().contains("Failed to reserve partitions for query (cache is not found on local node) [")) e.printStackTrace(); assertTrue(e.getMessage(), e.getMessage().contains("Failed to reserve partitions for query (cache is not found on local node) [")); } }
Example #12
Source File: IgniteCacheAbstractQuerySelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testArray() throws Exception { IgniteCache<Integer, ArrayObject> cache = jcache(Integer.class, ArrayObject.class); cache.put(1, new ArrayObject(new Long[] {1L, null, 3L})); cache.put(2, new ArrayObject(new Long[] {4L, 5L, 6L})); QueryCursor<Cache.Entry<Integer, ArrayObject>> q = cache.query(new SqlQuery<Integer, ArrayObject>(ArrayObject.class, "array_contains(arr, cast(? as long))"). setArgs(4)); Collection<Cache.Entry<Integer, ArrayObject>> res = q.getAll(); assertEquals(1, res.size()); Cache.Entry<Integer, ArrayObject> e = F.first(res); assertEquals(2, (int)e.getKey()); assertArrayEquals(new Long[]{4L, 5L, 6L}, e.getValue().arr); }
Example #13
Source File: DisappearedCacheWasNotFoundMessageSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** */ @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; } }
Example #14
Source File: IgnitePartitionGroupReplicaDao.java From joyqueue with Apache License 2.0 | 6 votes |
private SqlQuery buildQuery(ReplicaQuery query) { IgniteDao.SimpleSqlBuilder builder = IgniteDao.SimpleSqlBuilder.create(IgnitePartitionGroupReplica.class); if (query != null) { if (query.getGroup() > -1) { builder.and(COLUMN_GROUP_NO, query.getGroup()); } if (query.getTopic() != null && !query.getTopic().isEmpty()) { builder.and(COLUMN_TOPIC, query.getTopic()); } if (query.getNamespace() != null) { builder.and(COLUMN_NAMESPACE, query.getNamespace()); } if (query.getBrokerId() > 0) { builder.and(COLUMN_BROKER_ID, query.getBrokerId()); } } return builder.build(); }
Example #15
Source File: IgniteConfigDao.java From joyqueue with Apache License 2.0 | 6 votes |
private SqlQuery buildQuery(ConfigQuery query) { IgniteDao.SimpleSqlBuilder sqlBuilder = IgniteDao.SimpleSqlBuilder.create(IgniteConfig.class); if (query != null) { if (query.getKey() != null && !query.getKey().isEmpty()) { sqlBuilder.and(COLUMN_CFG_KEY, query.getKey()); } if (query.getGroup() != null && !query.getGroup().isEmpty()) { sqlBuilder.and(COLUMN_CFG_GROUP, query.getGroup()); } if (StringUtils.isNotEmpty(query.getKeyword())) { sqlBuilder.and(COLUMN_CFG_KEY,query.getKeyword()).or(COLUMN_CFG_GROUP,query.getKeyword()); } } return sqlBuilder.build(); }
Example #16
Source File: IgniteCacheP2pUnmarshallingQueryErrorTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Test @Override public void testResponseMessageOnUnmarshallingFailed() { readCnt.set(Integer.MAX_VALUE); jcache(0).put(new TestKey(String.valueOf(++key)), ""); //GridCacheQueryRequest unmarshalling failed test readCnt.set(1); try { jcache(0).query(new SqlQuery<TestKey, String>(String.class, "field like '" + key + "'")).getAll(); fail("p2p marshalling failed, but error response was not sent"); } catch (CacheException ignored) { // No-op. } }
Example #17
Source File: GridCacheOffheapIndexGetSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * Tests behavior on offheaped entries. * * @throws Exception If failed. */ @Test public void testGet() throws Exception { IgniteCache<Long, Long> cache = jcache(grid(0), cacheConfiguration(), Long.class, Long.class); for (long i = 0; i < 100; i++) cache.put(i, i); for (long i = 0; i < 100; i++) assertEquals((Long)i, cache.get(i)); SqlQuery<Long, Long> qry = new SqlQuery<>(Long.class, "_val >= 90"); List<Cache.Entry<Long, Long>> res = cache.query(qry).getAll(); assertEquals(10, res.size()); for (Cache.Entry<Long, Long> e : res) { assertNotNull(e.getKey()); assertNotNull(e.getValue()); } }
Example #18
Source File: IgniteSqlDistributedJoinSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @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(); } }
Example #19
Source File: IgniteCacheAbstractQuerySelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @throws Exception If failed. */ @Test public void testOrderByOnly() throws Exception { IgniteCache<Integer, Integer> cache = jcache(Integer.class, Integer.class); for (int i = 0; i < 10; i++) cache.put(i, i); QueryCursor<Cache.Entry<Integer, Integer>> q = cache.query(new SqlQuery<Integer, Integer>(Integer.class, "_key >= 0")); Collection<Cache.Entry<Integer, Integer>> res = q.getAll(); assertEquals(10, res.size()); if (cacheMode() != PARTITIONED) { Iterator<Cache.Entry<Integer, Integer>> it = res.iterator(); for (Integer i = 0; i < 10; i++) { assertTrue(it.hasNext()); Cache.Entry<Integer, Integer> e = it.next(); assertEquals(i, e.getKey()); assertEquals(i, e.getValue()); } } }
Example #20
Source File: BaseH2CompareQueryTest.java From ignite with Apache License 2.0 | 5 votes |
/** * */ @Test public void testSelectStar() { assertEquals(1, cachePers.query(new SqlQuery<AffinityKey<?>,Person>( Person.class, "\t\r\n select \n*\t from Person limit 1")).getAll().size()); GridTestUtils.assertThrows(log, new Callable<Object>() { @Override public Object call() throws Exception { cachePers.query(new SqlQuery(Person.class, "SELECT firstName from PERSON")); return null; } }, CacheException.class, null); }
Example #21
Source File: CacheAbstractQueryMetricsSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Test metrics for Sql queries. * * @throws Exception In case of error. */ @Test public void testSqlQueryMetrics() throws Exception { IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A"); SqlQuery qry = new SqlQuery<>("String", "from String"); checkQueryMetrics(cache, qry); }
Example #22
Source File: IgniteBinaryObjectQueryArgumentsTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Test simple query by key. * * @param cacheName Cache name. * @param key1 Key 1. * @param key2 Key 2. * @param <T> Key type. */ private <T> void testKeyQuery(final String cacheName, final T key1, final T key2) { final IgniteCache<T, Person> cache = ignite(0).cache(cacheName); final Person p1 = new Person("p1"); final Person p2 = new Person("p2"); cache.put(key1, p1); cache.put(key2, p2); final SqlQuery<T, Person> qry = new SqlQuery<>(Person.class, "where _key=?"); final SqlFieldsQuery fieldsQry = new SqlFieldsQuery("select _key, _val, * from Person where _key=?"); qry.setLocal(isLocal()); fieldsQry.setLocal(isLocal()); qry.setArgs(key1); fieldsQry.setArgs(key1); final List<Cache.Entry<T, Person>> res = cache.query(qry).getAll(); final List<List<?>> fieldsRes = cache.query(fieldsQry).getAll(); assertEquals(1, res.size()); assertEquals(1, fieldsRes.size()); assertEquals(p1, res.get(0).getValue()); assertEquals(key1, res.get(0).getKey()); assertTrue(fieldsRes.get(0).size() >= 2); assertEquals(key1, fieldsRes.get(0).get(0)); assertEquals(p1, fieldsRes.get(0).get(1)); }
Example #23
Source File: IgniteCacheDistributedPartitionQueryAbstractSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param orig Originator. */ protected void doTestRegionQuery(Ignite orig) { IgniteCache<ClientKey, Client> cl = orig.cache("cl"); for (int regionId = 1; regionId <= PARTS_PER_REGION.length; regionId++) { SqlQuery<ClientKey, Client> qry1 = new SqlQuery<>(Client.class, "regionId=?"); qry1.setArgs(regionId); List<Cache.Entry<ClientKey, Client>> clients1 = cl.query(qry1).getAll(); int expRegionCnt = regionId == 5 ? 0 : PARTS_PER_REGION[regionId - 1] * CLIENTS_PER_PARTITION; assertEquals("Region " + regionId + " count", expRegionCnt, clients1.size()); validateClients(regionId, clients1); // Repeat the same query with partition set condition. List<Integer> range = REGION_TO_PART_MAP.get(regionId); SqlQuery<ClientKey, Client> qry2 = new SqlQuery<>(Client.class, "1=1"); qry2.setPartitions(createRange(range.get(0), range.get(1))); try { List<Cache.Entry<ClientKey, Client>> clients2 = cl.query(qry2).getAll(); assertEquals("Region " + regionId + " count with partition set", expRegionCnt, clients2.size()); // Query must produce only results from single region. validateClients(regionId, clients2); if (regionId == UNMAPPED_REGION) fail(); } catch (CacheException ignored) { if (regionId != UNMAPPED_REGION) fail(); } } }
Example #24
Source File: CacheAbstractQueryDetailMetricsSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Test metrics for Scan queries. * * @throws Exception In case of error. */ @Test public void testSqlQueryMetrics() throws Exception { IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A"); SqlQuery<Integer, String> qry = new SqlQuery<>("String", "from String"); checkQueryMetrics(cache, qry); }
Example #25
Source File: CacheAbstractQueryDetailMetricsSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Test metrics for Scan queries. * * @throws Exception In case of error. */ @Test public void testSqlQueryNotFullyFetchedMetrics() throws Exception { IgniteCache<Integer, String> cache = grid(0).context().cache().jcache("A"); SqlQuery<Integer, String> qry = new SqlQuery<>("String", "from String"); qry.setPageSize(10); checkQueryNotFullyFetchedMetrics(cache, qry, true); }
Example #26
Source File: CacheQueryAfterDynamicCacheStartFailureTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected void checkCacheOperations(IgniteCache<Integer, Value> cache) throws Exception { super.checkCacheOperations(cache); // Check SQL API. String sql = "fieldVal >= ? and fieldVal <= ?"; List<Cache.Entry<Integer, Value>> res = cache.query( new SqlQuery<Integer, Value>(Value.class, sql).setArgs(1, 100)).getAll(); assertNotNull(res); assertEquals(100, res.size()); }
Example #27
Source File: IgniteBinaryObjectQueryArgumentsTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @throws Exception If failed. */ @Test public void testFieldSearch() throws Exception { final IgniteCache<Integer, SearchValue> cache = ignite(0).cache(FIELD_CACHE); final Map<Integer, SearchValue> map = new HashMap<>(); for (int i = 0; i < 10; i++) { map.put(i, new SearchValue( UUID.randomUUID(), String.valueOf(i), new BigDecimal(i * 0.1), i, new Date(i), new Timestamp(i), new Person(String.valueOf("name-" + i)), i % 2 == 0 ? EnumKey.KEY1 : EnumKey.KEY2) ); } cache.putAll(map); SqlQuery<Integer, SearchValue> qry = new SqlQuery<>(SearchValue.class, "where uuid=? and str=? and decimal=? and integer=? and date=? and ts=? and person=? and enumKey=?"); final int k = ThreadLocalRandom.current().nextInt(10); final SearchValue val = map.get(k); qry.setLocal(isLocal()); qry.setArgs(val.uuid, val.str, val.decimal, val.integer, val.date, val.ts, val.person, val.enumKey); final List<Cache.Entry<Integer, SearchValue>> res = cache.query(qry).getAll(); assertEquals(1, res.size()); assertEquals(val.integer, res.get(0).getKey()); assertEquals(val, res.get(0).getValue()); }
Example #28
Source File: RetryCauseMessageSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Failed to reserve partitions for query (cache is not found on local node) */ @Test public void testSynthCacheWasNotFoundMessage() { GridMapQueryExecutor mapQryExec = GridTestUtils.getFieldValue(h2Idx, IgniteH2Indexing.class, "mapQryExec"); GridTestUtils.setFieldValue(h2Idx, "mapQryExec", new MockGridMapQueryExecutor() { @Override public void onQueryRequest(ClusterNode node, GridH2QueryRequest qryReq) throws IgniteCheckedException { qryReq.caches().add(Integer.MAX_VALUE); startedExecutor.onQueryRequest(node, qryReq); qryReq.caches().remove(qryReq.caches().size() - 1); } }.insertRealExecutor(mapQryExec)); SqlQuery<String, Person> qry = new SqlQuery<String, Person>(Person.class, JOIN_SQL).setArgs("Organization #0"); qry.setDistributedJoins(true); try { personCache.query(qry).getAll(); } catch (CacheException e) { assertTrue(e.getMessage(), e.getMessage().contains("Failed to reserve partitions for query (cache is not found on local node) [")); return; } finally { GridTestUtils.setFieldValue(h2Idx, "mapQryExec", mapQryExec); } fail(); }
Example #29
Source File: GridCacheQueryIndexingDisabledSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @throws IgniteCheckedException If failed. */ @Test public void testSqlQuery() throws IgniteCheckedException { // Failure occurs not on validation stage, hence specific error message. doTest(new Callable<Object>() { @Override public Object call() throws IgniteCheckedException { return jcache().query(new SqlQuery<>(String.class, "1 = 1")).getAll(); } }, "Failed to find SQL table for type: String"); }
Example #30
Source File: IgniteCacheQueryNoRebalanceSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Tests correct query execution with disabled re-balancing. */ @Test public void testQueryNoRebalance() { IgniteCache<Object, Object> cache = grid().cache(DEFAULT_CACHE_NAME); cache.put(1, 1); QueryCursor<Cache.Entry<Integer, Integer>> qry = cache.query(new SqlQuery<Integer, Integer>(Integer.class, "_key >= 0")); assertEquals("Bad results count", 1, qry.getAll().size()); }