{"record":{"id":"4675703dc03073ec","repo":"apache/druid","slug":"comparing-arrays-of-quantiles-is-not-supported-467570","errorCode":null,"errorMessage":"Comparing arrays of quantiles is not supported","messagePattern":"Comparing arrays of quantiles is not supported","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/tdigestsketch/src/main/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchToQuantilesPostAggregator.java","lineNumber":106,"sourceCode":"  }\n\n  @Override\n  public Object compute(final Map<String, Object> combinedAggregators)\n  {\n    final MergingDigest sketch = (MergingDigest) field.compute(combinedAggregators);\n    double[] quantiles = new double[fractions.length];\n    int i = 0;\n\n    for (double f : fractions) {\n      quantiles[i++] = sketch.quantile(f);\n    }\n    return quantiles;\n  }\n\n  @Override\n  public Comparator<double[]> getComparator()\n  {\n    throw new IAE(\"Comparing arrays of quantiles is not supported\");\n  }\n\n  @Override\n  public Set<String> getDependentFields()\n  {\n    return field.getDependentFields();\n  }\n\n  @Override\n  public String toString()\n  {\n    return getClass().getSimpleName() + \"{\" +\n           \"name='\" + name + '\\'' +\n           \", field=\" + field +\n           \", fractions=\" + Arrays.toString(fractions) +\n           \"}\";\n  }\n","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/tdigestsketch/src/main/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchToQuantilesPostAggregator.java#L88-L124","documentation":"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.","triggerScenarios":"Thrown at extensions-contrib/tdigestsketch/src/main/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchToQuantilesPostAggregator.java:106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not use this post-aggregator for ordering, topN sorting, or having-clause comparisons","Wrap the field in a scalar post-aggregator (e.g. extract a single quantile) if a comparable value is needed","Restrict usage of quantile arrays to final projected output columns"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}