{"record":{"id":"2caed8c57cb277cb","repo":"apache/druid","slug":"dimension-selector-is-currently-unsupported-for","errorCode":null,"errorMessage":"Dimension selector is currently unsupported for [%s]","messagePattern":"Dimension selector is currently unsupported for \\[(.+?)\\]","errorType":"exception","errorClass":"org.apache.druid.java.util.common.IAE","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/nested/VariantColumn.java","lineNumber":382,"sourceCode":"  @Override\n  public int getCardinality()\n  {\n    if (logicalType.isArray() && variantTypes == null) {\n      return arrayDictionary.size();\n    }\n    // this probably isn't correct if we expose this as a multi-value dimension instead of an array, which would leave\n    // the array dictionary out of this computation\n    return stringDictionary.size() + longDictionary.size() + doubleDictionary.size() + arrayDictionary.size();\n  }\n\n  @Override\n  public DimensionSelector makeDimensionSelector(\n      ReadableOffset offset,\n      @Nullable ExtractionFn extractionFn\n  )\n  {\n    if (variantTypes == null && logicalType.isArray()) {\n      throw new IAE(\"Dimension selector is currently unsupported for [%s]\", logicalType);\n    }\n    // copy everywhere all the time\n    class StringDimensionSelector extends AbstractDimensionSelector\n        implements SingleValueHistoricalDimensionSelector, IdLookup\n    {\n      private final SingleIndexedInt row = new SingleIndexedInt();\n\n      @Override\n      public IndexedInts getRow()\n      {\n        row.setValue(getRowValue());\n        return row;\n      }\n\n      public int getRowValue()\n      {\n        return encodedValueColumn.get(offset.getOffset());\n      }","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/nested/VariantColumn.java#L364-L400","documentation":"VariantColumn.makeDimensionSelector refuses to build a DimensionSelector when the column has no known variant types (variantTypes == null) and its logical type is an array. Array-only variant columns must be accessed through array/object selectors, not the dimension-selector API, so the column throws IAE immediately.","triggerScenarios":"Calling makeDimensionSelector (via dimensionSelector) on a variant column whose logicalType is an array (e.g. ARRAY<STRING>) and whose variantTypes was not populated, e.g. from a query plan or cursor that selects the array column as a group-by dimension.","commonSituations":"Group-by or dimension-filtered queries referencing an ARRAY column directly; native queries using a dimension spec on an array-typed nested field; SQL that doesn't apply UNNEST or array functions before grouping.","solutions":["Use UNNEST or SQL array functions (ARRAY_CONTAINS, ARRAY_OVERLAP, etc.) instead of grouping on the raw array","Use a native array filter (filter selector) rather than a dimension selector","Ensure the column's type info was ingested so variantTypes is populated for mixed-type columns","Rewrite the native query to use an object/vector selector path for the array column"],"exampleFix":"// before\nDimensionSelector sel = column.makeDimensionSelector(offset, extractionFn); // array column\n// after\nObject val = objectSelector.getObject(); then use array-aware processing or UNNEST in SQL","handlingStrategy":"validation","validationCode":"if (column.getLogicalType().isArray()) { /* do not create a dimension selector; use array/object selector */ }","typeGuard":"static boolean canMakeDimensionSelector(VariantColumn c) { return !(c.getLogicalType().isArray()); }","tryCatchPattern":"try { sel = column.makeDimensionSelector(offset, fn); } catch (IAE e) { if (e.getMessage().contains(\"Dimension selector is currently unsupported\")) { /* fall back to object selector */ } else { throw e; } }","preventionTips":["Never group or filter directly on ARRAY-typed nested columns via dimension specs","Use UNNEST/array SQL functions for arrays","Ensure ingestion records variantTypes so mixed-type columns get selector support"],"tags":["druid","nested-columns","arrays","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"}