apache/druid · error · IAE

Overlapping intervals: %s, %s

Error message

Overlapping intervals: %s, %s

What it means

ArbitraryGranularitySpec validates that the sorted per-segment bucket intervals it generates do not overlap. During partitioning/granularity setup, if two consecutive bucket intervals overlap, this IAE is thrown because segment granularity buckets must be disjoint for correct data distribution. It indicates the granularity spec input or the underlying data intervals are inconsistent.

Source

Thrown at processing/src/main/java/org/apache/druid/indexer/granularity/ArbitraryGranularitySpec.java:58

  public ArbitraryGranularitySpec(
      @JsonProperty("queryGranularity") Granularity queryGranularity,
      @JsonProperty("rollup") Boolean rollup,
      @JsonProperty("intervals") @Nullable List<Interval> inputIntervals
  )
  {
    super(inputIntervals, rollup);
    this.queryGranularity = queryGranularity == null ? Granularities.NONE : queryGranularity;

    lookupTableBucketByDateTime = new LookupIntervalBuckets(inputIntervals);

    // Ensure intervals are non-overlapping (but they may abut each other)
    final PeekingIterator<Interval> intervalIterator = Iterators.peekingIterator(sortedBucketIntervals().iterator());
    while (intervalIterator.hasNext()) {
      final Interval currentInterval = intervalIterator.next();
      if (intervalIterator.hasNext()) {
        final Interval nextInterval = intervalIterator.peek();
        if (currentInterval.overlaps(nextInterval)) {
          throw new IAE("Overlapping intervals: %s, %s", currentInterval, nextInterval);
        }
      }
    }
  }

  public ArbitraryGranularitySpec(
      Granularity queryGranularity,
      List<Interval> inputIntervals
  )
  {
    this(queryGranularity, true, inputIntervals);
  }

  @Override
  public Iterable<Interval> sortedBucketIntervals()
  {
    return () -> lookupTableBucketByDateTime.iterator();
  }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Inspect the two intervals printed in the message and fix the granularity spec so intervals are disjoint (no overlaps, no duplicates).
  2. If intervals were supplied programmatically, sort and deduplicate/merge them before building the spec.
  3. Use a standard GranularitySpec (e.g. uniformGranularity) if fixed granularities are sufficient and custom intervals are error-prone.

Example fix

// before
List<Interval> intervals = Arrays.asList(
  Intervals.of("2024-01-01/2024-01-05"),
  Intervals.of("2024-01-03/2024-01-10")); // overlap
// after
List<Interval> intervals = Arrays.asList(
  Intervals.of("2024-01-01/2024-01-05"),
  Intervals.of("2024-01-05/2024-01-10")); // adjacent, non-overlapping
Defensive patterns

Strategy: validation

Validate before calling

for (int i = 1; i < intervals.size(); i++) {
  if (intervals.get(i - 1).overlaps(intervals.get(i))) {
    throw new IllegalArgumentException("Overlapping intervals: " + intervals.get(i - 1) + ", " + intervals.get(i));
  }
}

Prevention

When it happens

Trigger: Constructing or using an ArbitraryGranularitySpec whose granularities/buckets produce intersecting Intervals, e.g. duplicate or partially-overlapping intervals passed into the spec during batch ingestion task setup.

Common situations: Hand-written ingestion specs where arbitrary intervals were listed twice or with offset mistakes; programmatic spec generation producing overlapping segmentGranular intervals; time zone/DST math shifting interval boundaries so adjacent buckets intersect.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/ff4762cdcc08be96. Report an issue: GitHub.