{"record":{"id":"9a48b05d3821360b","repo":"apache/druid","slug":"makedimensionselector-is-not-supported-column-s","errorCode":null,"errorMessage":"makeDimensionSelector is not supported, column [%s] is [%s] typed and should only use makeColumnValueSelector","messagePattern":"makeDimensionSelector is not supported, column \\[(.+?)\\] is \\[(.+?)\\] typed and should only use makeColumnValueSelector","errorType":"exception","errorClass":"UOE","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/AutoTypeColumnIndexer.java","lineNumber":306,"sourceCode":"  }\n\n  @Override\n  public DimensionSelector makeDimensionSelector(\n      DimensionSpec spec,\n      IncrementalIndexRowHolder currEntry,\n      IncrementalIndex.DimensionDesc desc\n  )\n  {\n    final int dimIndex = desc.getIndex();\n    if (fieldIndexers.size() == 0 && isConstant && !hasNestedData) {\n      return DimensionSelector.constant(null, spec.getExtractionFn());\n    }\n    final ColumnValueSelector<?> rootLiteralSelector = getRootLiteralValueSelector(currEntry, dimIndex);\n    if (rootLiteralSelector != null) {\n      final FieldIndexer root = fieldIndexers.get(NestedPathFinder.JSON_PATH_ROOT);\n      final ColumnType rootType = root.isSingleType() ? root.getTypes().getSingleType() : getLogicalType();\n      if (rootType.isArray()) {\n        throw new UOE(\n            \"makeDimensionSelector is not supported, column [%s] is [%s] typed and should only use makeColumnValueSelector\",\n            spec.getOutputName(),\n            rootType\n        );\n      }\n      if (spec.getExtractionFn() == null) {\n        return new BaseSingleValueDimensionSelector()\n        {\n          @Nullable\n          @Override\n          protected String getValue()\n          {\n            return Evals.asString(rootLiteralSelector.getObject());\n          }\n\n          @Override\n          public void inspectRuntimeShape(RuntimeShapeInspector inspector)\n          {","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/AutoTypeColumnIndexer.java#L288-L324","documentation":"This AutoTypeColumnIndexer's column has a single, array-typed root literal value. Dimension selectors produce per-row String values and cannot represent arrays, so makeDimensionSelector throws UnsupportedOperationException; array columns must be read with makeColumnValueSelector, which yields the array object.","triggerScenarios":"Calling makeDimensionSelector on an auto-type column whose root value is a single array type (STRING_ARRAY, LONG_ARRAY, DOUBLE_ARRAY), e.g. from a query engine, filter, or grouping code that requests a dimension selector for an array-valued column.","commonSituations":"A query groups/filters on an array column as if it were a scalar dimension; a custom query plugin or virtual column builder assumes scalar columns; a schema change turned a column into an array type while old query code still selects it as a dimension.","solutions":["Read the column via ColumnSelectorFactory.makeColumnValueSelector instead of makeDimensionSelector.","For grouping/aggregation semantics, use the array-aware query paths (e.g. ARRAY functions or unnest) rather than treating the array as a dimension.","Unwrap the array into scalar rows at ingestion time (flatten the JSON array) if scalar dimension access is required.","Update custom extensions/virtual columns that build selectors to handle array-typed columns."],"exampleFix":"// before\nDimensionSelector sel = columnSelectorFactory.makeDimensionSelector(spec);\n// after\nColumnValueSelector<?> valSel = columnSelectorFactory.makeColumnValueSelector(spec.getOutputName());","handlingStrategy":"type-guard","validationCode":"ColumnType t = indexer.getLogicalType();\nif (t != null && t.isArray()) {\n  throw new IllegalStateException(\"use makeColumnValueSelector for \" + name);\n}","typeGuard":"boolean isArrayTyped(ColumnCapabilities caps) {\n  return caps != null && caps.getType().isArray();\n}","tryCatchPattern":"try {\n  return factory.makeDimensionSelector(spec);\n} catch (UnsupportedOperationException e) {\n  return adaptFromValueSelector(factory.makeColumnValueSelector(spec.getOutputName()), spec);\n}","preventionTips":["Inspect ColumnCapabilities.getType() before requesting a selector","Use array-aware query operators for array columns","Flatten arrays at ingestion if scalar access is needed","Keep custom virtual columns/engines updated for array type support"],"tags":["java","segment","array-column","unsupported-operation"],"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"}