apache/druid · warning · UnsupportedOperationException
Aggregator[%s] cannot vectorize
Error message
Aggregator[%s] cannot vectorize
What it means
AggregatorFactory.factorizeVector is a default method that subclasses must override to support the vectorized query engine; the base implementation always throws UOE. It should only be called when canVectorize() returns true, so hitting it means vectorization was attempted on an aggregator (or legacy storage path) that does not implement it.
Source
Thrown at processing/src/main/java/org/apache/druid/query/aggregation/AggregatorFactory.java:71
* If it is a multi value column then each individual value should be taken into account for aggregation e.g. if a row
* had value ["1","1","1"], doubleSum aggregation would take each of them and sum them to 3.
*/
@ExtensionPoint
public abstract class AggregatorFactory implements Cacheable
{
private static final Logger log = new Logger(AggregatorFactory.class);
public abstract Aggregator factorize(ColumnSelectorFactory metricFactory);
public abstract BufferAggregator factorizeBuffered(ColumnSelectorFactory metricFactory);
/**
* Create a VectorAggregator based on the provided column selector factory. Will throw an exception if
* this aggregation class does not support vectorization: check "canVectorize" first.
*/
public VectorAggregator factorizeVector(VectorColumnSelectorFactory selectorFactory)
{
throw new UOE("Aggregator[%s] cannot vectorize", getClass().getName());
}
/**
* Creates an {@link Aggregator} based on the provided column selector factory.
* The returned value is a holder object which contains both the aggregator
* and its initial size in bytes. The callers can then invoke
* {@link Aggregator#aggregateWithSize()} to perform aggregation and get back
* the incremental memory required in each aggregate call. Combined with the
* initial size, this gives the total on-heap memory required by the aggregator.
* <p>
* This method must include JVM object overheads in the estimated size and must
* ensure not to underestimate required memory as that might lead to OOM errors.
* <p>
* This flow does not require invoking {@link #guessAggregatorHeapFootprint(long)}
* which tends to over-estimate the required memory.
*
* @return AggregatorAndSize which contains the actual aggregator and its initial size.
*/View on GitHub (pinned to 9b90983fd2)
Solutions
- Disable vectorization for this query: set the query context "vectorize": false (or tune druid.query.vectorQuery thresholds)
- Implement factorizeVector (and canVectorize) in the custom AggregatorFactory
- Upgrade the extension providing the aggregator to a version with vectorization support
- Check canVectorize() before choosing the vectorized processing path
Example fix
// before
queryContext.put("vectorize", true);
// after
if (!aggregatorFactory.canVectorize()) {
queryContext.put("vectorize", false);
} else {
queryContext.put("vectorize", true);
} Defensive patterns
Strategy: try-catch
Validate before calling
boolean safe = aggregatorFactories.stream().allMatch(AggregatorFactory::canVectorize);
queryContext.put("vectorize", safe);
Type guard
boolean canVectorizeQuery(List<AggregatorFactory> aggs) {
return aggs.stream().allMatch(AggregatorFactory::canVectorize);
} Try / catch
try {
result = runVectorized(query);
} catch (UnsupportedOperationException e) {
queryContext.put("vectorize", false);
result = runQuery(query);
} Prevention
- Call canVectorize() before factorizeVector
- Implement factorizeVector in custom AggregatorFactory subclasses
- Set "vectorize": false in query context for queries touching non-vectorizable aggregators
When it happens
Trigger: Running a query with vectorization enabled against a datasource/aggregator (custom aggregation, complex/aggregator combination) whose AggregatorFactory doesn't override factorizeVector or reports canVectorize incorrectly.
Common situations: Custom aggregator extensions that implement factorize but not factorizeVector; queries on segment storage lacking vectorization support while the engine assumes it; index.json/druid.query.vectorQuery default maxRows Intersecting a custom aggregator.
Related errors
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/5e48b832859669b5.
Report an issue: GitHub.