apache/druid · error · org.apache.druid.java.util.common.ISE

Unknown value type:

Error message

Unknown value type: 

What it means

MinPostAggregator.compute() throws IllegalStateException('Unknown value type: <class>') when the value fetched from the row/column is neither an ApproximateHistogram nor a FixedBucketsHistogram. This post-aggregator only knows how to take the minimum of those two histogram types.

Source

Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/MinPostAggregator.java:76

  @Override
  public Set<String> getDependentFields()
  {
    return Sets.newHashSet(fieldName);
  }

  @Override
  public Object compute(Map<String, Object> values)
  {
    Object val = values.get(fieldName);
    if (val instanceof ApproximateHistogram) {
      final ApproximateHistogram ah = (ApproximateHistogram) val;
      return ah.getMin();
    } else if (val instanceof FixedBucketsHistogram) {
      final FixedBucketsHistogram fbh = (FixedBucketsHistogram) val;
      return fbh.getMin();
    }
    throw new ISE("Unknown value type: " + val.getClass());
  }

  @Override
  public ColumnType getType(ColumnInspector signature)
  {
    return ColumnType.DOUBLE;
  }

  @Override
  public PostAggregator decorate(Map<String, AggregatorFactory> aggregators)
  {
    return this;
  }

  @Override
  public String toString()
  {
    return "MinPostAggregator{" +

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Point fieldName at a metric/post-agg that yields ApproximateHistogram or FixedBucketsHistogram values.
  2. If the upstream value is already a scalar, remove the histogram post-agg and use the value directly.
  3. Wrap with NumericPostAggregator only after a histogram-typed post-agg, and verify field names in the query JSON.

Example fix

// before
{"type": "min", "fieldName": "myNumericMetric"}
// after
{"type": "min", "fieldName": "myHistogramMetric"}
Defensive patterns

Strategy: type-guard

Validate before calling

Object val = row.get(fieldName);
if (!(val instanceof ApproximateHistogram) && !(val instanceof FixedBucketsHistogram)) {
  throw new IllegalArgumentException("min post-agg requires a histogram value, got " + (val == null ? "null" : val.getClass()));
}

Type guard

boolean isHistogram(Object v) {
  return v instanceof ApproximateHistogram || v instanceof FixedBucketsHistogram;
}

Try / catch

try {
  Object min = minPostAgg.compute(row);
} catch (IllegalStateException e) {
  if (e.getMessage().startsWith("Unknown value type")) {
    // fix field wiring / use value directly
  } else throw e;
}

Prevention

When it happens

Trigger: Applying a 'min' histogram post-aggregator to a field whose computed value is a plain number, a Quantiles object, a string, or any non-histogram object.

Common situations: Wiring the post-aggregator to the wrong field name (a numeric metric), or chaining post-aggregators where an earlier post-agg already produced a scalar like a Quantiles result.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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