apache/druid · error · UnsupportedOperationException
Map column doesn't support getRow()
Error message
Map column doesn't support getRow()
What it means
MapTypeMapVirtualColumnDimensionSelector wraps a map-typed virtual column and only supports map-style access (getKeySelector/getObject). The DimensionSelector contract's row-oriented and dictionary-lookup methods are meaningless for a map column, so this class deliberately throws UnsupportedOperationException instead of returning wrong data.
Source
Thrown at extensions-contrib/virtual-columns/src/main/java/org/apache/druid/segment/MapTypeMapVirtualColumnDimensionSelector.java:49
/**
* {@link DimensionSelector} for {@link Map} type {@link MapVirtualColumn}. This dimensionSelector only supports
* {@link #getObject()} currently.
*/
final class MapTypeMapVirtualColumnDimensionSelector extends MapVirtualColumnDimensionSelector
{
MapTypeMapVirtualColumnDimensionSelector(
DimensionSelector keySelector,
DimensionSelector valueSelector
)
{
super(keySelector, valueSelector);
}
@Override
public IndexedInts getRow()
{
throw new UnsupportedOperationException("Map column doesn't support getRow()");
}
@Override
public ValueMatcher makeValueMatcher(@Nullable String value)
{
return new ValueMatcher()
{
@Override
public boolean matches(boolean includeUnknown)
{
// Map column doesn't match with any string
return false;
}
@Override
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
{
View on GitHub (pinned to 9b90983fd2)
Solutions
- Do not use the map virtual column as a scalar/array dimension; use its keys/values via MAP_KEYS() or MAP_VALUES() functions or index into it instead.
- Rewrite the query so the map column is only consumed through getObject()/map-aware operators (e.g. SELECT it as JSON, or extract a specific key).
- If you own custom query code, detect map-typed columns and avoid calling getRow()/lookupName()/idLookup() on their selectors.
- Contribute upstream support (return an IndexedInts of the key/value selector) if a legitimate row-wise use is needed.
Example fix
// before
DimValHolder v = selector.getRow(); // throws UnsupportedOperationException
// after
Object mapVal = selector.getObject(); // map-aware access
// or extract a key in SQL: SELECT MAP_EXTRACT('k', mapCol) AS k FROM ... Defensive patterns
Strategy: type-guard
Validate before calling
// Java: before using the selector row-wise
if (selector instanceof MapTypeMapVirtualColumnDimensionSelector) {
// use map-aware path
Object mapValue = ((BaseMapVirtualColumnDimensionSelector) selector).getObject();
} else {
IndexedInts row = selector.getRow();
} Type guard
boolean supportsRowAccess(DimensionSelector s) {
return !(s instanceof MapTypeMapVirtualColumnDimensionSelector);
} Try / catch
try {
IndexedInts row = selector.getRow();
process(row);
} catch (UnsupportedOperationException e) {
processMapAware(selector.getObject());
} Prevention
- Never call getRow()/lookupName()/idLookup() on selectors from map-typed virtual columns.
- Check nameLookupPossibleInAdvance() before dictionary operations.
- Consume map columns via getObject() or MAP_KEYS/MAP_VALUES SQL functions.
- Test custom query operators against map virtual columns, not just string dimensions.
When it happens
Trigger: Calling getRow() on a dimension selector obtained from a map-type virtual column (e.g. using MAP_KEYS/MAP_VALUES-backed virtual columns) in any query path that expects an array/list dimension: group-by on the column directly, filter code that iterates IndexedInts, or any engine/operator that reads the selector row-wise instead of via getObject().
Common situations: Users try to group by or filter directly on a map virtual column expression; query planners or custom extensions assume every DimensionSelector supports getRow; older query engines or community code paths written before map-typed columns existed reach this selector.
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
- Map column doesn't support lookupName()
- Map column doesn't support idLookup()
- Reverse lookup not allowed.
- Serialization not supported here
- Avro + JQ not supported
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/feffd782368742b4.
Report an issue: GitHub.