use of org.apache.geode.cache.query.data.Portfolio in project geode by apache.
the class HashIndexQueryIntegrationTest method testHashIndexOnNonSequentialHashForLocalRegion.
/**
* Tests that hash index on non sequential hashes for local region
*
* @throws Exception
*/
@Test
public void testHashIndexOnNonSequentialHashForLocalRegion() throws Exception {
createLocalRegion("portfolios");
for (int i = 0; i < 100; i++) {
Portfolio p = new Portfolio(i);
p.shortID = (short) i;
region.put("" + i, p);
}
for (int i = 200; i < 300; i++) {
Portfolio p = new Portfolio(i);
p.shortID = (short) i;
region.put("" + i, p);
}
for (int i = 500; i < 600; i++) {
Portfolio p = new Portfolio(i);
p.shortID = (short) i;
region.put("" + i, p);
}
helpTestHashIndexForQuery("Select * FROM /portfolios p where p.ID != 1");
}
use of org.apache.geode.cache.query.data.Portfolio in project geode by apache.
the class HashIndexQueryIntegrationTest method testHashIndexWithLimitQueryForLocalRegion.
/**
* Tests that hash index is used and that it returns the correct result for local region
*
* @throws Exception
*/
@Test
public void testHashIndexWithLimitQueryForLocalRegion() throws Exception {
createLocalRegion("portfolios");
int numEntries = 200;
int numIds = 100;
for (int i = 0; i < numEntries; i++) {
Portfolio p = new Portfolio(i % (numIds));
p.shortID = (short) i;
region.put("" + i, p);
}
helpTestHashIndexForQuery("SELECT * FROM /portfolios.entries p WHERE p.key = '1' limit 3", "p.key", "/portfolios.entries p");
}
use of org.apache.geode.cache.query.data.Portfolio in project geode by apache.
the class HashIndexQueryIntegrationTest method testHashIndexWithNestedQueryWithShortVsIntegerCompareForLocalRegion.
/**
* Tests that hash index with Short vs Integer comparison
*
* @throws Exception
*/
@Test
public void testHashIndexWithNestedQueryWithShortVsIntegerCompareForLocalRegion() throws Exception {
createLocalRegion("portfolios");
int numEntries = 200;
int numIds = 100;
for (int i = 0; i < numEntries; i++) {
Portfolio p = new Portfolio(i % (numIds));
p.shortID = (short) i;
region.put("" + i, p);
}
helpTestHashIndexForQuery("SELECT * FROM /portfolios p WHERE p.shortID in (SELECT p2.ID FROM /portfolios p2 WHERE p2.shortID = 1)", "p.shortID", "/portfolios p");
}
use of org.apache.geode.cache.query.data.Portfolio in project geode by apache.
the class HashIndexQueryIntegrationTest method testHashIndexOnNonSequentialHashForPartitionedRegion.
/**
* Tests that hash index on non sequential hashes for partitioned region
*
* @throws Exception
*/
@Test
public void testHashIndexOnNonSequentialHashForPartitionedRegion() throws Exception {
createPartitionedRegion("portfolios");
for (int i = 0; i < 100; i++) {
Portfolio p = new Portfolio(i);
p.shortID = (short) i;
region.put("" + i, p);
}
for (int i = 200; i < 300; i++) {
Portfolio p = new Portfolio(i);
p.shortID = (short) i;
region.put("" + i, p);
}
for (int i = 500; i < 600; i++) {
Portfolio p = new Portfolio(i);
p.shortID = (short) i;
region.put("" + i, p);
}
helpTestHashIndexForQuery("Select * FROM /portfolios p where p.ID != 1");
}
use of org.apache.geode.cache.query.data.Portfolio in project geode by apache.
the class HashIndexQueryIntegrationTest method testHashIndexEqualsForMultipleResultQueryOnPartitionedRegion.
/**
* Tests that hash index is used and that it returns the correct number of results on partitioned
* region
*
* @throws Exception
*/
@Test
public void testHashIndexEqualsForMultipleResultQueryOnPartitionedRegion() throws Exception {
createPartitionedRegion("portfolios");
// Create the data
int numEntries = 200;
int numIds = 100;
for (int i = 0; i < numEntries; i++) {
Portfolio p = new Portfolio(i % (numIds));
p.shortID = (short) i;
region.put("" + i, p);
}
helpTestHashIndexForQuery("Select * FROM /portfolios p where p.ID = 1");
}
Aggregations