{"record":{"id":"71b83e4172d9a514","repo":"apache/druid","slug":"unknown-value-type","errorCode":null,"errorMessage":"Unknown value type: ","messagePattern":"Unknown value type: ","errorType":"exception","errorClass":"org.apache.druid.java.util.common.ISE","httpStatus":null,"severity":"error","filePath":"extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/MinPostAggregator.java","lineNumber":76,"sourceCode":"\n  @Override\n  public Set<String> getDependentFields()\n  {\n    return Sets.newHashSet(fieldName);\n  }\n\n  @Override\n  public Object compute(Map<String, Object> values)\n  {\n    Object val = values.get(fieldName);\n    if (val instanceof ApproximateHistogram) {\n      final ApproximateHistogram ah = (ApproximateHistogram) val;\n      return ah.getMin();\n    } else if (val instanceof FixedBucketsHistogram) {\n      final FixedBucketsHistogram fbh = (FixedBucketsHistogram) val;\n      return fbh.getMin();\n    }\n    throw new ISE(\"Unknown value type: \" + val.getClass());\n  }\n\n  @Override\n  public ColumnType getType(ColumnInspector signature)\n  {\n    return ColumnType.DOUBLE;\n  }\n\n  @Override\n  public PostAggregator decorate(Map<String, AggregatorFactory> aggregators)\n  {\n    return this;\n  }\n\n  @Override\n  public String toString()\n  {\n    return \"MinPostAggregator{\" +","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/MinPostAggregator.java#L58-L94","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Point fieldName at a metric/post-agg that yields ApproximateHistogram or FixedBucketsHistogram values.","If the upstream value is already a scalar, remove the histogram post-agg and use the value directly.","Wrap with NumericPostAggregator only after a histogram-typed post-agg, and verify field names in the query JSON."],"exampleFix":"// before\n{\"type\": \"min\", \"fieldName\": \"myNumericMetric\"}\n// after\n{\"type\": \"min\", \"fieldName\": \"myHistogramMetric\"}","handlingStrategy":"type-guard","validationCode":"Object val = row.get(fieldName);\nif (!(val instanceof ApproximateHistogram) && !(val instanceof FixedBucketsHistogram)) {\n  throw new IllegalArgumentException(\"min post-agg requires a histogram value, got \" + (val == null ? \"null\" : val.getClass()));\n}","typeGuard":"boolean isHistogram(Object v) {\n  return v instanceof ApproximateHistogram || v instanceof FixedBucketsHistogram;\n}","tryCatchPattern":"try {\n  Object min = minPostAgg.compute(row);\n} catch (IllegalStateException e) {\n  if (e.getMessage().startsWith(\"Unknown value type\")) {\n    // fix field wiring / use value directly\n  } else throw e;\n}","preventionTips":["Verify fieldName targets an approxHistogram/fixedBucketsHistogram aggregator output.","Do not chain scalar-producing post-aggs into histogram post-aggs.","Validate query JSON field names against the aggregations section."],"tags":["druid","histogram","post-aggregator","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}