use of org.apache.geode.cache.query.internal.index.CompactRangeIndex in project geode by apache.
the class IndexCreationJUnitTest method testBug36591.
/**
* The Index maintenance has a bug as it does not re-evaluate the index maintenance collection in
* the IMQEvaluator when an entry gets modified & so the index resultset is messed up
*/
@Test
public void testBug36591() throws Exception {
QueryService qs;
qs = CacheUtils.getQueryService();
Index i1 = qs.createIndex("keyIndex", IndexType.FUNCTIONAL, "ks.hashCode", "/portfolios.keys ks");
Region rgn = CacheUtils.getRegion("/portfolios");
rgn.put("4", new Portfolio(4));
rgn.put("5", new Portfolio(5));
CacheUtils.log(((CompactRangeIndex) i1).dump());
Query qr = qs.newQuery("Select distinct * from /portfolios.keys keys where keys.hashCode >= $1");
SelectResults sr = (SelectResults) qr.execute(new Object[] { new Integer(-1) });
assertEquals(6, sr.size());
}
use of org.apache.geode.cache.query.internal.index.CompactRangeIndex in project geode by apache.
the class IndexCreationJUnitTest method testIMQFailureAsMethodKeysNAInDummyQRegion.
/**
* Test the Index maiantenance as it may use the method keys() of QRegion instead of DummyQRegion
* while running an IndexMaintenanceQuery
*/
@Test
public void testIMQFailureAsMethodKeysNAInDummyQRegion() throws Exception {
QueryService qs;
qs = CacheUtils.getQueryService();
Index i1 = qs.createIndex("keyIndex", IndexType.FUNCTIONAL, "ks.hashCode", "/portfolios.keys() ks");
Region rgn = CacheUtils.getRegion("/portfolios");
rgn.put("4", new Portfolio(4));
rgn.put("5", new Portfolio(5));
CacheUtils.log(((CompactRangeIndex) i1).dump());
Query qr = qs.newQuery("Select distinct keys.hashCode from /portfolios.keys() keys where keys.hashCode >= $1");
SelectResults sr = (SelectResults) qr.execute(new Object[] { new Integer(-1) });
assertEquals(6, sr.size());
}
use of org.apache.geode.cache.query.internal.index.CompactRangeIndex in project geode by apache.
the class IndexCreationJUnitTest method testIndexCreationOnKeys.
@Test
public void testIndexCreationOnKeys() throws Exception {
// Task ID : ICM 9
QueryService qs;
qs = CacheUtils.getQueryService();
Index i1 = qs.createIndex("kIndex", IndexType.FUNCTIONAL, "pf", "/portfolios.keys pf");
Index i2 = qs.createIndex("k1Index", IndexType.FUNCTIONAL, "key", "/portfolios.entries");
Index i3 = qs.createIndex("k2Index", IndexType.FUNCTIONAL, "pf", "/portfolios.keys.toArray pf");
// Index i4 = qs.createIndex("k3Index", IndexType.FUNCTIONAL,
// "pf","/portfolios.keys().toArray() pf");
Index i5 = qs.createIndex("k4Index", IndexType.FUNCTIONAL, "pf", "/portfolios.getKeys.asList pf");
// Index i5 = qs.createIndex("k5Index", IndexType.FUNCTIONAL,
// "pf","/portfolios.getKeys.asList() pf");
Index i6 = qs.createIndex("k5Index", IndexType.FUNCTIONAL, "pf", "/portfolios.getKeys.asSet() pf");
// Index i5 = qs.createIndex("k5Index", IndexType.FUNCTIONAL,
// "pf","/portfolios.getKeys.asSet pf");
CacheUtils.log(((CompactRangeIndex) i1).dump());
CacheUtils.log(((CompactRangeIndex) i2).dump());
CacheUtils.log(((CompactRangeIndex) i3).dump());
CacheUtils.log(((CompactRangeIndex) i5).dump());
CacheUtils.log(((CompactRangeIndex) i6).dump());
}
use of org.apache.geode.cache.query.internal.index.CompactRangeIndex in project geode by apache.
the class IndexCreationJUnitTest method testIndexCreationOnRegionEntry.
@Test
public void testIndexCreationOnRegionEntry() throws Exception {
// Task ID : ICM11
QueryService qs;
qs = CacheUtils.getQueryService();
Index i1 = qs.createIndex("r1Index", IndexType.FUNCTIONAL, "secId", "/portfolios.values['1'].positions.values");
qs.createIndex("r12Index", IndexType.FUNCTIONAL, "secId", "/portfolios['1'].positions.values");
CacheUtils.log(((CompactRangeIndex) i1).dump());
// CacheUtils.log(((RangeIndex)i2).dump());
}
use of org.apache.geode.cache.query.internal.index.CompactRangeIndex in project geode by apache.
the class IndexCreationJUnitTest method testIndexCreationWithFunctionsinFromClause.
@Test
public void testIndexCreationWithFunctionsinFromClause() throws Exception {
// Task ID: ICM13
QueryService qs;
qs = CacheUtils.getQueryService();
// BUG #32586 : FIXED
Index i1 = qs.createIndex("Index11", IndexType.FUNCTIONAL, "status", "/portfolios.values.toArray()");
Index i2 = qs.createIndex("Index12", IndexType.FUNCTIONAL, "ID", "/portfolios.values.asSet");
Index i3 = qs.createIndex("Index13", IndexType.FUNCTIONAL, "ID", "/portfolios.values.asList");
qs.createIndex("Index14", IndexType.FUNCTIONAL, "value.ID", "/portfolios.entries.toArray()");
qs.createIndex("Index15", IndexType.FUNCTIONAL, "value.ID", "/portfolios.entries.asSet");
qs.createIndex("Index16", IndexType.FUNCTIONAL, "value.ID", "/portfolios.entries.asList");
// BUG #32586 : FIXED
qs.createIndex("Index17", IndexType.FUNCTIONAL, "kIter", "/portfolios.keys.toArray() kIter");
qs.createIndex("Index18", IndexType.FUNCTIONAL, "kIter", "/portfolios.keys.asSet kIter");
qs.createIndex("Index19", IndexType.FUNCTIONAL, "kIter", "/portfolios.keys.asList kIter");
CacheUtils.log(((CompactRangeIndex) i1).dump());
CacheUtils.log(((CompactRangeIndex) i2).dump());
CacheUtils.log(((CompactRangeIndex) i3).dump());
}
Aggregations