apache/druid · error · IllegalArgumentException

Comparing arrays of quantiles is not supported

Error message

Comparing arrays of quantiles is not supported

What it means

The output of TDigestSketchToQuantilesPostAggregator.compute() is a double[] of quantiles, and no total ordering between quantile arrays is defined for this aggregator. getComparator() is therefore a sentinel that always throws; it fires when the query engine or a caller attempts to sort, order-by, or compare results using this post-aggregator as a comparable metric.

Solutions

  1. Do not use this post-aggregator for ordering, topN sorting, or having-clause comparisons
  2. Wrap the field in a scalar post-aggregator (e.g. extract a single quantile) if a comparable value is needed
  3. Restrict usage of quantile arrays to final projected output columns
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions-contrib/tdigestsketch/src/main/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchToQuantilesPostAggregator.java:106 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/4675703dc03073ec. Report an issue: GitHub.

Appendix: source

Thrown at extensions-contrib/tdigestsketch/src/main/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchToQuantilesPostAggregator.java:106

  }

  @Override
  public Object compute(final Map<String, Object> combinedAggregators)
  {
    final MergingDigest sketch = (MergingDigest) field.compute(combinedAggregators);
    double[] quantiles = new double[fractions.length];
    int i = 0;

    for (double f : fractions) {
      quantiles[i++] = sketch.quantile(f);
    }
    return quantiles;
  }

  @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)