{"record":{"id":"8a24ec279b31526b","repo":"apache/druid","slug":"unsupported-type-s","errorCode":null,"errorMessage":"Unsupported type %s","messagePattern":"Unsupported type (.+?)","errorType":"exception","errorClass":"IAE","httpStatus":null,"severity":"error","filePath":"extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchBuildUtil.java","lineNumber":59,"sourceCode":"    } else if (value instanceof String) {\n      updateSketchWithString(sketch, stringEncoding, (String) value);\n    } else if (value instanceof List) {\n      // noinspection rawtypes\n      for (Object entry : (List) value) {\n        if (entry != null) {\n          updateSketchWithString(sketch, stringEncoding, entry.toString());\n        }\n      }\n    } else if (value instanceof char[]) {\n      sketch.update((char[]) value);\n    } else if (value instanceof byte[]) {\n      sketch.update((byte[]) value);\n    } else if (value instanceof int[]) {\n      sketch.update((int[]) value);\n    } else if (value instanceof long[]) {\n      sketch.update((long[]) value);\n    } else {\n      throw new IAE(\"Unsupported type \" + value.getClass());\n    }\n  }\n\n  public static void updateSketchWithDictionarySelector(\n      final HllSketch sketch,\n      final StringEncoding stringEncoding,\n      final DimensionDictionarySelector selector,\n      final int id\n  )\n  {\n    if (stringEncoding == StringEncoding.UTF8 && selector.supportsLookupNameUtf8()) {\n      final ByteBuffer buf = selector.lookupNameUtf8(id);\n\n      if (buf != null) {\n        sketch.update(buf);\n      }\n    } else {\n      updateSketchWithString(sketch, stringEncoding, selector.lookupName(id));","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchBuildUtil.java#L41-L77","documentation":"HllSketchBuildUtil.updateSketch throws IllegalArgumentException (via the IAE message 'Unsupported type ' + value.getClass()) when the value handed to the HLL sketch is none of the supported update types: String, ByteBuffer/byte[], int[], long[], char[], double, or null-skip. The sketch's update method has no overload for that Java type, so the utility rejects it explicitly.","triggerScenarios":"updateSketch receives an Object that is not one of String, byte[], int[], long[], etc. — e.g. a Float, a generic Object from an expression selector, a Double where only boxed types expected are handled elsewhere, or a custom type from a nested/columnar selector not handled upstream.","commonSituations":"Feeding an HLLSketchBuild aggregator a column of unexpected type (e.g. complex, float, or list) not covered by the factory's validateInputs path; expression-produced values of novel types; upstream selectors returning objects after ingestion-type changes.","solutions":["Check the column's actual type and cast/convert values upstream (e.g. to string or long) before sketching.","If ingesting arrays/objects, convert them to a supported representation (string encoding or numeric) in the ingestion spec.","Extend the input handling upstream (selector/expression) so updateSketch only receives supported types.","For sketch-of-sketch needs, use HLLSketchMerge rather than passing sketch objects to updateSketch."],"exampleFix":"// before\nsketch.update(unknownObject); // reaches updateSketch with Float/other\n// after\nif (value instanceof Number) { sketch.update(((Number) value).doubleValue()); } else { sketch.update(String.valueOf(value)); }","handlingStrategy":"type-guard","validationCode":"if (!(value instanceof String || value instanceof byte[] || value instanceof int[] || value instanceof long[] || value instanceof Number)) throw new IllegalArgumentException(\"unsupported sketch input: \" + value.getClass());","typeGuard":"boolean sketchUpdatable(Object v) { return v == null || v instanceof String || v instanceof byte[] || v instanceof int[] || v instanceof long[] || v instanceof Double; }","tryCatchPattern":"try { HllSketchBuildUtil.updateSketch(sketch, value); } catch (IAE e) { log.error(\"bad sketch input type\", e); /* normalize value and retry */ }","preventionTips":["Check column type in segment metadata before sketching","Normalize values to string/long in ingestion or expressions","Don't feed complex/float objects to HLLSketchBuild"],"tags":["datasketches","hll","type-mismatch","aggregation"],"backgroundTag":"unsupported-dtype","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}