apache/iceberg · error · NoSuchFunctionException
Function does not exist:
Error message
Function does not exist:
What it means
SupportsFunctions.loadFunction resolves a function name against the Iceberg-side registry (SparkFunctions); when no registered UnboundFunction matches the given identifier, it throws NoSuchFunctionException. This happens when Spark hands Iceberg an identifier it cannot resolve to a known Iceberg-implemented function.
Solutions
- Check the function name spelling against SparkFunctions registered names
- Upgrade the Iceberg Spark runtime jar to a version that registers the function
- Verify the function is an Iceberg-supported function rather than a Spark built-in
- Register a custom function implementation if the function is user-defined
Example fix
// before SELECT iceberg_years(ts) FROM t; // NoSuchFunctionException // after SELECT years(ts) FROM t; // use the registered name, or upgrade Iceberg
Defensive patterns
Strategy: try-catch
Validate before calling
boolean known = SparkFunctions.load(name) != null; // or check registered function list before invoking
Type guard
boolean isSupportedFunction(String name) { return SparkFunctions.load(name) != null; } Try / catch
try { ... } catch (NoSuchFunctionException e) { LOG.error("Unknown function {}", name, e); throw e; } Prevention
- Keep Iceberg Spark runtime and extension jars on the same version
- Consult SparkFunctions registry before using Iceberg-specific functions
- Use qualified catalog.function namespaces to route resolution
When it happens
Trigger: Calling a function in SQL that Spark delegates to Iceberg (e.g. via a catalog that extends SupportsFunctions) where the name is misspelled, not registered in SparkFunctions, or only exists in a newer Iceberg version than the one on the classpath.
Common situations: Version skew between Spark extension jar and function availability (function added in a later Iceberg release); typos in function names; calling an Iceberg-specific function without the Spark functions registry loaded.
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
- Cannot load function
- Already closed files for partition:
- ALTER TABLE contains multiple distribution clauses
- ALTER TABLE contains multiple distribution clauses
- ALTER TABLE contains multiple distribution clauses
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/dd464dbab93da083.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SupportsFunctions.java:63
return new Identifier[0];
}
throw new NoSuchNamespaceException(namespace);
}
@Override
default UnboundFunction loadFunction(Identifier ident) throws NoSuchFunctionException {
String[] namespace = ident.namespace();
String name = ident.name();
if (isFunctionNamespace(namespace)) {
UnboundFunction func = SparkFunctions.load(name);
if (func != null) {
return func;
}
}
throw new NoSuchFunctionException(ident);
}
}
View on GitHub (pinned to 86d9c8fc54)