maytasm commented on a change in pull request #12334:
URL: https://github.com/apache/druid/pull/12334#discussion_r827684868
##########
File path: core/src/main/java/org/apache/druid/java/util/common/JodaUtils.java
##########
@@ -182,17 +185,16 @@ private static void verifyAscendingSortOrder(Interval
previous, Interval current
public static Interval umbrellaInterval(Iterable<Interval> intervals)
{
- ArrayList<DateTime> startDates = new ArrayList<>();
- ArrayList<DateTime> endDates = new ArrayList<>();
+ DateTimeComparator dateTimeComp = DateTimeComparator.getInstance();
+
+ DateTime minStart = new DateTime(Long.MAX_VALUE);
+ DateTime maxEnd = new DateTime(Long.MIN_VALUE);
for (Interval interval : intervals) {
- startDates.add(interval.getStart());
- endDates.add(interval.getEnd());
+ minStart = Collections.min(ImmutableList.of(minStart,
interval.getStart()), dateTimeComp);
+ maxEnd = Collections.max(ImmutableList.of(maxEnd, interval.getEnd()),
dateTimeComp);
}
- DateTime minStart = minDateTime(startDates.toArray(new DateTime[0]));
- DateTime maxEnd = maxDateTime(endDates.toArray(new DateTime[0]));
-
if (minStart == null || maxEnd == null) {
Review comment:
Oops. Fixed.
--
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]