apache/druid · error · UnsupportedOperationException
Not decorated
Error message
Not decorated
What it means
FinalizingFieldAccessPostAggregator.getComparator throws UnsupportedOperationException("Not decorated") when the aggregator has not been wrapped by the finalization decorator that installs the comparator. This class is a shell: its comparator/finalizer fields are populated by decorate(...), and direct use of the undecorated instance is a programming error.
Solutions
- Run the post-aggregator through the normal query decoration/finalization pipeline so decorate(...) installs the comparator
- If decorating manually, call decorate(...) with the appropriate input before invoking getComparator()
- Use the factory's finalizeComputation path instead of accessing the raw comparator of an undecorated instance
Example fix
// before
Comparator c = new FinalizingFieldAccessPostAggregator("x", "agg").getComparator();
// after
PostAggregator decorated = new FinalizingFieldAccessPostAggregator("x", "agg")
.decorate(Collections.singletonList(aggregatorFactory));
Comparator c = decorated.getComparator(); Defensive patterns
Strategy: validation
Validate before calling
if (postAgg instanceof FinalizingFieldAccessPostAggregator && !isDecorated(postAgg)) {
throw new IllegalStateException("decorate() before getComparator()");
} Type guard
boolean isDecorated(FinalizingFieldAccessPostAggregator p) { try { p.getComparator(); return true; } catch (UnsupportedOperationException e) { return false; } } Try / catch
try { c = postAgg.getComparator(); } catch (UnsupportedOperationException e) { c = defaultComparatorForField(fieldName); } Prevention
- Always let the query engine's decoration phase wrap post-aggregators
- In tests, call decorate(...) with real AggregatorFactories before asserting
- Never call getComparator/compute on raw FinalizingFieldAccessPostAggregator instances
When it happens
Trigger: Calling getComparator() on a FinalizingFieldAccessPostAggregator that was never passed through AggregatorFactory's finalization/decoration step, or on one whose delegate produced a null comparator.
Common situations: Unit tests instantiating the post-aggregator directly without decorating it; custom query code building post-aggregators manually and skipping the decoration phase of query processing.
Related errors
- A-Not-B requires at least 1 sketch
- AppenderatorsManager methods should only called by services…
- ApproximateHistogramBufferAggregator does not support…
- ApproximateHistogramBufferAggregator does not support…
- ApproximateHistogramBufferAggregator does not support…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/edc335d8707272d4.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/query/aggregation/post/FinalizingFieldAccessPostAggregator.java:86
{
this.name = name;
this.fieldName = fieldName;
this.finalizedType = finalizedType;
this.comparator = comparator;
this.finalizer = finalizer;
}
@Override
public Set<String> getDependentFields()
{
return Sets.newHashSet(fieldName);
}
@Override
public Comparator getComparator()
{
if (comparator == null) {
throw new UnsupportedOperationException("Not decorated");
} else {
return comparator;
}
}
@Override
public Object compute(Map<String, Object> combinedAggregators)
{
if (finalizer == null) {
throw new UnsupportedOperationException("Not decorated");
} else {
return finalizer.apply(combinedAggregators.get(fieldName));
}
}
@Override
@JsonProperty
public String getName()View on GitHub (pinned to 9b90983fd2)