julianhyde commented on a change in pull request #2238:
URL: https://github.com/apache/calcite/pull/2238#discussion_r520039486



##########
File path: core/src/main/java/org/apache/calcite/util/RangeSets.java
##########
@@ -128,6 +129,14 @@ private RangeSets() {}
         && !range.isEmpty();
   }
 
+  /** Returns whether a range set is a single open interval. */
+  public static <C extends Comparable<C>> boolean isOpenInterval(RangeSet<C> 
rangeSet) {
+    final Set<Range<C>> ranges = rangeSet.asRanges();
+    final Range<C> range = ranges.iterator().next();
+    return ranges.size() == 1

Review comment:
       Will throw if `ranges.isEmpty()` because you iterate before you check 
`size`. Add a test where this is called on an empty range set.




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