{"record":{"id":"f5cbb06c9fe21779","repo":"apache/druid","slug":"dimensionspec-s-cannot-be-vectorized","errorCode":null,"errorMessage":"DimensionSpec[%s] cannot be vectorized","messagePattern":"DimensionSpec\\[(.+?)\\] cannot be vectorized","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/vector/QueryableIndexVectorColumnSelectorFactory.java","lineNumber":82,"sourceCode":"    this.virtualColumns = virtualColumns;\n    this.columnSelector = columnSelector;\n    this.singleValueDimensionSelectorCache = new HashMap<>();\n    this.multiValueDimensionSelectorCache = new HashMap<>();\n    this.valueSelectorCache = new HashMap<>();\n    this.objectSelectorCache = new HashMap<>();\n  }\n\n  @Override\n  public ReadableVectorInspector getReadableVectorInspector()\n  {\n    return offset;\n  }\n\n  @Override\n  public MultiValueDimensionVectorSelector makeMultiValueDimensionSelector(final DimensionSpec dimensionSpec)\n  {\n    if (!dimensionSpec.canVectorize()) {\n      throw new ISE(\"DimensionSpec[%s] cannot be vectorized\", dimensionSpec);\n    }\n    Function<DimensionSpec, MultiValueDimensionVectorSelector> mappingFunction = spec -> {\n      if (virtualColumns.exists(spec.getDimension())) {\n        return virtualColumns.makeMultiValueDimensionVectorSelector(dimensionSpec, this, columnSelector, offset);\n      }\n\n      final ColumnHolder holder = columnSelector.getColumnHolder(spec.getDimension());\n      if (holder == null\n          || holder.getCapabilities().isDictionaryEncoded().isFalse()\n          || !holder.getCapabilities().is(ValueType.STRING)\n          || holder.getCapabilities().hasMultipleValues().isFalse()) {\n        throw new ISE(\n            \"Column[%s] is not a multi-value string column, do not ask for a multi-value selector\",\n            spec.getDimension()\n        );\n      }\n\n      @SuppressWarnings(\"unchecked\")","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/vector/QueryableIndexVectorColumnSelectorFactory.java#L64-L100","documentation":"Druid's vectorized query engine requires every DimensionSpec to declare vectorization compatibility via canVectorize(). When a query asks for a multi-value dimension vector selector and the spec cannot be vectorized, the selector factory throws this IllegalStateException rather than silently falling back. It is an engine-internal consistency check.","triggerScenarios":"Querying with a DimensionSpec (e.g. certain extraction-fn or expression specs) that reports canVectorize()==false while the query is planned in vectorized mode and requests makeMultiValueDimensionSelector.","commonSituations":"Using an extraction dimension spec or custom extension DimensionSpec in an aggregator that supports vectorization; extension code adding a non-vectorizable DimensionSpec to a vector-enabled query.","solutions":["Use a vectorization-compatible DimensionSpec (e.g. DefaultDimensionSpec) for the column","Disable vectorization for the query (set query context 'vectorize':'false') to force the non-vectorized path","Fix or update the custom DimensionSpec implementation to correctly implement canVectorize()"],"exampleFix":"// before\nDimensionSpec spec = new MyCustomDimensionSpec(\"col\", \"out\"); // canVectorize() == false\n// after\nDimensionSpec spec = new DefaultDimensionSpec(\"col\", \"out\"); // vectorizable","handlingStrategy":"validation","validationCode":"if (!dimensionSpec.canVectorize()) { spec = new DefaultDimensionSpec(col, out); } // or set vectorize=false in context","typeGuard":"boolean usable = spec != null && spec.canVectorize();","tryCatchPattern":"try { sel = factory.makeMultiValueDimensionSelector(spec); } catch (IllegalStateException e) { /* fall back to non-vectorized query */ }","preventionTips":["Prefer DefaultDimensionSpec unless an extraction/transform is truly needed","Know which DimensionSpec implementations are vectorizable before enabling vectorized queries","Use query context 'vectorize':'false' when using custom specs"],"tags":["vectorization","query-engine","illegal-state","dimension-spec"],"backgroundTag":"unsupported-operation","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}