{"record":{"id":"c5c6a7aa3142b93e","repo":"apache/druid","slug":"object-is-not-of-a-type-that-can-be-deserialized-t-c5c6a7","errorCode":null,"errorMessage":"Object is not of a type that can be deserialized to a KllFloatsSketch: %s","messagePattern":"Object is not of a type that can be deserialized to a KllFloatsSketch: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":500,"severity":"error","filePath":"extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchOperations.java","lineNumber":44,"sourceCode":"import org.apache.druid.segment.data.SafeWritableMemory;\n\nimport java.nio.charset.StandardCharsets;\n\npublic class KllFloatsSketchOperations\n{\n\n  public static final KllFloatsSketch EMPTY_SKETCH = KllFloatsSketch.newHeapInstance();\n\n  public static KllFloatsSketch deserialize(final Object serializedSketch)\n  {\n    if (serializedSketch instanceof String) {\n      return deserializeFromBase64EncodedString((String) serializedSketch);\n    } else if (serializedSketch instanceof byte[]) {\n      return deserializeFromByteArray((byte[]) serializedSketch);\n    } else if (serializedSketch instanceof KllFloatsSketch) {\n      return (KllFloatsSketch) serializedSketch;\n    }\n    throw new ISE(\n        \"Object is not of a type that can be deserialized to a KllFloatsSketch: %s\",\n        serializedSketch == null ? \"null\" : serializedSketch.getClass()\n    );\n  }\n\n  public static KllFloatsSketch deserializeSafe(final Object serializedSketch)\n  {\n    if (serializedSketch instanceof String) {\n      return deserializeFromBase64EncodedStringSafe((String) serializedSketch);\n    } else if (serializedSketch instanceof byte[]) {\n      return deserializeFromByteArraySafe((byte[]) serializedSketch);\n    }\n    return deserialize(serializedSketch);\n  }\n\n  public static KllFloatsSketch deserializeFromBase64EncodedString(final String str)\n  {\n    return deserializeFromByteArray(StringUtils.decodeBase64(str.getBytes(StandardCharsets.UTF_8)));","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchOperations.java#L26-L62","documentation":"KllFloatsSketchOperations.deserialize accepts only a base64-encoded String, a byte[], or an existing KllFloatsSketch; anything else (including null) triggers IllegalStateException. It guards the coercion of serialized sketch state back into a sketch object in the post-aggregation path.","triggerScenarios":"Passing an object of any other type — List, Map, Number, null, or a KllDoublesSketch — to KllFloatsSketchOperations.deserialize, typically from a wrongly typed column or a mismatched field reference in a post-aggregator.","commonSituations":"Feeding a doubles-sketch column into a kllFloatsSketch post-aggregator; referencing a raw float column instead of a sketch column; deserialized JSON intermediates that lost the sketch type.","solutions":["Verify the column was ingested with the kllFloatsSketch aggregator so values are float sketch payloads","Null-check and type-check inputs (String/byte[]/KllFloatsSketch) before calling deserialize","Use deserializeSafe for tolerant handling instead of raw deserialize","Do not mix KllDoublesSketch values with KllFloatsSketch processing"],"exampleFix":"// before\nKllFloatsSketch sk = KllFloatsSketchOperations.deserialize(doublesSketchObj);\n// after\nKllFloatsSketch sk = (obj instanceof String || obj instanceof byte[] || obj instanceof KllFloatsSketch)\n    ? KllFloatsSketchOperations.deserialize(obj) : null;","handlingStrategy":"type-guard","validationCode":"if (!(obj instanceof String || obj instanceof byte[] || obj instanceof KllFloatsSketch)) {\n  throw new IllegalArgumentException(\"Unsupported KllFloatsSketch input: \" + obj);\n}","typeGuard":"boolean isDeserializable(Object o) { return o instanceof String || o instanceof byte[] || o instanceof KllFloatsSketch; }","tryCatchPattern":"try { sk = KllFloatsSketchOperations.deserialize(obj); } catch (IllegalStateException e) { log.warn(\"Bad float sketch input\", e); sk = null; }","preventionTips":["Ingest with kllFloatsSketch aggregator so stored values are valid sketch payloads","Do not feed KllDoublesSketch values into float sketch operations","Prefer deserializeSafe when input provenance is uncertain"],"tags":["druid","datasketches","kll","deserialization","type-mismatch"],"backgroundTag":"incompatible-source-type","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"}