adelapena commented on code in PR #2495:
URL: https://github.com/apache/cassandra/pull/2495#discussion_r1265444512


##########
src/java/org/apache/cassandra/index/sai/iterators/KeyRangeIntersectionIterator.java:
##########
@@ -249,14 +249,24 @@ private void updateStatistics(Statistics statistics, 
KeyRangeIterator range)
 
     private static class IntersectionStatistics extends 
KeyRangeIterator.Builder.Statistics
     {
+        private boolean empty = true;
+
         @Override
         public void update(KeyRangeIterator range)
         {
             // minimum of the intersection is the biggest minimum of 
individual iterators
             min = nullSafeMax(min, range.getMinimum());
             // maximum of the intersection is the smallest maximum of 
individual iterators
             max = nullSafeMin(max, range.getMaximum());
-            count += range.getCount();
+            if (empty)
+            {
+                empty = false;
+                count = range.getCount();
+            }
+            else
+            {
+                count = Math.min(count, range.getCount());
+            }

Review Comment:
   Ah, I see.



-- 
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.

To unsubscribe, e-mail: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to