squah-confluent commented on code in PR #19678:
URL: https://github.com/apache/kafka/pull/19678#discussion_r2085132731


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/assignor/RangeSet.java:
##########
@@ -44,6 +44,7 @@ public RangeSet(int from, int to) {
 
     @Override
     public int size() {
+        if (to < from) return 0;
         return to - from;

Review Comment:
   I'm hesitant to forbid `to < from` because It's very easy to end up with 
bounds like that when working with ranges. For example, we don't do this 
operation, but a natural implementation of range intersection would be `new 
RangeSet(Math.max(a.from, b.from), Math.min(a.to, b.to))`.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to