apache/druid · error · java.lang.UnsupportedOperationException

not supported

Error message

not supported

What it means

DoubleMeanAggregator represents a running mean as a DoubleMeanHolder; the only meaningful extraction is the double value. getFloat() is an interface-required stub and throws UnsupportedOperationException because a float cannot represent the holder's state losslessly and float extraction is not implemented.

Solutions

  1. Read the value with get()/getDouble() and cast to float yourself if needed.
  2. Change the query/output type to DOUBLE instead of FLOAT for doubleMean metrics.
  3. If using a post-aggregator, ensure it accesses the metric as a double-typed field.

Example fix

// before
float f = agg.getFloat();
// after
float f = (float) agg.getDouble();
Defensive patterns

Strategy: type-guard

Validate before calling

if (aggregator instanceof DoubleMeanAggregator) { /* read via get()/getDouble semantics, never getFloat */ }

Type guard

boolean isDoubleMeanAgg(Aggregator a) { return a instanceof DoubleMeanAggregator; }

Try / catch

try { return agg.getFloat(); } catch (UnsupportedOperationException e) { return (float) ((DoubleMeanHolder) agg.get()).mean(); }

Prevention

When it happens

Trigger: Calling getFloat() on a doubleMean aggregator — e.g. a query layer or post-aggregator requesting float-typed output from a mean aggregation.

Common situations: Queries forcing FLOAT output type for a doubleMean metric; custom engines/frames reading aggregator state as float; users expecting automatic numeric narrowing.

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


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/query/aggregation/mean/DoubleMeanAggregator.java:70

    } else if (update instanceof List) {
      for (Object o : (List) update) {
        value.update(Numbers.tryParseDouble(o, 0));
      }
    } else {
      value.update(Numbers.tryParseDouble(update, 0));
    }
  }

  @Override
  public Object get()
  {
    return value;
  }

  @Override
  public float getFloat()
  {
    throw new UnsupportedOperationException("not supported");
  }

  @Override
  public long getLong()
  {
    throw new UnsupportedOperationException("not supported");
  }

  @Override
  public double getDouble()
  {
    throw new UnsupportedOperationException("not supported");
  }

  @Override
  public void close()
  {
    // no resources to cleanup

View on GitHub (pinned to 9b90983fd2)