{"record":{"id":"d5134328e100f6c4","repo":"apache/beam","slug":"aggregator-s-is-not-supported","errorCode":null,"errorMessage":"Aggregator [%s] is not supported","messagePattern":"Aggregator \\[(.+?)\\] is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamBuiltinAggregations.java","lineNumber":104,"sourceCode":"              .put(\"STDDEV_POP\", t -> VarianceFn.newPopulationStddev(t.getTypeName()))\n              .put(\"STDDEV_SAMP\", t -> VarianceFn.newSampleStddev(t.getTypeName()))\n              .put(\"COVAR_POP\", t -> CovarianceFn.newPopulation(t.getTypeName()))\n              .put(\"COVAR_SAMP\", t -> CovarianceFn.newSample(t.getTypeName()))\n              .put(\"COUNTIF\", typeName -> CountIf.combineFn())\n              .build();\n\n  private static MathContext mc = new MathContext(10, RoundingMode.HALF_UP);\n\n  public static CombineFn<?, ?, ?> create(String functionName, Schema.FieldType fieldType) {\n\n    Function<Schema.FieldType, CombineFn<?, ?, ?>> aggregatorFactory =\n        BUILTIN_AGGREGATOR_FACTORIES.get(functionName);\n\n    if (aggregatorFactory != null) {\n      return aggregatorFactory.apply(fieldType);\n    }\n\n    throw new UnsupportedOperationException(\n        String.format(\"Aggregator [%s] is not supported\", functionName));\n  }\n\n  /** {@link CombineFn} for MAX based on {@link Max} and {@link Combine.BinaryCombineFn}. */\n  static CombineFn createMax(FieldType fieldType) {\n    if (CalciteUtils.isDateTimeType(fieldType)) {\n      return new CustMax<>();\n    }\n    switch (fieldType.getTypeName()) {\n      case BOOLEAN:\n      case INT16:\n      case BYTE:\n      case FLOAT:\n      case DATETIME:\n      case DECIMAL:\n      case STRING:\n        return new CustMax<>();\n      case INT32:","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamBuiltinAggregations.java#L86-L122","documentation":"BeamBuiltinAggregations.create looks up a CombineFn factory in BUILTIN_AGGREGATOR_FACTORIES by the SQL aggregation function name; if the name is not registered it throws UnsupportedOperationException.","triggerScenarios":"Using an aggregation function in Beam SQL (via SqlAggregationFunction or user-defined agg) that is not among the built-ins (COUNT, SUM, MIN, MAX, AVG etc.), so create() finds a null factory.","commonSituations":"Attempting STDDEV, MEDIAN, or a custom aggregate on a Beam version that lacks it; typo'd function names in queries.","solutions":["Use a supported built-in aggregation (COUNT, SUM, MIN, MAX, AVG)","Register/implement a custom CombineFn and wire it as a user-defined aggregate function","Upgrade Beam where the desired aggregation may have been added"],"exampleFix":"// before\nSELECT MEDIAN(score) FROM t\n// after\nSELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY score) FROM t -- or a supported agg","handlingStrategy":"validation","validationCode":"if (!java.util.Set.of(\"COUNT\",\"SUM\",\"MIN\",\"MAX\",\"AVG\").contains(aggName.toUpperCase())) { throw new UnsupportedOperationException(\"unsupported aggregator \" + aggName); }","typeGuard":null,"tryCatchPattern":"try { result = sqlContext.executeQuery(query); } catch (UnsupportedOperationException e) { /* rewrite query with supported aggregations */ }","preventionTips":["Use only built-in aggregations supported by the Beam version","Register custom CombineFns for advanced aggregates","Check BeamBuiltinAggregations source for the supported list","Upgrade Beam if newer aggregates are needed"],"tags":["sql","aggregation","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}