apache/druid · error · IAE

Unhandled type: %s

Error message

Unhandled type: %s

What it means

Inside the auto-type column processor's per-value handling switch, the evaluated column type falls into a case that has no handler (only STRING, LONG, DOUBLE, and specific array cases are handled). This is an internal invariant break — an unexpected ColumnType reached the indexer — and is thrown as IllegalArgumentException 'Unhandled type: %s'.

Source

Thrown at processing/src/main/java/org/apache/druid/segment/AutoTypeColumnIndexer.java:736

                typeSet.add(ColumnType.LONG_ARRAY);
                sizeEstimate = valueDictionary.addLongArray(theArray);
                return new StructuredDataProcessor.ProcessedValue<>(theArray, sizeEstimate);
              case DOUBLE:
                typeSet.add(ColumnType.DOUBLE_ARRAY);
                sizeEstimate = valueDictionary.addDoubleArray(theArray);
                return new StructuredDataProcessor.ProcessedValue<>(theArray, sizeEstimate);
              case STRING:
                // empty arrays and arrays with all nulls are detected as string arrays, but don't count them as part of
                // the type set yet, we'll handle that later when serializing
                if (theArray.length == 0 || Arrays.stream(theArray).allMatch(Objects::isNull)) {
                  typeSet.addUntypedArray();
                } else {
                  typeSet.add(ColumnType.STRING_ARRAY);
                }
                sizeEstimate = valueDictionary.addStringArray(theArray);
                return new StructuredDataProcessor.ProcessedValue<>(theArray, sizeEstimate);
              default:
                throw new IAE("Unhandled type: %s", columnType);
            }
          }
        case STRING:
          typeSet.add(ColumnType.STRING);
          final String asString = eval.asString();
          sizeEstimate = valueDictionary.addStringValue(asString);
          return new StructuredDataProcessor.ProcessedValue<>(asString, sizeEstimate);
        default:
          throw new IAE("Unhandled type: %s", columnType);
      }
    }

    public FieldTypeInfo.MutableTypeSet getTypes()
    {
      return typeSet;
    }

    public boolean isSingleType()

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Do not ingest COMPLEX or other unhandled column types into auto-type columns; move such data to explicitly typed columns.
  2. Pre-process expressions so values are normalized to STRING/LONG/DOUBLE or their array forms before the auto processor sees them.
  3. If a new ColumnType in the Druid version is the cause, upgrade the ingestion code (patch the switch) or downgrade/pin to compatible versions.
  4. Check the input format/expressions producing the value and restrict castTo types to supported primitives.

Example fix

// before: feeding an expression yielding COMPLEX into auto column
"expression": "hyper_unique(x)"
// after: convert to a string representation
"expression": "to_string(hyper_unique(x))"
Defensive patterns

Strategy: validation

Validate before calling

String t = eval.type().toString();
if (!(t.equals("STRING") || t.equals("LONG") || t.equals("DOUBLE")
    || t.contains("ARRAY"))) {
  throw new IllegalArgumentException("unsupported for auto column: " + t);
}

Type guard

boolean supportedForAutoColumn(ExprEval<?> eval) {
  ColumnType t = eval.type();
  return t.isPrimitive() || t.isArray();
}

Try / catch

try {
  return processor.processValue(vals, supplier);
} catch (IAE e) {
  log.error(e, "unhandled column type in auto indexer: %s", e.getMessage());
  throw new ParseException(null, e, "bad column type");
}

Prevention

When it happens

Trigger: A ColumnType value produced during auto-column processing (from eval.type() or type switches inside processValue) that is not one of the explicitly enumerated cases reaches the default branch, e.g. a newly added ColumnType (like COMPLEX or a new array type) ingested into an auto column.

Common situations: Ingesting complex/COMPLEX-typed values (e.g. sketches, HLL) into a useSchemaDiscovery auto column; running a newer/older Druid version where ColumnType enum values introduced later reach older switch code; expression-produced values with exotic types.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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