{"record":{"id":"58712965c7e6833e","repo":"apache/druid","slug":"longanyaggregatorfactory-is-not-supported-during-i","errorCode":null,"errorMessage":"LongAnyAggregatorFactory is not supported during ingestion for rollup","messagePattern":"LongAnyAggregatorFactory is not supported during ingestion for rollup","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/query/aggregation/any/LongAnyAggregatorFactory.java","lineNumber":147,"sourceCode":"  }\n\n  @Override\n  public Comparator getComparator()\n  {\n    return LongSumAggregator.COMPARATOR;\n  }\n\n  @Override\n  @Nullable\n  public Object combine(@Nullable Object lhs, @Nullable Object rhs)\n  {\n    return lhs;\n  }\n\n  @Override\n  public AggregateCombiner makeAggregateCombiner()\n  {\n    throw new UOE(\"LongAnyAggregatorFactory is not supported during ingestion for rollup\");\n  }\n\n  @Override\n  public AggregatorFactory getCombiningFactory()\n  {\n    return new LongAnyAggregatorFactory(name, name);\n  }\n\n  @Override\n  public Object deserialize(Object object)\n  {\n    // handle \"NaN\" / \"Infinity\" values serialized as strings in JSON\n    if (object instanceof String) {\n      return Float.parseFloat((String) object);\n    }\n    return object;\n  }\n","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/query/aggregation/any/LongAnyAggregatorFactory.java#L129-L165","documentation":"LongAnyAggregatorFactory cannot be used during rollup ingestion: like the other 'any' aggregators, it keeps an arbitrary last-seen value with no deterministic combiner, so makeAggregateCombiner throws UOE with this message. Druid rejects this early, while building the aggregator for the incremental index.","triggerScenarios":"Ingestion with rollup enabled and a metricsSpec containing a long aggregator with fn \"any\" (longAny); Druid calls makeAggregateCombiner during index creation and throws.","commonSituations":"Users copying longAny from a native query into an ingestion spec; schema tooling or migrations that auto-generate metricsSpec entries from previous query aggregations.","solutions":["Swap longAny for a rollup-supported aggregator such as longSum, longMin, longMax, or longFirst in the metricsSpec","Disable rollup if the arbitrary last value must be kept exactly","Use longAny only at query time on top of rolled-up or raw segments","Use longFirst when the rollup key is guaranteed to map to a single row"],"exampleFix":"// before\n\"metricsSpec\": [{ \"type\": \"longAny\", \"name\": \"v\" }]\n// after\n\"metricsSpec\": [{ \"type\": \"longSum\", \"name\": \"v\" }]  // or disable rollup","handlingStrategy":"validation","validationCode":"boolean rollupSafe(IngestionSpec spec) {\n  return spec.metricsSpec.stream().noneMatch(a ->\n      \"longAny\".equals(a.getType()) && spec.rollup);\n}","typeGuard":"boolean isRollupCompatible(AggregatorFactory f) {\n  return !(f instanceof LongAnyAggregatorFactory);\n}","tryCatchPattern":"try {\n  indexBuilder.addAggregator(factory);\n} catch (UnsupportedOperationException e) {\n  LOGGER.error(e, \"Aggregator %s unsupported for rollup ingestion\", factory.getName());\n  throw new ISE(\"Replace longAny with a rollup-compatible aggregator\");\n}","preventionTips":["Use longSum/Min/Max/First in rollup metricsSpec instead of longAny","Keep any-aggregators at the query layer only","Disable rollup if the exact last value must persist","Validate auto-generated ingestion specs before job submission"],"tags":["ingestion","rollup","unsupported-operation","druid"],"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"}