Jackie-Jiang commented on a change in pull request #6824:
URL: https://github.com/apache/incubator-pinot/pull/6824#discussion_r619377305



##########
File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/interval/Interval.java
##########
@@ -78,19 +74,17 @@ public int hashCode() {
     return result;
   }
 
+  @Nullable
   public static Interval getIntersection(Interval a, Interval b) {
-    Preconditions.checkNotNull(a, "Intersect invalid intervals {} and {}", a, 
b);
-    Preconditions.checkNotNull(b, "Intersect invalid intervals {} and {}", a, 
b);
     if (!a.intersects(b)) {

Review comment:
       It's okay to throw NPE here if there is a bug and we accidentally pass 
`null` into this method. Actually `Preconditions.checkNotNull()` also throws 
NPE. Here we just remove the extra check because this method could be called 
quite frequently.

##########
File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpruner/interval/Interval.java
##########
@@ -78,19 +74,17 @@ public int hashCode() {
     return result;
   }
 
+  @Nullable
   public static Interval getIntersection(Interval a, Interval b) {
-    Preconditions.checkNotNull(a, "Intersect invalid intervals {} and {}", a, 
b);
-    Preconditions.checkNotNull(b, "Intersect invalid intervals {} and {}", a, 
b);
     if (!a.intersects(b)) {
       return null;
     }
     return new Interval(Math.max(a._min, b._min), Math.min(a._max, b._max));
   }
 
+  @Nullable
   public static Interval getUnion(Interval a, Interval b) {
     // Can only merge two intervals if they overlap
-    Preconditions.checkNotNull(a, "Union invalid intervals {} and {}", a, b);
-    Preconditions.checkNotNull(b, "Union invalid intervals {} and {}", a, b);
     if (!a.intersects(b)) {

Review comment:
       Same here




-- 
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to