{"record":{"id":"ffe1f54b88e4b431","repo":"apache/druid","slug":"aggregation-s-does-not-support-column-s-of-t","errorCode":null,"errorMessage":"Aggregation [%s] does not support column [%s] of type [%s]. Supported types: numeric.","messagePattern":"Aggregation \\[(.+?)\\] does not support column \\[(.+?)\\] of type \\[(.+?)\\]\\. Supported types: numeric\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/druid-exact-count-bitmap/src/main/java/org/apache/druid/query/aggregation/exact/count/bitmap64/Bitmap64ExactCountBuildAggregatorFactory.java","lineNumber":91,"sourceCode":"  public ColumnType getResultType()\n  {\n    return ColumnType.LONG;\n  }\n\n  /**\n   * Ensures that the column referenced by {@link #getFieldName()} is of a numeric type when this aggregator is used\n   * in a native Druid query. We must enforce the constraint here to provide a clear and early failure if the\n   * query references a non-numeric (e.g., STRING) column.\n   *\n   * @throws IllegalArgumentException if the column exists and is not numeric.\n   */\n  private void validateNumericColumn(ColumnSelectorFactory metricFactory)\n  {\n    final ColumnCapabilities capabilities = metricFactory.getColumnCapabilities(getFieldName());\n    if (capabilities != null) {\n      final ValueType valueType = capabilities.getType();\n      if (!valueType.isNumeric()) {\n        throw new IAE(\n            \"Aggregation [%s] does not support column [%s] of type [%s]. Supported types: numeric.\",\n            Bitmap64ExactCountModule.BUILD_TYPE_NAME, getFieldName(), valueType);\n      }\n    }\n  }\n}\n","sourceCodeStart":73,"sourceCodeEnd":98,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/druid-exact-count-bitmap/src/main/java/org/apache/druid/query/aggregation/exact/count/bitmap64/Bitmap64ExactCountBuildAggregatorFactory.java#L73-L98","documentation":"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.).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Point fieldName at a numeric column (long/float/double metric) in the aggregator spec: {\"type\":\"BITMAP64_BUILD_SIGNED\",\"name\":\"...\",\"fieldName\":\"myLongMetric\"}.","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.","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.","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."],"exampleFix":"// before\n{\"type\":\"BITMAP64_BUILD_SIGNED\",\"name\":\"cnt\",\"fieldName\":\"user_id_str\"}\n\n// after (ingest numeric, then aggregate)\n{\"type\":\"long\",\"name\":\"user_id\"} in dimensionsSpec/metricsSpec\n{\"type\":\"BITMAP64_BUILD_SIGNED\",\"name\":\"cnt\",\"fieldName\":\"user_id\"}","handlingStrategy":"validation","validationCode":"ColumnCapabilities caps = metricFactory.getColumnCapabilities(fieldName); if (caps != null && (caps.getType() == ValueType.STRING || !caps.getType().isNumeric())) { throw new IllegalArgumentException(\"column must be numeric: \" + fieldName); }","typeGuard":"boolean isNumericColumn(ColumnCapabilities c) { return c != null && c.getType() != null && c.getType().isNumeric(); }","tryCatchPattern":"try { aggregatorFactory.factorize(metricFactory); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"does not support column\")) { /* fix fieldName or cast column */ } else { throw e; } }","preventionTips":["Verify the fieldName resolves to a long/float/double metric, not a string dimension","Check INFORMATION_SCHEMA.COLUMNS (or segment metadata) for the column's actual type before querying","Cast string fields during ingestion into numeric metrics","Watch for schema drift across segments when column types change"],"tags":["druid","aggregation","column-type","validation","schema"],"backgroundTag":"invalid-argument-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}