cassandra icon indicating copy to clipboard operation
cassandra copied to clipboard

Only check overlapping for intersections when building RangeIterator

Open michaeljmarshall opened this issue 2 years ago • 2 comments

The check for isOverlapping calls b.hasNext(). That can be an expensive operation. Since overlapping only matters for intersections, we should only calculate it when we have an intersection.

michaeljmarshall avatar Nov 30 '23 07:11 michaeljmarshall

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.15) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. Read more here

sonarqubecloud[bot] avatar Nov 30 '23 07:11 sonarqubecloud[bot]

this is reasonable, but giving it a (possibly incorrect) default value seems fragile for a public method.

short of deeper surgery, I think making it a Boolean and leaving it null for non-Intersection iterators, then throwing IllegalState in isDisjoint is the simplest option?

jbellis avatar Dec 01 '23 13:12 jbellis

Superseded by https://github.com/datastax/cassandra/pull/1210

michaeljmarshall avatar Aug 01 '24 18:08 michaeljmarshall