apache/druid · error · IllegalArgumentException

Aggregation [%s] does not support column [%s] of type [%s].

Error message

Aggregation [%s] does not support column [%s] of type [%s]. Supported types: numeric.

What it means

Bitmap64ExactCountBuildAggregatorFactory.validateNumericColumn() rejects input columns whose ValueType is not numeric. The bitmap build aggregation hashes numeric column values into a Roaring64Bitmap, so it requires a long/float/double (numeric) input column and throws IllegalArgumentException when the capabilities report another type (string, complex, nested array, etc.).

Source

Thrown at extensions-contrib/druid-exact-count-bitmap/src/main/java/org/apache/druid/query/aggregation/exact/count/bitmap64/Bitmap64ExactCountBuildAggregatorFactory.java:91

  public ColumnType getResultType()
  {
    return ColumnType.LONG;
  }

  /**
   * Ensures that the column referenced by {@link #getFieldName()} is of a numeric type when this aggregator is used
   * in a native Druid query. We must enforce the constraint here to provide a clear and early failure if the
   * query references a non-numeric (e.g., STRING) column.
   *
   * @throws IllegalArgumentException if the column exists and is not numeric.
   */
  private void validateNumericColumn(ColumnSelectorFactory metricFactory)
  {
    final ColumnCapabilities capabilities = metricFactory.getColumnCapabilities(getFieldName());
    if (capabilities != null) {
      final ValueType valueType = capabilities.getType();
      if (!valueType.isNumeric()) {
        throw new IAE(
            "Aggregation [%s] does not support column [%s] of type [%s]. Supported types: numeric.",
            Bitmap64ExactCountModule.BUILD_TYPE_NAME, getFieldName(), valueType);
      }
    }
  }
}

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Point fieldName at a numeric column (long/float/double metric) in the aggregator spec: {"type":"BITMAP64_BUILD_SIGNED","name":"...","fieldName":"myLongMetric"}.
  2. Check the actual column type with a /druid/v2/sql or segment metadata query (SELECT column type from INFORMATION_SCHEMA.COLUMNS) and fix the ingestion spec so the column is numeric.
  3. If the source data is string, cast it during ingestion to a long/double metric, or pre-process with an expression virtual column that casts before aggregating.
  4. If you believe the column is numeric but capabilities disagree, verify the segment schema for all segments; older segments may still hold the old type.

Example fix

// before
{"type":"BITMAP64_BUILD_SIGNED","name":"cnt","fieldName":"user_id_str"}

// after (ingest numeric, then aggregate)
{"type":"long","name":"user_id"} in dimensionsSpec/metricsSpec
{"type":"BITMAP64_BUILD_SIGNED","name":"cnt","fieldName":"user_id"}
Defensive patterns

Strategy: validation

Validate before calling

ColumnCapabilities caps = metricFactory.getColumnCapabilities(fieldName); if (caps != null && (caps.getType() == ValueType.STRING || !caps.getType().isNumeric())) { throw new IllegalArgumentException("column must be numeric: " + fieldName); }

Type guard

boolean isNumericColumn(ColumnCapabilities c) { return c != null && c.getType() != null && c.getType().isNumeric(); }

Try / catch

try { aggregatorFactory.factorize(metricFactory); } catch (IllegalArgumentException e) { if (e.getMessage().contains("does not support column")) { /* fix fieldName or cast column */ } else { throw e; } }

Prevention

When it happens

Trigger: factorize() or factorizeBuffered() is called with a column selector whose getFieldName() column has non-numeric capabilities — e.g. pointing the aggregator at a STRING dimension, a complex/serialized column, or a nested (json) column — while capabilities are non-null.

Common situations: Typo or wrong field name resolving to a string dimension instead of a numeric metric; running the aggregation against a datasource where the metric was ingested as a string; applying the aggregator to __time or an auto-detected nested column; schema changes after ingestion changed the column type.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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