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

Unknown value type:

Error message

Unknown value type: 

What it means

QuantilesPostAggregator.compute() throws IllegalStateException('Unknown value type: <class>') when the input value is neither an ApproximateHistogram nor a FixedBucketsHistogram; only those two histogram types support percentile computation via percentilesFloat/quantile.

Source

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

  {
    Object val = values.get(fieldName);
    if (val instanceof ApproximateHistogram) {
      final ApproximateHistogram ah = (ApproximateHistogram) val;
      return new Quantiles(probabilities, ah.getQuantiles(probabilities), ah.getMin(), ah.getMax());
    } else if (val instanceof FixedBucketsHistogram) {
      final FixedBucketsHistogram fbh = (FixedBucketsHistogram) val;
      double[] adjustedProbabilites = new double[probabilities.length];
      for (int i = 0; i < probabilities.length; i++) {
        adjustedProbabilites[i] = probabilities[i] * 100.0;
      }
      return new Quantiles(
          probabilities,
          fbh.percentilesFloat(adjustedProbabilites),
          (float) fbh.getMin(),
          (float) fbh.getMax()
      );
    }
    throw new ISE("Unknown value type: " + val.getClass());
  }

  /**
   * actual type is {@link Quantiles}
   * @param signature
   */
  @Override
  public ColumnType getType(ColumnInspector signature)
  {
    // todo: ???
    return ColumnType.UNKNOWN_COMPLEX;
  }

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

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Ensure fieldName references a metric/post-aggregator that outputs ApproximateHistogram or FixedBucketsHistogram.
  2. Remove duplicate quantiles chaining; compute all needed quantiles in one QuantilesPostAggregator.
  3. Verify the underlying aggregator type matches (approxHistogram vs fixedBucketsHistogram) and use the corresponding post-agg.

Example fix

// before: quantiles on a quantiles result
{"type": "quantiles", "fieldName": "quantilesOut", ...}
// after: quantiles on the histogram metric
{"type": "quantiles", "fieldName": "myHistogram", "probabilities": [0.5, 0.9]}
Defensive patterns

Strategy: type-guard

Validate before calling

Object val = row.get(fieldName);
if (!(val instanceof ApproximateHistogram) && !(val instanceof FixedBucketsHistogram)) {
  throw new IllegalArgumentException("quantiles 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 q = quantilesPostAgg.compute(row);
} catch (IllegalStateException e) {
  if (e.getMessage().startsWith("Unknown value type")) {
    // rewire fieldName to the histogram metric
  } else throw e;
}

Prevention

When it happens

Trigger: Applying a 'quantiles' post-aggregator to a field whose value is a scalar number, Quantiles object, or other non-histogram type produced by the aggregator or a previous post-agg.

Common situations: Chaining a quantiles post-agg on top of another quantiles output; pointing fieldName at a numeric metric; typos in field names resolving to the wrong column.

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/7d5b84dbc7b3b27c. Report an issue: GitHub.