apache/beam · error · IllegalArgumentException

No implementation of scalar function ${functionFullName} fou

Error message

No implementation of scalar 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 userDefinedScalarFunctions implementation.

What it means

JavaUdfLoader.loadScalarFunction() throws IllegalArgumentException when the UdfProvider registered in the given jar does not export a scalar function with the requested fully-qualified path. The jar loaded successfully but FunctionDefinitions.scalarFunctions() has no entry for functionPath. The message includes remediation steps about implementing and registering UdfProvider.

Source

Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/JavaUdfLoader.java:75

public class JavaUdfLoader {
  private static final Logger LOG = LoggerFactory.getLogger(JavaUdfLoader.class);

  /**
   * Maps the external jar location to the functions the jar defines. Static so it can persist
   * across multiple SQL transforms.
   */
  private static final Map<String, FunctionDefinitions> functionCache = new HashMap<>();

  /** Maps potentially remote jar paths to their local file copies. */
  private static final Map<String, File> jarCache = new HashMap<>();

  /** Load a user-defined scalar function from the specified jar. */
  public ScalarFn loadScalarFunction(List<String> functionPath, String jarPath) {
    String functionFullName = String.join(".", functionPath);
    try {
      FunctionDefinitions functionDefinitions = loadJar(jarPath);
      if (!functionDefinitions.scalarFunctions().containsKey(functionPath)) {
        throw new IllegalArgumentException(
            String.format(
                "No implementation of scalar function %s found in %s.%n"
                    + " 1. Create a class implementing %s and annotate it with @AutoService(%s.class).%n"
                    + " 2. Add function %s to the class's userDefinedScalarFunctions implementation.",
                functionFullName,
                jarPath,
                UdfProvider.class.getSimpleName(),
                UdfProvider.class.getSimpleName(),
                functionFullName));
      }
      return functionDefinitions.scalarFunctions().get(functionPath);
    } catch (IOException e) {
      throw new RuntimeException(
          String.format(
              "Failed to load user-defined scalar function %s from %s", functionFullName, jarPath),
          e);
    }
  }

View on GitHub (pinned to 12126d8942)

Solutions

  1. Verify the function name/path exactly matches a key in userDefinedScalarFunctions().
  2. Annotate the implementing class with @AutoService(UdfProvider.class) (or add the META-INF/services entry) and rebuild the jar.
  3. Rebuild and redeploy the jar after adding the function; confirm the new jar path is used.
  4. List the jar's registered functions to see the available names.

Example fix

// before
public class MyUdfs { public static Integer twice(Integer x) {...} }
// after
@AutoService(UdfProvider.class)
public class MyUdfs implements UdfProvider {
  @Override
  public Map<String, ScalarFn> userDefinedScalarFunctions() {
    return ImmutableMap.of("twice", ScalarFn.create(...));
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// confirm jar exists before loading UDF
if (!new File(jarPath).isFile()) {
  throw new IllegalArgumentException("UDF jar not found: " + jarPath);
}

Try / catch

try {
  ScalarFn fn = udfLoader.loadScalarFunction(fnPath, jarPath);
} catch (IllegalArgumentException e) {
  if (e.getMessage().contains("No implementation of scalar function")) {
    LOG.error("UDF {} not registered in {}; check UdfProvider registration", fnPath, jarPath);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling loadScalarFunction(List<String> functionPath, String jarPath) (via the SQL shell/catalog loader) where jarPath's UdfProvider exists but userDefinedScalarFunctions() lacks the requested function name.

Common situations: Typo in the function name or package path; the UDF exists in a class but is not returned from userDefinedScalarFunctions(); missing @AutoService(UdfProvider.class) annotation so no provider is registered; stale jar without the new function.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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