apache/druid · error · org.apache.druid.java.util.common.IAE
Comparing arrays of quantiles is not supported
Error message
Comparing arrays of quantiles is not supported
What it means
DoublesSketchToQuantilesPostAggregator returns an array of quantile values (double[]). Since arrays of quantiles have no natural ordering, getComparator() throws IllegalArgumentException('Comparing arrays of quantiles is not supported') whenever the engine requests a comparator for this output.
Solutions
- Order by a single scalar value instead (e.g. DoublesSketchToQuantilePostAggregator for one fraction).
- Remove the sorting spec that references the quantiles post-aggregator.
- Sort client-side after retrieving results.
Example fix
// before
{"orderByColumn":"quantiles"} // array output, throws
// after
{"orderByColumn":"median"} // quantilesDoublesSketchToQuantile post-agg (scalar) Defensive patterns
Strategy: validation
Validate before calling
if (orderByColumns.contains(quantilesPostAggName)) { throw new IllegalArgumentException("Cannot ORDER BY quantiles array output; use a scalar quantile post-agg"); } Try / catch
try { druidClient.run(query); } catch (IllegalArgumentException e) { if (e.getMessage().contains("Comparing arrays of quantiles")) { /* replace sort key */ } } Prevention
- Use DoublesSketchToQuantile (singular) when a sortable scalar is needed.
- Keep quantiles array output out of limitSpec/orderBy.
When it happens
Trigger: Referencing the quantiles post-aggregator output in an ORDER BY clause, as a topN metric, or in a groupBy limitSpec sorting column.
Common situations: Trying to order query results by the quantiles array; copying a limitSpec that named the sketch column without realizing the post-agg output is an array.
Related errors
- Comparing histograms is not supported
- Comparing histograms is not supported
- Comparing sketch summaries is not supported
- Comparing arrays of estimate values is not supported
- Comparing arrays of estimates and error bounds is not…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/d1bcefe209c76ab4.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilesPostAggregator.java:97
return fractions;
}
@Override
public Object compute(final Map<String, Object> combinedAggregators)
{
final DoublesSketch sketch = (DoublesSketch) field.compute(combinedAggregators);
if (sketch.isEmpty()) {
final double[] quantiles = new double[fractions.length];
Arrays.fill(quantiles, Double.NaN);
return quantiles;
}
return sketch.getQuantiles(fractions);
}
@Override
public Comparator<double[]> getComparator()
{
throw new IAE("Comparing arrays of quantiles is not supported");
}
@Override
public Set<String> getDependentFields()
{
return field.getDependentFields();
}
@Override
public String toString()
{
return getClass().getSimpleName() + "{" +
"name='" + name + '\'' +
", field=" + field +
", fractions=" + Arrays.toString(fractions) +
"}";
}
View on GitHub (pinned to 9b90983fd2)