{"record":{"id":"e7d22d1251c3eaa2","repo":"apache/druid","slug":"numeric-columns-do-not-support-value-dictionaries","errorCode":null,"errorMessage":"Numeric columns do not support value dictionaries.","messagePattern":"Numeric columns do not support value dictionaries\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/segment/LongDimensionIndexer.java","lineNumber":77,"sourceCode":"    return new EncodedKeyComponent<>(l, Long.BYTES);\n  }\n\n  @Override\n  public void setSparseIndexed()\n  {\n    hasNulls = true;\n  }\n\n  @Override\n  public Long getUnsortedEncodedValueFromSorted(Long sortedIntermediateValue)\n  {\n    return sortedIntermediateValue;\n  }\n\n  @Override\n  public CloseableIndexed<Long> getSortedIndexedValues()\n  {\n    throw new UnsupportedOperationException(\"Numeric columns do not support value dictionaries.\");\n  }\n\n  @Override\n  public Long getMinValue()\n  {\n    return Long.MIN_VALUE;\n  }\n\n  @Override\n  public Long getMaxValue()\n  {\n    return Long.MAX_VALUE;\n  }\n\n  @Override\n  public int getCardinality()\n  {\n    return DimensionDictionarySelector.CARDINALITY_UNKNOWN;","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/LongDimensionIndexer.java#L59-L95","documentation":"LongDimensionIndexer.getSortedIndexedValues always throws UnsupportedOperationException because numeric (long) dimensions have no value dictionary — dictionaries exist only for string dimensions. Calling any API that requires reading a dimension's dictionary of sorted values on a numeric column triggers this.","triggerScenarios":"Invoking getSortedIndexedValues() on a numeric dimension indexer, e.g. during segment conversion, filtering code paths that assume dictionary-encoded dimensions, or building bitmap indexes for numeric columns.","commonSituations":"Custom plugins scanning dimensions generically without checking the column capability; older code paths assuming all dimensions are string-dictionary encoded; enabling indexes on numeric columns.","solutions":["Check column capabilities first and only call getSortedIndexedValues for dictionary-encoded (string) columns","Use getMinValue/getMaxValue or numeric range handling for numeric columns","Remove bitmap index creation for numeric columns"],"exampleFix":"// before\nCloseableIndexed<Long> vals = longDimIndexer.getSortedIndexedValues();\n// after\nif (columnCapabilities.hasDictionaryEncodedParts()) {\n  CloseableIndexed<Long> vals = indexer.getSortedIndexedValues();\n} else {\n  long min = indexer.getMinValue(); long max = indexer.getMaxValue();\n}","handlingStrategy":"type-guard","validationCode":"if (!capabilities.hasDictionaryEncodedParts() || capabilities.getType() != ValueType.STRING) { /* use numeric min/max instead */ }","typeGuard":"boolean hasValueDictionary(ColumnCapabilities caps) { return caps != null && caps.isDictionaryEncoded().isMaybeTrue() && caps.getType() == ValueType.STRING; }","tryCatchPattern":"try { indexer.getSortedIndexedValues(); } catch (UnsupportedOperationException e) { /* fall back to numeric handling */ }","preventionTips":["Check ColumnCapabilities before calling dictionary APIs","Avoid bitmap/dictionary logic on numeric dimensions","Handle numeric columns via range-based (Long-range) code paths"],"tags":["druid","numeric-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"}