{"record":{"id":"43e3b6823deda459","repo":"apache/druid","slug":"unknown-type","errorCode":null,"errorMessage":"Unknown type: ","messagePattern":"Unknown type: ","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramSerde.java","lineNumber":117,"sourceCode":"        } else if (rawValue instanceof String) {\n          Number numberAttempt;\n          try {\n            numberAttempt = Rows.objectToNumber(metricName, rawValue, true);\n            FixedBucketsHistogram fbh = new FixedBucketsHistogram(\n                aggregatorFactory.getLowerLimit(),\n                aggregatorFactory.getUpperLimit(),\n                aggregatorFactory.getNumBuckets(),\n                aggregatorFactory.getOutlierHandlingMode()\n            );\n            fbh.add(numberAttempt.doubleValue());\n            return fbh;\n          }\n          catch (ParseException pe) {\n            FixedBucketsHistogram fbh = FixedBucketsHistogram.fromBase64((String) rawValue);\n            return fbh;\n          }\n        } else {\n          throw new UnsupportedOperationException(\"Unknown type: \" + rawValue.getClass());\n        }\n      }\n    };\n  }\n\n  @Override\n  public ObjectStrategy getObjectStrategy()\n  {\n    return new ObjectStrategy<FixedBucketsHistogram>()\n    {\n      @Override\n      public Class<? extends FixedBucketsHistogram> getClazz()\n      {\n        return FixedBucketsHistogram.class;\n      }\n\n      @Override\n      public FixedBucketsHistogram fromByteBuffer(ByteBuffer buffer, int numBytes)","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramSerde.java#L99-L135","documentation":"FixedBucketsHistogramSerde's extractValue throws UnsupportedOperationException('Unknown type: <class>') when the raw column value is neither a FixedBucketsHistogram, a String (base64 or JSON-encoded histogram), nor another recognized type. The serde only knows how to deserialize histograms from a small set of input representations.","triggerScenarios":"Ingesting rows where the metric column holds a value of an unexpected Java class (e.g. Number, Map, byte[]) for a fixedBucketsHistogram metric; the serde falls through all instanceof checks and throws.","commonSituations":"Ingestion specs with wrong-type input (numeric field mapped to a histogram metric), programmatic row construction putting raw objects in, or upstream producers writing the histogram in an unencodable format.","solutions":["Ensure the raw value is a String containing a base64-encoded FixedBucketsHistogram or a JSON-encoded histogram (or an actual FixedBucketsHistogram object).","Fix the upstream producer/ingestion spec so the histogram is serialized with FixedBucketsHistogram.toBase64() before ingestion.","Add a preprocessing step (e.g. a parseSpec/flatten transform) that converts the value to the expected base64 string."],"exampleFix":"// before: ingesting a raw number\nrow.add(\"myHist\", 42);\n// after\nrow.add(\"myHist\", FixedBucketsHistogram.toBase64(fbh));","handlingStrategy":"validation","validationCode":"Object raw = row.getRaw(\"myHist\");\nif (!(raw == null || raw instanceof FixedBucketsHistogram || raw instanceof String)) {\n  throw new IllegalArgumentException(\"myHist must be base64/JSON histogram string, got \" + raw.getClass());\n}","typeGuard":"boolean isHistogramValue(Object v) {\n  return v instanceof FixedBucketsHistogram ||\n         (v instanceof String); // base64 or JSON-encoded histogram\n}","tryCatchPattern":"try {\n  Object v = serde.extractValue(row, \"myHist\", aggFactory);\n} catch (UnsupportedOperationException e) {\n  // handle/log unexpected raw type, e.g. re-serialize producer data\n}","preventionTips":["Producers must serialize histograms with FixedBucketsHistogram.toBase64() before ingestion.","Validate sample rows against expected types before submitting ingestion jobs.","Do not map numeric fields to fixedBucketsHistogram metrics in ingestion specs."],"tags":["druid","histogram","serde","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"}