{"record":{"id":"5dfa17069ebe58fa","repo":"apache/beam","slug":"no-implementation-of-aggregate-function-functionfullname","errorCode":null,"errorMessage":"No implementation of aggregate function ${functionFullName} found in ${jarPath}. 1. Create a class implementing UdfProvider and annotate it with @AutoService(UdfProvider.class). 2. Add function ${functionFullName} to the class's userDefinedAggregateFunctions implementation.","messagePattern":"No implementation of aggregate function (.+?) found in (.+?)\\. 1\\. Create a class implementing UdfProvider and annotate it with @AutoService\\(UdfProvider\\.class\\)\\. 2\\. Add function (.+?) to the class's userDefinedAggregateFunctions implementation\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/JavaUdfLoader.java","lineNumber":101,"sourceCode":"                UdfProvider.class.getSimpleName(),\n                functionFullName));\n      }\n      return functionDefinitions.scalarFunctions().get(functionPath);\n    } catch (IOException e) {\n      throw new RuntimeException(\n          String.format(\n              \"Failed to load user-defined scalar function %s from %s\", functionFullName, jarPath),\n          e);\n    }\n  }\n\n  /** Load a user-defined aggregate function from the specified jar. */\n  public AggregateFn loadAggregateFunction(List<String> functionPath, String jarPath) {\n    String functionFullName = String.join(\".\", functionPath);\n    try {\n      FunctionDefinitions functionDefinitions = loadJar(jarPath);\n      if (!functionDefinitions.aggregateFunctions().containsKey(functionPath)) {\n        throw new IllegalArgumentException(\n            String.format(\n                \"No implementation of aggregate function %s found in %s.%n\"\n                    + \" 1. Create a class implementing %s and annotate it with @AutoService(%s.class).%n\"\n                    + \" 2. Add function %s to the class's userDefinedAggregateFunctions implementation.\",\n                functionFullName,\n                jarPath,\n                UdfProvider.class.getSimpleName(),\n                UdfProvider.class.getSimpleName(),\n                functionFullName));\n      }\n      return functionDefinitions.aggregateFunctions().get(functionPath);\n    } catch (IOException e) {\n      throw new RuntimeException(\n          String.format(\n              \"Failed to load user-defined aggregate function %s from %s\",\n              functionFullName, jarPath),\n          e);\n    }","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/JavaUdfLoader.java#L83-L119","documentation":"JavaUdfLoader.loadAggregateFunction() throws IllegalArgumentException when the loaded jar's UdfProvider does not export an aggregate function with the requested path. The jar loads fine but FunctionDefinitions.aggregateFunctions() has no entry for functionPath; the message includes remediation steps about implementing UdfProvider and adding the function to userDefinedAggregateFunctions().","triggerScenarios":"Calling loadAggregateFunction(List<String> functionPath, String jarPath) (e.g. from getAggregateFn or the SQL shell during a GROUP BY with a custom aggregate) when the jar's provider lacks that aggregate function.","commonSituations":"Typo in the aggregate function name; the provider implements only userDefinedScalarFunctions, not userDefinedAggregateFunctions; missing @AutoService(UdfProvider.class); stale jar deployed before the aggregate was added.","solutions":["Ensure the aggregate is registered by overriding userDefinedAggregateFunctions() in the UdfProvider implementation.","Annotate the provider class with @AutoService(UdfProvider.class) and rebuild the jar.","Match the function name/path exactly to the registry key.","Redeploy/replace the jar at the path used by the query."],"exampleFix":"// before (only scalars registered)\npublic Map<String, ScalarFn> userDefinedScalarFunctions() {...}\n// after\n@Override\npublic Map<String, AggregateFn> userDefinedAggregateFunctions() {\n  return ImmutableMap.of(\"myagg\", new MyAggregateFn());\n}","handlingStrategy":"try-catch","validationCode":"if (!new File(jarPath).isFile()) {\n  throw new IllegalArgumentException(\"UDF jar not found: \" + jarPath);\n}","typeGuard":null,"tryCatchPattern":"try {\n  AggregateFn fn = udfLoader.loadAggregateFunction(fnPath, jarPath);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"No implementation of aggregate function\")) {\n    LOG.error(\"Aggregate {} not registered in {}\", fnPath, jarPath);\n  }\n  throw e;\n}","preventionTips":["Override userDefinedAggregateFunctions() in the UdfProvider for every custom aggregate","Distinguish scalar vs aggregate registration maps explicitly","Smoke-test loadAggregateFunction in CI with the packaged jar","Keep jar versions in sync with query definitions"],"tags":["udf","aggregate","beam"],"backgroundTag":"resource-not-found","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"}