{"record":{"id":"79d758203592e270","repo":"apache/druid","slug":"cannot-vectorize-fixed-bucket-histogram-aggregatio","errorCode":null,"errorMessage":"cannot vectorize fixed bucket histogram aggregation for type %s","messagePattern":"cannot vectorize fixed bucket histogram aggregation for type (.+?)","errorType":"validation","errorClass":"org.apache.druid.java.util.common.IAE","httpStatus":null,"severity":"error","filePath":"extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramAggregatorFactory.java","lineNumber":124,"sourceCode":"  }\n\n  @Override\n  public VectorAggregator factorizeVector(VectorColumnSelectorFactory columnSelectorFactory)\n  {\n    ColumnCapabilities capabilities = columnSelectorFactory.getColumnCapabilities(fieldName);\n    if (null == capabilities) {\n      throw new IAE(\"could not find the column type for column %s\", fieldName);\n    }\n    if (capabilities.isNumeric()) {\n      return new FixedBucketsHistogramVectorAggregator(\n          columnSelectorFactory.makeValueSelector(fieldName),\n          lowerLimit,\n          upperLimit,\n          numBuckets,\n          outlierHandlingMode\n      );\n    } else {\n      throw new IAE(\"cannot vectorize fixed bucket histogram aggregation for type %s\", capabilities.asTypeString());\n    }\n  }\n\n  @Override\n  public boolean canVectorize(ColumnInspector columnInspector)\n  {\n    ColumnCapabilities capabilities = columnInspector.getColumnCapabilities(fieldName);\n    return capabilities != null && capabilities.isNumeric();\n  }\n\n  @Override\n  public Comparator getComparator()\n  {\n    return FixedBucketsHistogramAggregator.COMPARATOR;\n  }\n\n  @Nullable\n  @Override","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramAggregatorFactory.java#L106-L142","documentation":"FixedBucketsHistogramAggregatorFactory.factorizeVector() throws this IllegalArgumentException when vectorized query execution is requested but the input column's capabilities do not correspond to a type that the vector engine can process for this aggregator (i.e. not a string/serialized-histogram column it recognizes). Druid's vectorization engine only supports aggregators it has explicit vector implementations for, so the factory refuses to produce a VectorAggregator for unsupported column types instead of silently producing wrong results.","triggerScenarios":"Running a query with a fixed-buckets histogram aggregator with vectorization enabled (druid.query.vectorize default or query context enableVectorize=true) against a column whose ColumnCapabilities type is not the expected string/serialized histogram type, e.g. a numeric or complex column the vectorizer cannot handle.","commonSituations":"Users point the histogram aggregator at a numeric column (long/double) instead of a string column holding base64-encoded FixedBucketsHistogram objects, or enable vectorization on a datasource where the histogram column was ingested with an unexpected type.","solutions":["Disable vectorization for the query: set query context 'enableVectorize': false (or change druid.query.vectorize default).","Verify the input column is a STRING column containing base64-encoded FixedBucketsHistogram values; fix the ingestion spec column type if not.","Check capabilities.asTypeString() in the message to see what type the column actually is and align the aggregator/ingestion with that type.","If the type should be supported, upgrade Druid; newer versions add vectorization support for more column types."],"exampleFix":"// before: query context\n{\"aggregations\": {\"type\": \"fixedBucketsHistogram\", ...}, \"context\": {\"enableVectorize\": true}}\n// after\n{\"aggregations\": {\"type\": \"fixedBucketsHistogram\", ...}, \"context\": {\"enableVectorize\": false}}","handlingStrategy":"validation","validationCode":"ColumnCapabilities caps = columnInspector.getColumnCapabilities(columnName);\nif (caps == null || !\"STRING\".equals(caps.getType().toString())) {\n  // disable vectorization or fix column type before issuing the query\n  context.put(\"enableVectorize\", false);\n}","typeGuard":"boolean canVectorizeHistogram(ColumnInspector col, String name) {\n  ColumnCapabilities c = col.getColumnCapabilities(name);\n  return c != null && c.getType().equals(ColumnType.STRING);\n}","tryCatchPattern":"try {\n  aggregator = factory.factorizeVector(columnSelectorFactory);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"cannot vectorize\")) {\n    aggregator = factory.factorize(columnSelectorFactory); // non-vector fallback\n  } else throw e;\n}","preventionTips":["Keep histogram columns as STRING type holding base64-encoded histograms.","Check factory.canVectorize(inspector) before requesting a vector aggregator.","Disable vectorization in query context for histogram-heavy queries.","Inspect the reported column type in the error message to diagnose ingestion type mismatches."],"tags":["druid","vectorization","histogram","aggregation"],"backgroundTag":"unsupported-operation","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}