apache/druid · error · IllegalArgumentException
Comparing arrays of quantiles is not supported
Error message
Comparing arrays of quantiles is not supported
What it means
KllDoublesSketchToQuantilesPostAggregator.getComparator always throws IllegalArgumentException because an array of quantile values has no defined comparison semantics. The method exists to satisfy the post-aggregator interface but intentionally rejects any ordering request.
Source
Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToQuantilesPostAggregator.java:97
return fractions;
}
@Override
public Object compute(final Map<String, Object> combinedAggregators)
{
final KllDoublesSketch sketch = (KllDoublesSketch) 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)
Solutions
- Order by a specific scalar quantile instead: use kllDoublesSketchToQuantile (singular) with a single fraction
- Avoid ORDER BY on the quantiles array column
- Skip comparison-requiring paths for this post-aggregator in generic processing code
Example fix
// before
{"type":"kllDoublesSketchToQuantiles","name":"qs","field":f,"fractions":[0.5]} ... ORDER BY qs
// after
{"type":"kllDoublesSketchToQuantile","name":"median","field":f,"fraction":0.5} ... ORDER BY median Defensive patterns
Strategy: validation
Validate before calling
if (postAgg instanceof KllDoublesSketchToQuantilesPostAggregator) {
throw new IllegalArgumentException("Quantiles array output is not sortable; use kllDoublesSketchToQuantile");
} Try / catch
try { cmp = postAgg.getComparator(); } catch (IllegalArgumentException e) { cmp = null; } Prevention
- Prefer kllDoublesSketchToQuantile (single fraction) when ordering is needed
- Avoid ORDER BY on multi-value quantile arrays
- Flag array-valued post-aggregators as non-sortable in tooling
When it happens
Trigger: Ordering or ranking on the output of kllDoublesSketchToQuantiles, e.g. ORDER BY on its result column, or framework code that calls getComparator() on all post-aggregators.
Common situations: Trying to sort results by quantile arrays; building generic UI sort controls over all post-aggregator columns; SQL queries that attempt to order on array-typed post-aggregator output.
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 histograms is not supported
- Comparing histograms is not supported
- Comparing sketch summaries 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/4848fb637a06b1d0.
Report an issue: GitHub.