prestodb/presto · error · SemanticException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
External functions in %s is not supported: %s
What it means
Presto does not allow external (declared/remote) functions in certain predicates/clauses. verifyNoExternalFunctions extracts external function calls from the analyzed function handles for the given predicate expression and throws NOT_SUPPORTED listing them if any exist.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/Analyzer.java:169
List<FunctionCall> windowExpressions = extractWindowFunctions(ImmutableList.of(predicate));
List<GroupingOperation> groupingOperations = extractExpressions(ImmutableList.of(predicate), GroupingOperation.class);
List<Expression> found = Stream.concat(
aggregates.stream(),
Stream.concat(windowExpressions.stream(), groupingOperations.stream()))
.collect(toImmutableList());
if (!found.isEmpty()) {
throw new SemanticException(CANNOT_HAVE_AGGREGATIONS_WINDOWS_OR_GROUPING, predicate, "%s cannot contain aggregations, window functions or grouping operations: %s", clause, found);
}
}
static void verifyNoExternalFunctions(Map<NodeRef<FunctionCall>, FunctionHandle> functionHandles, FunctionAndTypeResolver functionAndTypeResolver, Expression predicate, String clause)
{
List<FunctionCall> externalFunctions = extractExternalFunctions(functionHandles, ImmutableList.of(predicate), functionAndTypeResolver);
if (!externalFunctions.isEmpty()) {
throw new SemanticException(NOT_SUPPORTED, predicate, "External functions in %s is not supported: %s", clause, externalFunctions);
}
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Replace the external function with a built-in Presto function in the predicate.
- Move the external-function predicate to an outer query so the restricted clause contains only supported functions.
- Precompute the external function result in a subquery/CTE or materialize it into a column.
- If supported, force the connector to expose a native function instead of an external one.
Example fix
// before SELECT * FROM t WHERE external_fn(x) > 0; // after SELECT * FROM (SELECT *, external_fn(x) AS f FROM t) WHERE f > 0;
Defensive patterns
Strategy: validation
Validate before calling
// scan predicate functions and reject external ones
extractFunctions(predicate).forEach(fn -> {
if (isExternalFunction(fn, functionAndTypeResolver)) {
throw new IllegalArgumentException("External function not allowed in " + clause + ": " + fn);
}
}); Try / catch
try { runQuery(sql); } catch (SemanticException e) { if (e.getCode() == NOT_SUPPORTED && e.getMessage().contains("External functions")) { /* replace or hoist external fn */ } throw e; } Prevention
- Keep external/connector functions out of pushdown predicates.
- Use built-in Presto functions where possible.
- Wrap external-function computations in subqueries/CTEs.
- Pin connector versions and test federated predicates before upgrade.
When it happens
Trigger: Using a connector-declared external/remote scalar function inside a predicate clause (e.g. WHERE/HAVING/measure filter) that the analyzer validates via this check.
Common situations: Queries mixing external functions from federated connectors into pushdownable predicates; version/connector changes introducing external functions into previously plain expressions.
Understand the failure class
Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/35c90447a06c52de.
Report an issue: GitHub.