apache/druid · error · IAE

Unsupported type %s

Error message

Unsupported type %s

What it means

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.

Source

Thrown at extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchBuildUtil.java:59

    } else if (value instanceof String) {
      updateSketchWithString(sketch, stringEncoding, (String) value);
    } else if (value instanceof List) {
      // noinspection rawtypes
      for (Object entry : (List) value) {
        if (entry != null) {
          updateSketchWithString(sketch, stringEncoding, entry.toString());
        }
      }
    } else if (value instanceof char[]) {
      sketch.update((char[]) value);
    } else if (value instanceof byte[]) {
      sketch.update((byte[]) value);
    } else if (value instanceof int[]) {
      sketch.update((int[]) value);
    } else if (value instanceof long[]) {
      sketch.update((long[]) value);
    } else {
      throw new IAE("Unsupported type " + value.getClass());
    }
  }

  public static void updateSketchWithDictionarySelector(
      final HllSketch sketch,
      final StringEncoding stringEncoding,
      final DimensionDictionarySelector selector,
      final int id
  )
  {
    if (stringEncoding == StringEncoding.UTF8 && selector.supportsLookupNameUtf8()) {
      final ByteBuffer buf = selector.lookupNameUtf8(id);

      if (buf != null) {
        sketch.update(buf);
      }
    } else {
      updateSketchWithString(sketch, stringEncoding, selector.lookupName(id));

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Check the column's actual type and cast/convert values upstream (e.g. to string or long) before sketching.
  2. If ingesting arrays/objects, convert them to a supported representation (string encoding or numeric) in the ingestion spec.
  3. Extend the input handling upstream (selector/expression) so updateSketch only receives supported types.
  4. For sketch-of-sketch needs, use HLLSketchMerge rather than passing sketch objects to updateSketch.

Example fix

// before
sketch.update(unknownObject); // reaches updateSketch with Float/other
// after
if (value instanceof Number) { sketch.update(((Number) value).doubleValue()); } else { sketch.update(String.valueOf(value)); }
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(value instanceof String || value instanceof byte[] || value instanceof int[] || value instanceof long[] || value instanceof Number)) throw new IllegalArgumentException("unsupported sketch input: " + value.getClass());

Type guard

boolean sketchUpdatable(Object v) { return v == null || v instanceof String || v instanceof byte[] || v instanceof int[] || v instanceof long[] || v instanceof Double; }

Try / catch

try { HllSketchBuildUtil.updateSketch(sketch, value); } catch (IAE e) { log.error("bad sketch input type", e); /* normalize value and retry */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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