JodaUtils.umbrellaInterval(segments.stream().map(DataSegment::getInterval).collect(Collectors.toList())); LOG.info("Building timeline for umbrella Interval [{}]", indexedInterval); timeline = getTimelineForIntervalWithHandle(handle, dataSource, indexedInterval, metadataStorageTablesConfig);
@JsonCreator public MultipleIntervalSegmentSpec( @JsonProperty("intervals") List<Interval> intervals ) { this.intervals = Collections.unmodifiableList(JodaUtils.condenseIntervals(intervals)); }
@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; } }
public static Interval umbrellaInterval(Iterable<Interval> intervals) { ArrayList<DateTime> startDates = Lists.newArrayList(); ArrayList<DateTime> endDates = Lists.newArrayList(); for (Interval interval : intervals) { startDates.add(interval.getStart()); endDates.add(interval.getEnd()); } DateTime minStart = minDateTime(startDates.toArray(new DateTime[]{})); DateTime maxEnd = maxDateTime(endDates.toArray(new DateTime[]{})); if (minStart == null || maxEnd == null) { throw new IllegalArgumentException("Empty list of intervals"); } return new Interval(minStart, maxEnd); }
@Override public List<Interval> getIntervals() { if (intervals != null) { return intervals; } intervals = JodaUtils.condenseIntervals( Iterables.transform( descriptors, new Function<SegmentDescriptor, Interval>() { @Override public Interval apply(SegmentDescriptor input) { return input.getInterval(); } } ) ); return intervals; }
Interval interval = JodaUtils.umbrellaInterval( JodaUtils.condenseIntervals( indexerSchema.getDataSchema().getGranularitySpec().bucketIntervals().get()
minTime = JodaUtils.minDateTime(minTime, index.getDataInterval().getStart()); maxTime = JodaUtils.maxDateTime(maxTime, index.getDataInterval().getEnd());
@JsonCreator public SegmentListUsedAction( @JsonProperty("dataSource") String dataSource, @Deprecated @JsonProperty("interval") Interval interval, @JsonProperty("intervals") List<Interval> intervals ) { this.dataSource = dataSource; Preconditions.checkArgument( interval == null || intervals == null, "please specify intervals only" ); List<Interval> theIntervals = null; if (interval != null) { theIntervals = ImmutableList.of(interval); } else if (intervals != null && intervals.size() > 0) { theIntervals = JodaUtils.condenseIntervals(intervals); } this.intervals = Preconditions.checkNotNull(theIntervals, "no intervals found"); }
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 Optional<List<Interval>> getIntervals() { Optional<SortedSet<Interval>> setOptional = schema.getDataSchema().getGranularitySpec().bucketIntervals(); if (setOptional.isPresent()) { return Optional.of((List<Interval>) JodaUtils.condenseIntervals(setOptional.get())); } else { return Optional.absent(); } }
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; } }
@JsonCreator public IntervalDimFilter( @JsonProperty("dimension") String dimension, @JsonProperty("intervals") List<Interval> intervals, @JsonProperty("extractionFn") ExtractionFn extractionFn ) { Preconditions.checkNotNull(dimension, "dimension can not be null"); Preconditions.checkNotNull(intervals, "intervals can not be null"); Preconditions.checkArgument(intervals.size() > 0, "must specify at least one interval"); this.dimension = dimension; this.intervals = Collections.unmodifiableList(JodaUtils.condenseIntervals(intervals)); this.extractionFn = extractionFn; this.intervalLongs = makeIntervalLongs(); this.convertedFilter = new OrDimFilter(makeBoundDimFilters()); }
@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; } } }
@GET @Path("/{dataSourceName}/candidates") @Produces(MediaType.APPLICATION_JSON) @ResourceFilters(DatasourceResourceFilter.class) public Iterable<LocatedSegmentDescriptor> getQueryTargets( @PathParam("dataSourceName") String datasource, @QueryParam("intervals") String intervals, @QueryParam("numCandidates") @DefaultValue("-1") int numCandidates, @Context final HttpServletRequest req ) throws IOException { List<Interval> intervalList = Lists.newArrayList(); for (String interval : intervals.split(",")) { intervalList.add(Intervals.of(interval.trim())); } List<Interval> condensed = JodaUtils.condenseIntervals(intervalList); return ServerViewUtil.getTargetLocations(timelineServerView, datasource, condensed, numCandidates); }
theIntervals = ImmutableList.of(interval); } else if (intervals != null && intervals.size() > 0) { theIntervals = JodaUtils.condenseIntervals(intervals);
final List<Interval> intervals = JodaUtils.condenseIntervals( Iterables.transform(entry.getValue(), new Function<SegmentIdentifier, Interval>()
@VisibleForTesting public static SegmentAnalysis finalizeAnalysis(SegmentAnalysis analysis) { return new SegmentAnalysis( analysis.getId(), analysis.getIntervals() != null ? JodaUtils.condenseIntervals(analysis.getIntervals()) : null, analysis.getColumns(), analysis.getSize(), analysis.getNumRows(), analysis.getAggregators(), analysis.getTimestampSpec(), analysis.getQueryGranularity(), analysis.isRollup() ); }
.getGranularitySpec() .withIntervals( JodaUtils.condenseIntervals( shardSpecs.getIntervals()