albertogpz commented on a change in pull request #6279:
URL: https://github.com/apache/geode/pull/6279#discussion_r612392961



##########
File path: 
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/IndexStatisticsJUnitTest.java
##########
@@ -345,19 +345,18 @@ public void testStatsForCompactMapRangeIndex() throws 
Exception {
     IndexStatistics keyIndexStats = keyIndex3.getStatistics();
 
     assertEquals(2, keyIndexStats.getNumberOfMapIndexKeys());
-    assertEquals(100, keyIndexStats.getNumberOfKeys());
-    assertEquals(100, keyIndexStats.getNumberOfKeys());
-    assertEquals(100, keyIndexStats.getNumberOfValues());
-    assertEquals(100, keyIndexStats.getNumUpdates());
+    assertEquals(102, keyIndexStats.getNumberOfKeys());
+    assertEquals(200, keyIndexStats.getNumberOfValues());
+    assertEquals(200, keyIndexStats.getNumUpdates());
 

Review comment:
       The reason for numbers doubling in size is that, in order to support the 
queries with "!=" and with null comparisons, the index needs to store the entry 
for each key in the index no matter if the entry contains the indexed keys in 
the map field.
   
   For example, if the index is positions['DELL', 'YAHOO'] and an entry is 
added to the region for which positions is {'DELL' -> '3'], the index will 
contain two values:
   - for 'DELL', for key='3' and the entry as value.
   - for 'YAHOO' for key=IndexManager.NULL and the entry as value.
   
   Prior to this change, the index only stored the first value and, as a 
consequence, queries like the following: positions['YAHOO'] = null or 
positions['YAHOO'] != '3' did not return all the right results.
   
   For those cases where 2 has been added to the number of keys, it is due to 
keys equal to IndexManager.NULL or Undefined. Nevertheless this has been 
corrected in the last commit so that these counters are aligned with the non 
compact indexes that do not count Null or Undefined as keys.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to