apache/druid · error · IllegalArgumentException
Comparing arrays of estimates and error bounds is not…
Error message
Comparing arrays of estimates and error bounds is not supported
What it means
ArrayOfDoublesSketchToEstimateAndBoundsPostAggregator emits a double[] of an estimate plus lower/upper confidence bounds. There is no defined ordering over such arrays, so getComparator() throws IAE unconditionally to reject sorting on this output.
Solutions
- Use ArrayOfDoublesSketchToEstimatePostAggregator (single double value) if you need a sortable estimate
- Sort on a different numeric post-aggregator or metric
- Do the ordering client-side after receiving the arrays
Example fix
// before
new ArrayOfDoublesSketchToEstimateAndBoundsPostAggregator("eab", "sketch") used in orderBy
// after
new ArrayOfDoublesSketchToEstimatePostAggregator("est", "sketch") used in orderBy Defensive patterns
Strategy: try-catch
Validate before calling
if (orderByColumns.stream().anyMatch(c -> "estimateAndBounds".equals(c.getDimension()))) {
throw new IllegalArgumentException("Cannot order by estimate-and-bounds array output");
} Try / catch
try {
return queryClient.run(query);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().contains("estimates and error bounds")) {
return runQueryWithAlternateOrdering(query, "estimate");
}
throw e;
} Prevention
- Use the single-value estimate post-aggregator when a sortable value is needed
- Keep DOUBLE_ARRAY post-aggregator outputs out of sort specifications
- Review generated order-by specs against post-aggregator output types
When it happens
Trigger: Calling getComparator(), e.g. when the post-aggregator is referenced in an orderBy spec or a sort-enabled query layer iterates post-aggregators for comparators.
Common situations: Users sorting results by estimate-and-bounds output; generic tooling assuming every post-aggregator provides a comparator.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Comparing arrays of estimate values is not supported
- Comparing arrays of mean values is not supported
- Comparing arrays of p values is not supported
- Comparing arrays of quantiles is not supported
- Comparing arrays of quantiles is not supported
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/c22618b5c89a1fea.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchToEstimateAndBoundsPostAggregator.java:82
}
@Override
public double[] compute(final Map<String, Object> combinedAggregators)
{
final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators);
return new double[] {sketch.getEstimate(), sketch.getLowerBound(numStdDevs), sketch.getUpperBound(numStdDevs)};
}
@Override
public ColumnType getType(ColumnInspector signature)
{
return ColumnType.DOUBLE_ARRAY;
}
@Override
public Comparator<double[]> getComparator()
{
throw new IAE("Comparing arrays of estimates and error bounds is not supported");
}
@Override
public String toString()
{
return this.getClass().getSimpleName() + "{" +
"name='" + getName() + '\'' +
", field=" + getField() +
", numStdDevs=" + numStdDevs +
"}";
}
@Override
public boolean equals(final Object o)
{
if (!super.equals(o)) {
return false;
}View on GitHub (pinned to 9b90983fd2)