apache/druid · error · UnsupportedOperationException

Map column doesn't support lookupName()

Error message

Map column doesn't support lookupName()

What it means

This dimension selector has no dictionary (name lookup is only possible lazily and idLookup() returns null semantics), so mapping an encoded id back to its string name is impossible. lookupName() throws UnsupportedOperationException to signal the column is not dictionary-backed.

Source

Thrown at extensions-contrib/virtual-columns/src/main/java/org/apache/druid/segment/MapTypeMapVirtualColumnDimensionSelector.java:101

      @Override
      public void inspectRuntimeShape(RuntimeShapeInspector inspector)
      {

      }
    };
  }

  @Override
  public int getValueCardinality()
  {
    return CARDINALITY_UNKNOWN;
  }

  @Nullable
  @Override
  public String lookupName(int id)
  {
    throw new UnsupportedOperationException("Map column doesn't support lookupName()");
  }

  @Override
  public boolean nameLookupPossibleInAdvance()
  {
    return false;
  }

  @Nullable
  @Override
  public IdLookup idLookup()
  {
    throw new UnsupportedOperationException("Map column doesn't support idLookup()");
  }

  @Override
  public Object getObject()
  {

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Check nameLookupPossibleInAdvance() before calling lookupName(); for this selector it returns false, so restructure to avoid name resolution.
  2. Use the map column only through getObject()/key-value selectors rather than as a dictionary dimension.
  3. Extract the needed key into a regular (dictionary-backed) column or virtual column expression before querying it.

Example fix

// before
String name = selector.lookupName(id); // throws
// after
if (selector.nameLookupPossibleInAdvance()) {
  String name = selector.lookupName(id);
} else {
  Object raw = selector.getObject(); // map-aware path
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (selector.nameLookupPossibleInAdvance()) { String n = selector.lookupName(id); } else { /* map-aware path */ }

Type guard

String safeLookupName(DimensionSelector s, int id) {
  return s.nameLookupPossibleInAdvance() ? s.lookupName(id) : null;
}

Try / catch

try {
  return selector.lookupName(id);
} catch (UnsupportedOperationException e) {
  return null; // fall back to raw id / map-aware access
}

Prevention

When it happens

Trigger: Any code path calling lookupName(int) on the selector: value extraction in JSON output paths that resolve dimension ids to strings, string-based ValueMatchers built via lookupName, or search/select queries on a map virtual column.

Common situations: GroupBy v1 or search queries that require dictionary resolution applied to a map virtual column; custom code that calls lookupName without first checking nameLookupPossibleInAdvance() (which returns false here).

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