apache/druid · error · UnsupportedOperationException
DimensionSpec[ ] cannot vectorize
Error message
DimensionSpec[%s] cannot vectorize
What it means
DimensionSpec.decorate for vectorized selectors (SingleValueDimensionVectorSelector) throws UOE("DimensionSpec[%s] cannot vectorize") by default; only dimension specs that support vectorization override it. When the vectorized query engine processes a column with a non-vectorizable DimensionSpec, this error aborts the query.
Solutions
- Disable vectorization for the query: set "vectorize": false (or vectorizeDimension:false) in the query context
- Replace the DimensionSpec with a vectorization-compatible one (e.g. DefaultDimensionSpec) or pre-transform data at ingestion
- Implement/override decorate(SingleValueDimensionVectorSelector) and decorate(MultiValueDimensionVectorSelector) in your custom DimensionSpec
- Check server logs/druid.query.vectorize config to confirm which component refused to vectorize
Example fix
// before
{"queryType":"timeseries", "dimensions":[{"type":"myCustomSpec",...}], ...}
// after
{"queryType":"timeseries", "dimensions":[{"type":"default","dimension":"page",...}], "context":{"vectorize":false}} Defensive patterns
Strategy: fallback
Validate before calling
// reject non-vectorizable specs up front
if (!spec.getType().equals("default") && query.getContextBoolean("vectorize", true)) {
log.warn("DimensionSpec may not vectorize; set vectorize=false or use DefaultDimensionSpec");
} Type guard
boolean canVectorize(DimensionSpec s) { return s instanceof DefaultDimensionSpec || s instanceof IndexedDimensionSpec; } Try / catch
try { return factory.makeVectorSelector(spec); } catch (UnsupportedOperationException | UOE e) { return factory.makeDimensionSelector(spec); /* non-vector path */ } Prevention
- Prefer DefaultDimensionSpec for vector-enabled queries
- Set "vectorize": false in query context when using exotic specs
- Implement vector decorate(...) overrides in custom DimensionSpecs
- Check query planning logs for vectorization fallbacks
When it happens
Trigger: Running a vector-enabled query (default when possible) whose groupBy/timeseries/topN uses a DimensionSpec that lacks vector support — e.g. certain extraction-fn or decorated specs, or custom DimensionSpec implementations.
Common situations: Custom DimensionSpec plugins not updated for vectorized engines; query JSON using extraction functions incompatible with vectorization; cluster where vectorization auto-enabled but specs predate it.
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
- DimensionSpec[ ] cannot be vectorized
- Aggregator[ ] cannot vectorize
- Cannot handle datasource
- Cannot handle subquery
- Cannot operate on a dimension with no dictionary
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/a3e6a4e906674918.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/query/dimension/DimensionSpec.java:78
/**
* Decorate a {@link DimensionSelector}, allowing custom transformation of underlying behavior (e.g. performing
* extraction functions in the case of {@link ExtractionDimensionSpec}, regex filtering in the case of
* {@link RegexFilteredDimensionSpec}, and so on).
*/
DimensionSelector decorate(DimensionSelector selector);
/**
* Vectorized analog of {@link #decorate(DimensionSelector)} for {@link SingleValueDimensionVectorSelector}, most
* likely produced with
* {@link org.apache.druid.segment.vector.VectorColumnSelectorFactory#makeSingleValueDimensionSelector(DimensionSpec)}
*
* Decoration allows a {@link DimensionSpec} to customize the behavior of the underlying selector, for example
* transforming or filtering values.
*/
default SingleValueDimensionVectorSelector decorate(SingleValueDimensionVectorSelector selector)
{
throw new UOE("DimensionSpec[%s] cannot vectorize", getClass().getName());
}
/**
* Vectorized analog of {@link #decorate(DimensionSelector) for {@link MultiValueDimensionVectorSelector}, most likely
* produced with
* {@link org.apache.druid.segment.vector.VectorColumnSelectorFactory#makeMultiValueDimensionSelector(DimensionSpec)}
*
* Decoration allows a {@link DimensionSpec} to customize the behavior of the underlying selector, for example
* transforming or filtering values.
*/
default MultiValueDimensionVectorSelector decorate(MultiValueDimensionVectorSelector selector)
{
throw new UOE("DimensionSpec[%s] cannot vectorize", getClass().getName());
}
/**
* Does this DimensionSpec require that decorate() be called to produce correct results?
*/View on GitHub (pinned to 9b90983fd2)