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

Object is not of a type[%s] that can be deserialized to Hype

Error message

Object is not of a type[%s] that can be deserialized to HyperLogLog.

What it means

PreComputedHyperUniquesSerde's extraction lambda deserializes a stored value into a HyperLogLogCollector, accepting byte[] and base64-String forms. When the raw value under a hyperUnique-typed column is neither (e.g. a Number, Map, or other object), it throws an IllegalStateException indicating the stored object type cannot be converted to an HLL sketch.

Source

Thrown at processing/src/main/java/org/apache/druid/query/aggregation/hyperloglog/PreComputedHyperUniquesSerde.java:66

      }

      @Override
      public HyperLogLogCollector extractValue(InputRow inputRow, String metricName)
      {
        Object rawValue = inputRow.getRaw(metricName);

        if (rawValue == null) {
          return HyperLogLogCollector.makeLatestCollector();
        } else if (rawValue instanceof HyperLogLogCollector) {
          return (HyperLogLogCollector) rawValue;
        } else if (rawValue instanceof byte[]) {
          return HyperLogLogCollector.makeLatestCollector().fold(ByteBuffer.wrap((byte[]) rawValue));
        } else if (rawValue instanceof String) {
          return HyperLogLogCollector.makeLatestCollector()
                                     .fold(ByteBuffer.wrap(StringUtils.decodeBase64String((String) rawValue)));
        }

        throw new ISE("Object is not of a type[%s] that can be deserialized to HyperLogLog.", rawValue.getClass());
      }
    };
  }
}

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Re-ingest the affected segments with the hyperUnique (or sketch) column type so values are stored as serialized HLL byte arrays.
  2. Check the ingestion spec: ensure the column configured as hyperUnique actually receives sketches (e.g. from a counter/dimension via appropriate aggregator), not raw numbers.
  3. Inspect offending segments (segment metadata/dump) to identify which rows hold the wrong type, then replace those segments.

Example fix

// before: column "u" ingested as a long, later queried as hyperUnique
// after: ingest with
{"type":"hyperUnique","name":"u","fieldName":"u_raw"}
so segments store HLL byte[] values readable by PreComputedHyperUniquesSerde.
Defensive patterns

Strategy: validation

Validate before calling

if (!(rawValue instanceof byte[]) && !(rawValue instanceof String)) { throw new IllegalArgumentException("Column value for hyperUnique must be byte[] or base64 String, got " + rawValue.getClass()); }

Type guard

boolean isHllSerializable(Object v) { return v instanceof byte[] || v instanceof String; }

Try / catch

try { serde.extractValue(value); } catch (IllegalStateException e) { log.error("Segment holds non-sketch value; re-ingest segment", e); }

Prevention

When it happens

Trigger: Segment data written under a hyperUnique column contains a value whose runtime type is not byte[] or String — e.g. segments ingested with a different spec (numeric column), corrupted/incorrectly typed segment files, or a serde mismatch between writer and reader versions.

Common situations: Reindexing segments that originally stored plain numbers under the same column name later declared as hyperUnique; manual segment manipulation or heterogeneous ingestion jobs writing mixed types to one column; schema changes where rollup/ingestion swapped column type without re-ingesting.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/2dfe6e616b894f19. Report an issue: GitHub.