apache/druid · error · IllegalArgumentException
Comparing sketch summaries is not supported
Error message
Comparing sketch summaries is not supported
What it means
KllDoublesSketchToStringPostAggregator.getComparator always throws IllegalArgumentException because a sketch's string summary is descriptive text, not an ordered value. The method satisfies the post-aggregator interface but comparison is deliberately unsupported.
Source
Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchToStringPostAggregator.java:83
}
@JsonProperty
public PostAggregator getField()
{
return field;
}
@Override
public Object compute(final Map<String, Object> combinedAggregators)
{
final KllDoublesSketch sketch = (KllDoublesSketch) field.compute(combinedAggregators);
return sketch.toString();
}
@Override
public Comparator<String> getComparator()
{
throw new IAE("Comparing sketch summaries is not supported");
}
@Override
public byte[] getCacheKey()
{
final CacheKeyBuilder builder = new CacheKeyBuilder(
PostAggregatorIds.KLL_DOUBLES_SKETCH_TO_STRING_CACHE_TYPE_ID).appendCacheable(field);
return builder.build();
}
@Override
public PostAggregator decorate(final Map<String, AggregatorFactory> map)
{
return this;
}
@Override
public Set<String> getDependentFields()View on GitHub (pinned to 9b90983fd2)
Solutions
- Do not ORDER BY on the sketch summary; order by a scalar metric or quantile instead
- If text ordering is truly needed, extract the summary client-side and sort in application code
- Have generic frameworks treat comparator-throwing post-aggregators as non-sortable
Example fix
// before ORDER BY sketchSummary // after ORDER BY sketchSummary IN CLIENT CODE -- fetch rows, then sort strings in the app
Defensive patterns
Strategy: validation
Validate before calling
if (postAgg instanceof KllDoublesSketchToStringPostAggregator) {
throw new IllegalArgumentException("Sketch summary output is not sortable");
} Try / catch
try { cmp = postAgg.getComparator(); } catch (IllegalArgumentException e) { cmp = null; } Prevention
- Treat string summaries as display-only, never sort keys
- Sort client-side if text ordering is required
- Skip comparator requests for descriptive post-aggregators
When it happens
Trigger: Requesting ordering on the string output of kllDoublesSketchToString, e.g. ORDER BY on the summary column, or framework code calling getComparator() for sorting.
Common situations: Sorting results by sketch summary text; generic result-table sorting in UI over string post-aggregator columns; SQL ORDER BY on the summary 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 arrays of quantiles 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/f4be4ac19f8398c3.
Report an issue: GitHub.