apache/beam · error · UnsupportedOperationException

Aggregator [ ] is not supported

Error message

Aggregator [%s] is not supported

What it means

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.

Solutions

  1. Use a supported built-in aggregation (COUNT, SUM, MIN, MAX, AVG)
  2. Register/implement a custom CombineFn and wire it as a user-defined aggregate function
  3. Upgrade Beam where the desired aggregation may have been added

Example fix

// before
SELECT MEDIAN(score) FROM t
// after
SELECT PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY score) FROM t -- or a supported agg
Defensive patterns

Strategy: validation

Validate before calling

if (!java.util.Set.of("COUNT","SUM","MIN","MAX","AVG").contains(aggName.toUpperCase())) { throw new UnsupportedOperationException("unsupported aggregator " + aggName); }

Try / catch

try { result = sqlContext.executeQuery(query); } catch (UnsupportedOperationException e) { /* rewrite query with supported aggregations */ }

Prevention

When it happens

Trigger: 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.

Common situations: Attempting STDDEV, MEDIAN, or a custom aggregate on a Beam version that lacks it; typo'd function names in queries.

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


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/d5134328e100f6c4. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamBuiltinAggregations.java:104

              .put("STDDEV_POP", t -> VarianceFn.newPopulationStddev(t.getTypeName()))
              .put("STDDEV_SAMP", t -> VarianceFn.newSampleStddev(t.getTypeName()))
              .put("COVAR_POP", t -> CovarianceFn.newPopulation(t.getTypeName()))
              .put("COVAR_SAMP", t -> CovarianceFn.newSample(t.getTypeName()))
              .put("COUNTIF", typeName -> CountIf.combineFn())
              .build();

  private static MathContext mc = new MathContext(10, RoundingMode.HALF_UP);

  public static CombineFn<?, ?, ?> create(String functionName, Schema.FieldType fieldType) {

    Function<Schema.FieldType, CombineFn<?, ?, ?>> aggregatorFactory =
        BUILTIN_AGGREGATOR_FACTORIES.get(functionName);

    if (aggregatorFactory != null) {
      return aggregatorFactory.apply(fieldType);
    }

    throw new UnsupportedOperationException(
        String.format("Aggregator [%s] is not supported", functionName));
  }

  /** {@link CombineFn} for MAX based on {@link Max} and {@link Combine.BinaryCombineFn}. */
  static CombineFn createMax(FieldType fieldType) {
    if (CalciteUtils.isDateTimeType(fieldType)) {
      return new CustMax<>();
    }
    switch (fieldType.getTypeName()) {
      case BOOLEAN:
      case INT16:
      case BYTE:
      case FLOAT:
      case DATETIME:
      case DECIMAL:
      case STRING:
        return new CustMax<>();
      case INT32:

View on GitHub (pinned to 12126d8942)