{"record":{"id":"dd464dbab93da083","repo":"apache/iceberg","slug":"function-does-not-exist","errorCode":null,"errorMessage":"Function does not exist: ","messagePattern":"Function does not exist: ","errorType":"exception","errorClass":"NoSuchFunctionException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SupportsFunctions.java","lineNumber":63,"sourceCode":"      return new Identifier[0];\n    }\n\n    throw new NoSuchNamespaceException(namespace);\n  }\n\n  @Override\n  default UnboundFunction loadFunction(Identifier ident) throws NoSuchFunctionException {\n    String[] namespace = ident.namespace();\n    String name = ident.name();\n\n    if (isFunctionNamespace(namespace)) {\n      UnboundFunction func = SparkFunctions.load(name);\n      if (func != null) {\n        return func;\n      }\n    }\n\n    throw new NoSuchFunctionException(ident);\n  }\n}\n","sourceCodeStart":45,"sourceCodeEnd":66,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SupportsFunctions.java#L45-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nSELECT iceberg_years(ts) FROM t; // NoSuchFunctionException\n// after\nSELECT years(ts) FROM t; // use the registered name, or upgrade Iceberg","handlingStrategy":"try-catch","validationCode":"boolean known = SparkFunctions.load(name) != null; // or check registered function list before invoking","typeGuard":"boolean isSupportedFunction(String name) { return SparkFunctions.load(name) != null; }","tryCatchPattern":"try { ... } catch (NoSuchFunctionException e) { LOG.error(\"Unknown function {}\", name, e); throw e; }","preventionTips":["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"],"tags":["spark","function-resolution"],"backgroundTag":"resource-not-found","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}