{"record":{"id":"5939c5d5ac5c7cc0","repo":"apache/beam","slug":"analytics-function-s-is-not-supported","errorCode":null,"errorMessage":"Analytics Function [%s] is not supported","messagePattern":"Analytics Function \\[(.+?)\\] 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/BeamBuiltinAnalyticFunctions.java","lineNumber":56,"sourceCode":"              // Aggregate Analytic Functions\n              .putAll(BeamBuiltinAggregations.BUILTIN_AGGREGATOR_FACTORIES)\n              // Navigation Functions\n              .put(\"FIRST_VALUE\", typeName -> navigationFirstValue())\n              .put(\"LAST_VALUE\", typeName -> navigationLastValue())\n              // Numbering Functions\n              .put(\"ROW_NUMBER\", typeName -> numberingRowNumber())\n              .put(\"DENSE_RANK\", typeName -> numberingDenseRank())\n              .put(\"RANK\", typeName -> numberingRank())\n              .put(\"PERCENT_RANK\", typeName -> numberingPercentRank())\n              .build();\n\n  public static Combine.CombineFn<?, ?, ?> create(String functionName, Schema.FieldType fieldType) {\n    Function<Schema.FieldType, Combine.CombineFn<?, ?, ?>> aggregatorFactory =\n        BUILTIN_ANALYTIC_FACTORIES.get(functionName);\n    if (aggregatorFactory != null) {\n      return aggregatorFactory.apply(fieldType);\n    }\n    throw new UnsupportedOperationException(\n        String.format(\"Analytics Function [%s] is not supported\", functionName));\n  }\n\n  // Navigation functions\n  public static <T> Combine.CombineFn<T, ?, T> navigationFirstValue() {\n    return new FirstValueCombineFn();\n  }\n\n  public static <T> Combine.CombineFn<T, ?, T> navigationLastValue() {\n    return new LastValueCombineFn();\n  }\n\n  private static class FirstValueCombineFn<T> extends Combine.CombineFn<T, Optional<T>, T> {\n    private FirstValueCombineFn() {}\n\n    @Override\n    public Optional<T> createAccumulator() {\n      return Optional.empty();","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamBuiltinAnalyticFunctions.java#L38-L74","documentation":"BeamBuiltinAnalyticFunctions.create(functionName, fieldType) looks up functionName in the BUILTIN_ANALYTIC_FACTORIES registry of supported analytic (window) function combiners. If the name is not registered (aggregatorFactory == null) it throws UnsupportedOperationException stating the analytic function is unsupported. This guards the closed set of built-in analytic functions Beam SQL can plan.","triggerScenarios":"Calling BeamBuiltinAnalyticFunctions.create with a function name string that is not in the registry — e.g. an unsupported window function like NTILE or PERCENT_RANK in an OVER clause, or a misspelled function name passed programmatically.","commonSituations":"Using an analytic function available in other SQL engines (e.g. LISTAGG, MEDIAN as analytic) that Beam SQL has not implemented; case-sensitivity or spelling mismatch of the function name; version differences where a function was added only in newer Beam releases.","solutions":["Check BUILTIN_ANALYTIC_FACTORIES in BeamBuiltinAnalyticFunctions for the exact supported function names and use one of those in the query.","Upgrade the Beam version — newer releases add more analytic functions.","Implement the window computation manually (e.g. with beam-sdks-java extensions or a custom CombineFn and windowing) and register it in the factory map if extending the SDK.","Fix name casing/spelling — the registry lookup is exact-string."],"exampleFix":"// before\nCombineFn fn = BeamBuiltinAnalyticFunctions.create(\"NTILE\", fieldType); // throws\n\n// after\nCombineFn fn = BeamBuiltinAnalyticFunctions.create(\"LAG\", fieldType); // registered name\n// or implement NTILE manually via GlobalWindows + custom combiner","handlingStrategy":"validation","validationCode":"java.util.Set<String> supported = java.util.Set.of(\"LAG\", \"LEAD\", \"FIRST_VALUE\", \"LAST_VALUE\", \"NTH_VALUE\"); // mirror BUILTIN_ANALYTIC_FACTORIES keys\nif (!supported.contains(functionName)) {\n  throw new IllegalArgumentException(\"Analytic function not supported: \" + functionName);\n}","typeGuard":"boolean analyticSupported(String fn, org.apache.beam.sdk.extensions.sql.impl.transform.BeamBuiltinAnalyticFunctions ignored) {\n  // consult the registry directly if accessible\n  return fn != null && BUILTIN_ANALYTIC_FACTORIES.containsKey(fn);\n}","tryCatchPattern":"try {\n  Combine.CombineFn<?, ?, ?> fn = BeamBuiltinAnalyticFunctions.create(functionName, fieldType);\n} catch (UnsupportedOperationException e) {\n  // fall back to manual window computation or a different supported function\n}","preventionTips":["Check the supported analytic function list for your Beam version before writing OVER() queries.","Match function names exactly — the registry lookup is case-sensitive string equality.","On upgrade, re-check that newly used analytic functions are registered."],"tags":["beam-sql","analytic-functions","window-functions","java"],"backgroundTag":"unsupported-enum-value","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"}