apache/druid · error · ISE

Cannot create dimension for type

Error message

Cannot create dimension for type[%s]

What it means

DimensionSchemaUtils.getDimensionType maps a query-side column type to a DimensionSchema multi-value/array type; when the given DruidType (queryType) has no corresponding dimension schema representation, this ISE is thrown.

Solutions

  1. Change the column type to a supported one (string, long, float, double, or supported arrays)
  2. Set the array ingest mode explicitly (arrayIngestMode in the query context) so array types map correctly
  3. Check the Druid version for MSQ type-mapping support of the type in question and upgrade if needed
  4. Cast the offending column to a supported type in the SQL query

Example fix

// before
INSERT INTO dst SELECT ARRAY_AGG(x) ... -- complex type unmapped
// after
INSERT INTO dst SELECT ARRAY_AGG(CAST(x AS VARCHAR)) ...
Defensive patterns

Strategy: validation

Validate before calling

// verify column type is supported before INSERT/REPLACE
Set<String> supported = Set.of("STRING","LONG","FLOAT","DOUBLE","ARRAY<STRING>","ARRAY<LONG>","ARRAY<DOUBLE>");
if (!supported.contains(columnType.toUpperCase())) {
  throw new IllegalArgumentException("Unsupported MSQ dimension type: " + columnType);
}

Prevention

When it happens

Trigger: Translating a native query with an input column whose type is not a string, long, float, double, or supported array type (e.g. an unsupported complex type) during MSQ ingestion spec generation.

Common situations: Ingesting into a column typed as a nested/complex type the MSQ dimension mapping does not support; using an unusual column type in an INSERT/REPLACE via sql-msq; version gaps where new types aren't yet mapped.

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/e525c641f4c997b4. Report an issue: GitHub.

Appendix: source

Thrown at multi-stage-query/src/main/java/org/apache/druid/msq/util/DimensionSchemaUtils.java:157

             .emit();
          return ColumnType.STRING;
        } else {
          return queryType;
        }
      } else if (elementType.isNumeric()) {
        // ValueType == LONG || ValueType == FLOAT || ValueType == DOUBLE
        if (arrayIngestMode == ArrayIngestMode.ARRAY) {
          return queryType;
        } else {
          throw InvalidInput.exception(
              "Numeric arrays can only be ingested when '%s' is set to 'array'. "
              + "Current value of the parameter is[%s]",
              MultiStageQueryContext.CTX_ARRAY_INGEST_MODE,
              StringUtils.toLowerCase(arrayIngestMode.name())
          );
        }
      } else {
        throw new ISE("Cannot create dimension for type[%s]", queryType.toString());
      }
    } else {
      return queryType;
    }
  }
}

View on GitHub (pinned to 9b90983fd2)