You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ja...@apache.org on 2017/10/05 23:01:58 UTC

[geode] 02/03: SpotlessApply and added comment into test describing when getSizeEstimate is called

This is an automated email from the ASF dual-hosted git repository.

jasonhuynh pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 319fd6f4ddf0ffa238661d53f7a7c5b238ff5bc2
Author: Jason Huynh <hu...@gmail.com>
AuthorDate: Wed Oct 4 11:31:05 2017 -0700

    SpotlessApply and added comment into test describing when getSizeEstimate is called
---
 .../query/internal/index/CompactRangeIndex.java      |  6 +++---
 .../index/CompactRangeIndexQueryIntegrationTest.java | 20 +++++++++-----------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactRangeIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactRangeIndex.java
index 2cb7857..7031532 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactRangeIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/CompactRangeIndex.java
@@ -430,9 +430,9 @@ public class CompactRangeIndex extends AbstractIndex {
           break;
       }
     } catch (ClassCastException e) {
-      //no values will match in this index because the key types are not the same
-      //This means that there will be 0 results and it will be fast to use this index
-      //because it has filtered everything out
+      // no values will match in this index because the key types are not the same
+      // This means that there will be 0 results and it will be fast to use this index
+      // because it has filtered everything out
       return 0;
     } catch (EntryDestroyedException ignore) {
       return Integer.MAX_VALUE;
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/CompactRangeIndexQueryIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/CompactRangeIndexQueryIntegrationTest.java
index e970e7d..ed9d8fb 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/CompactRangeIndexQueryIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/CompactRangeIndexQueryIntegrationTest.java
@@ -108,28 +108,26 @@ public class CompactRangeIndexQueryIntegrationTest {
   }
 
   @Test
-  public void getSizeEstimateShouldNotThrowClassCastException()
-      throws Exception {
+  // getSizeEstimate will be called only when having a choice between two indexes
+  public void getSizeEstimateShouldNotThrowClassCastException() throws Exception {
     String regionName = "portfolio";
 
     Cache cache = serverStarterRule.getCache();
     assertNotNull(cache);
-    Region region = cache.createRegionFactory().setDataPolicy(DataPolicy.REPLICATE).create(regionName);
+    Region region =
+        cache.createRegionFactory().setDataPolicy(DataPolicy.REPLICATE).create(regionName);
 
-    Portfolio p = new Portfolio(1, 2);
+    Portfolio p = new Portfolio(1);
     region.put(1, p);
-
-    Portfolio p2 = new Portfolio(3, 4);
+    Portfolio p2 = new Portfolio(3);
     region.put(2, p2);
 
     QueryService queryService = cache.getQueryService();
-    CompactRangeIndex statusIndex = (CompactRangeIndex)queryService.createIndex("statusIndex", "status", "/portfolio");
-    CompactRangeIndex idIndex = (CompactRangeIndex)queryService.createIndex("idIndex", "ID", "/portfolio");
+    queryService.createIndex("statusIndex", "status", "/portfolio");
+    queryService.createIndex("idIndex", "ID", "/portfolio");
 
     SelectResults results = (SelectResults) queryService
-        .newQuery(
-            "select * from /portfolio where status = 4 AND ID = 'StringID'")
-        .execute();
+        .newQuery("select * from /portfolio where status = 4 AND ID = 'StringID'").execute();
 
     assertNotNull(results);
   }

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <co...@geode.apache.org>.