apache/druid · error · IllegalArgumentException
Comparing arrays of quantiles is not supported
Error message
Comparing arrays of quantiles is not supported
What it means
KLL_SKETCH_TO_QUANTILES returns an array of floats (one quantile per requested fraction). Arrays of quantiles have no defined total ordering, so getComparator() intentionally throws IAE if Druid ever needs to compare two results.
Solutions
- Order by a scalar column or a single-quantile post-aggregator (KLL_SKETCH_TO_QUANTILE) instead.
- Remove the post-aggregator from any comparison/ordering context and post-process the array client-side.
- If you need a single comparable value, request a single fraction and index into the returned array.
Example fix
// before ... ORDER BY "quantiles_output" // after ... ORDER BY quantileExpression -- e.g. KLL_SKETCH_TO_QUANTILE with a single fraction
Defensive patterns
Strategy: validation
Validate before calling
if (postAgg instanceof KllFloatsSketchToQuantilesPostAggregator && requiresComparator(querySpec)) {
throw new IllegalArgumentException("Quantiles array is not comparable; order by a single quantile instead");
} Prevention
- Use KLL_SKETCH_TO_QUANTILE (single value) when ordering is needed.
- Never sort by multi-value arrays in Druid.
- Post-process quantile arrays client-side.
When it happens
Trigger: Using the KLL_SKETCH_TO_QUANTILES post-aggregator in an ORDER BY expression, a having clause, or any API path that calls getComparator() on it.
Common situations: Trying to sort results by the quantiles array, or building queries programmatically where a comparator is requested for every post-aggregator.
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 quantiles is not supported
- Comparing histograms is not supported
- Comparing histograms is not supported
- Comparing histograms is not supported
- Comparing histograms is not supported
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/6f31dbe9bda2c7f8.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToQuantilesPostAggregator.java:97
return fractions;
}
@Override
public Object compute(final Map<String, Object> combinedAggregators)
{
final KllFloatsSketch sketch = (KllFloatsSketch) field.compute(combinedAggregators);
if (sketch.isEmpty()) {
final float[] quantiles = new float[fractions.length];
Arrays.fill(quantiles, Float.NaN);
return quantiles;
}
return sketch.getQuantiles(fractions);
}
@Override
public Comparator<float[]> 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)