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

Cardinality aggregator does not support[%s] inputs

Error message

Cardinality aggregator does not support[%s] inputs

What it means

CardinalityVectorProcessorFactory does not implement a vectorized processor for array-typed columns. makeArrayProcessor unconditionally throws this UnsupportedOperationException, so a vectorized cardinality aggregation over an ARRAY column cannot proceed. Only long/float/double (and string via other make*Processor methods) inputs are supported.

Source

Thrown at processing/src/main/java/org/apache/druid/query/aggregation/cardinality/vector/CardinalityVectorProcessorFactory.java:73

    return new FloatCardinalityVectorProcessor(selector);
  }

  @Override
  public CardinalityVectorProcessor makeDoubleProcessor(ColumnCapabilities capabilities, VectorValueSelector selector)
  {
    return new DoubleCardinalityVectorProcessor(selector);
  }

  @Override
  public CardinalityVectorProcessor makeLongProcessor(ColumnCapabilities capabilities, VectorValueSelector selector)
  {
    return new LongCardinalityVectorProcessor(selector);
  }

  @Override
  public CardinalityVectorProcessor makeArrayProcessor(ColumnCapabilities capabilities, VectorObjectSelector selector)
  {
    throw new UOE(
        "Cardinality aggregator does not support[%s] inputs",
        capabilities.toColumnType()
    );
  }

  @Override
  public CardinalityVectorProcessor makeObjectProcessor(ColumnCapabilities capabilities, VectorObjectSelector selector)
  {
    // Handles string-as-object and complex types.
    return new StringObjectCardinalityVectorProcessor(selector);
  }
}

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Change the query to aggregate over a non-array column, or use a SQL expression like ARRAY_TO_STRING/UNNEST before distinct counting.
  2. Disable vectorization for the affected query/engine (e.g. set query vectorization off) to fall back to the non-vectorized path.
  3. Re-ingest the column as a scalar type if arrays were produced unintentionally.
  4. Check Druid version for added array support in cardinality; upgrade if a newer release supports it.

Example fix

// before
SELECT APPROX_COUNT_DISTINCT_DS_HLL(array_col) FROM t
// after
SELECT APPROX_COUNT_DISTINCT_DS_HLL(ARRAY_TO_STRING(array_col, ',')) FROM t
Defensive patterns

Strategy: validation

Validate before calling

if (capabilities.getType() == ValueType.ARRAY) {
  throw new IllegalArgumentException("cardinality does not vectorize ARRAY column: " + capabilities.toColumnType());
}

Type guard

boolean isArrayColumn(ColumnCapabilities c) {
  return c != null && c.getType() == ValueType.ARRAY;
}

Try / catch

try {
  processor = factory.makeVectorProcessor(capabilities, factory.makeArrayProcessor(capabilities, selector));
} catch (UnsupportedOperationException e) {
  // fall back to non-vectorized aggregation for array columns
  runNonVectorizedPlan();
}

Prevention

When it happens

Trigger: Executing a cardinality aggregation in vectorized mode where the input column's capabilities indicate an ARRAY type, causing the engine to call makeArrayProcessor.

Common situations: Querying an ARRAY-typed dimension (e.g. ingested JSON arrays, auto-detect arrays) with a cardinality aggregator while vectorization is enabled; recent ingestion changes turned a string dimension into an array column.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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