prestodb/presto · error · SemanticException
TABLE_FUNCTION_IMPLEMENTATION_ERROR
TABLE_FUNCTION_IMPLEMENTATION_ERROR
Error message
Table function %s specifies required columns from table argument %s which cannot be found
What it means
Analysis error for a table function invocation: the function's declared required-columns descriptor names columns that do not exist in the corresponding table argument's schema. The connector's table function metadata is inconsistent with the passed table argument.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java:1865
connectorId,
function.getName(),
argumentsAnalysis.getPassedArguments(),
orderedTableArguments.build(),
functionAnalysis.getRequiredColumns(),
copartitioningLists,
properColumnsDescriptor == null ? 0 : properColumnsDescriptor.getFields().size(),
functionAnalysis.getHandle(),
transactionHandle));
return createAndAssignScope(node, scope, fields.build());
}
private void verifyRequiredColumns(TableFunctionInvocation node, Map<String, List<Integer>> requiredColumns, Map<String, TableArgumentAnalysis> tableArgumentsByName)
{
Set<String> allInputs = ImmutableSet.copyOf(tableArgumentsByName.keySet());
requiredColumns.forEach((name, columns) -> {
if (!allInputs.contains(name)) {
throw new SemanticException(TABLE_FUNCTION_IMPLEMENTATION_ERROR, "Table function %s specifies required columns from table argument %s which cannot be found", node.getName(), name);
}
if (columns.isEmpty()) {
throw new SemanticException(TABLE_FUNCTION_IMPLEMENTATION_ERROR, "Table function %s specifies empty list of required columns from table argument %s", node.getName(), name);
}
// the scope is recorded, because table arguments are already analyzed
Scope inputScope = analysis.getScope(tableArgumentsByName.get(name).getRelation());
columns.stream()
.filter(column -> column < 0 || column >= inputScope.getRelationType().getVisibleFieldCount())
.findFirst()
.ifPresent(column -> {
throw new SemanticException(TABLE_FUNCTION_IMPLEMENTATION_ERROR, "Invalid index: %s of required column from table argument %s", column, name);
});
});
Set<String> requiredInputs = ImmutableSet.copyOf(requiredColumns.keySet());
allInputs.stream()
.filter(input -> !requiredInputs.contains(input))
.findFirst()
.ifPresent(input -> {View on GitHub (pinned to 55bb57d202)
Solutions
- Fix the required-columns descriptor in the table function implementation to reference existing columns
- Verify the table argument actually exposes the expected column names
- Recreate/refresh the table function definition in the connector
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java:1865 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/b9fd6ca8c202ef62.
Report an issue: GitHub.