JodaUtils.umbrellaInterval(segments.stream().map(DataSegment::getInterval).collect(Collectors.toList())); LOG.info("Building timeline for umbrella Interval [{}]", indexedInterval); timeline = getTimelineForIntervalWithHandle(handle, dataSource, indexedInterval, metadataStorageTablesConfig);
SegmentProvider(List<DataSegment> segments) { Preconditions.checkArgument(segments != null && !segments.isEmpty()); final String dataSource = segments.get(0).getDataSource(); Preconditions.checkArgument( segments.stream().allMatch(segment -> segment.getDataSource().equals(dataSource)), "segments should have the same dataSource" ); this.segments = segments; this.dataSource = dataSource; this.interval = JodaUtils.umbrellaInterval( segments.stream().map(DataSegment::getInterval).collect(Collectors.toList()) ); }
public static SortedSet<Interval> computeCompactIntervals(SortedSet<Interval> intervals) { final SortedSet<Interval> compactIntervals = new TreeSet<>(Comparators.intervalsByStartThenEnd()); List<Interval> toBeAccumulated = new ArrayList<>(); for (Interval interval : intervals) { if (toBeAccumulated.size() == 0) { toBeAccumulated.add(interval); } else { if (toBeAccumulated.get(toBeAccumulated.size() - 1).abuts(interval)) { toBeAccumulated.add(interval); } else { compactIntervals.add(JodaUtils.umbrellaInterval(toBeAccumulated)); toBeAccumulated = Lists.newArrayList(interval); } } } if (toBeAccumulated.size() > 0) { compactIntervals.add(JodaUtils.umbrellaInterval(toBeAccumulated)); } return compactIntervals; } }
@VisibleForTesting Interval findIntervalForKillTask(String dataSource, int limit) { List<Interval> unusedSegmentIntervals = segmentManager.getUnusedSegmentIntervals( dataSource, new Interval(DateTimes.EPOCH, DateTimes.nowUtc().minus(retainDuration)), limit ); if (unusedSegmentIntervals != null && unusedSegmentIntervals.size() > 0) { return JodaUtils.umbrellaInterval(unusedSegmentIntervals); } else { return null; } } }
@Override public boolean isReady(TaskActionClient taskActionClient) throws Exception { Optional<SortedSet<Interval>> intervals = spec.getDataSchema().getGranularitySpec().bucketIntervals(); if (intervals.isPresent()) { Interval interval = JodaUtils.umbrellaInterval( JodaUtils.condenseIntervals( intervals.get() ) ); return taskActionClient.submit(new LockTryAcquireAction(TaskLockType.EXCLUSIVE, interval)) != null; } else { return true; } }
Interval interval = JodaUtils.umbrellaInterval( JodaUtils.condenseIntervals( indexerSchema.getDataSchema().getGranularitySpec().bucketIntervals().get()