apache/druid · error · UnsupportedOperationException

Numeric columns do not support value dictionaries.

Error message

Numeric columns do not support value dictionaries.

What it means

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.

Solutions

  1. Check column capabilities first and only call getSortedIndexedValues for dictionary-encoded (string) columns
  2. Use getMinValue/getMaxValue or numeric range handling for numeric columns
  3. Remove bitmap index creation for numeric columns

Example fix

// before
CloseableIndexed<Long> vals = longDimIndexer.getSortedIndexedValues();
// after
if (columnCapabilities.hasDictionaryEncodedParts()) {
  CloseableIndexed<Long> vals = indexer.getSortedIndexedValues();
} else {
  long min = indexer.getMinValue(); long max = indexer.getMaxValue();
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (!capabilities.hasDictionaryEncodedParts() || capabilities.getType() != ValueType.STRING) { /* use numeric min/max instead */ }

Type guard

boolean hasValueDictionary(ColumnCapabilities caps) { return caps != null && caps.isDictionaryEncoded().isMaybeTrue() && caps.getType() == ValueType.STRING; }

Try / catch

try { indexer.getSortedIndexedValues(); } catch (UnsupportedOperationException e) { /* fall back to numeric handling */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/segment/LongDimensionIndexer.java:77

    return new EncodedKeyComponent<>(l, Long.BYTES);
  }

  @Override
  public void setSparseIndexed()
  {
    hasNulls = true;
  }

  @Override
  public Long getUnsortedEncodedValueFromSorted(Long sortedIntermediateValue)
  {
    return sortedIntermediateValue;
  }

  @Override
  public CloseableIndexed<Long> getSortedIndexedValues()
  {
    throw new UnsupportedOperationException("Numeric columns do not support value dictionaries.");
  }

  @Override
  public Long getMinValue()
  {
    return Long.MIN_VALUE;
  }

  @Override
  public Long getMaxValue()
  {
    return Long.MAX_VALUE;
  }

  @Override
  public int getCardinality()
  {
    return DimensionDictionarySelector.CARDINALITY_UNKNOWN;

View on GitHub (pinned to 9b90983fd2)