apache/druid · error · IllegalArgumentException
Distinct intervals in input segments may not overlap: [%s] v
Error message
Distinct intervals in input segments may not overlap: [%s] vs [%s]
What it means
After constructing the timeline from the provided segment IDs, DruidInputSource validates that distinct intervals do not partially overlap. Segments may share an identical interval, but partially overlapping intervals (e.g. from differing segment granularities) cannot form a valid timeline, so it throws IllegalArgumentException.
Source
Thrown at indexing-service/src/main/java/org/apache/druid/indexing/input/DruidInputSource.java:648
timeline.put(
interval,
new TimelineObjectHolder<>(
interval,
segment.getInterval(),
segment.getVersion(),
new PartitionHolder<>(segment.getShardSpec().createChunk(segment))
)
);
}
}
}
// Validate that none of the given windows overlaps (except for when multiple segments share exactly the
// same interval).
Interval lastInterval = null;
for (Interval interval : timeline.keySet()) {
if (lastInterval != null && interval.overlaps(lastInterval)) {
throw new IAE(
"Distinct intervals in input segments may not overlap: [%s] vs [%s]",
lastInterval,
interval
);
}
lastInterval = interval;
}
return new ArrayList<>(timeline.values());
}
/**
* @return Number of segments read by this input source. This value is null until
* the method {@link #fixedFormatReader} has been invoked on this input source.
*/
public int getNumberOfSegmentsRead()
{
return numSegmentsInTimeline;View on GitHub (pinned to 9b90983fd2)
Solutions
- Use segment IDs with consistent, non-overlapping (or exactly equal) intervals.
- Align all selected segments to a single segment granularity.
- Switch to an 'interval'-based DruidInputSource and let the server timeline resolve overshadowing.
Example fix
// before segments = ["ds_hourly_2020-01-01T00_2020-01-01T01_v1", "ds_daily_2020-01-01_2020-01-02_v1"] // after segments = ["ds_daily_2020-01-01_2020-01-02_v1"]
Defensive patterns
Strategy: validation
Validate before calling
List<Interval> sorted = segments.stream()
.map(DataSegment::getInterval)
.sorted(Interval::compare)
.collect(Collectors.toList());
for (int i = 1; i < sorted.size(); i++) {
Interval a = sorted.get(i - 1), b = sorted.get(i);
if (!a.equals(b) && b.overlaps(a)) {
throw new IllegalArgumentException("Overlapping intervals: " + a + " vs " + b);
}
} Try / catch
try {
List<DataSegment> timeline = inputSource.createTimeline();
} catch (IllegalArgumentException e) {
// select segments with consistent granularity / non-overlapping intervals
} Prevention
- Keep segment granularity uniform across selected segments.
- After compaction that changes granularity, regenerate segment lists instead of reusing old ones.
- Validate interval overlap client-side before submitting.
When it happens
Trigger: Supplying a 'segments' list where one segment's interval partially overlaps another's — e.g. mixing hourly and daily segments covering overlapping but unequal windows.
Common situations: Combining segments produced before and after a segment-granularity change (hourly vs daily); hand-assembling segment IDs across a compaction that changed granularity.
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
- Interval[%s] to compact is not aligned with segmentGranulari
- Aggregation [%s] does not support column [%s] of type [%s].
- Cannot accept both 'splitPoints' and 'numBins'
- at least 2 bins expected
- at least 2 bins expected
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/96dfc679a3ce5dff.
Report an issue: GitHub.