prestodb/presto · error · UnsupportedOperationException
Not yet implemented: " + getClass().getSimpleName() + " for
Error message
Not yet implemented: " + getClass().getSimpleName() + " for " + node.getClass().getName()
What it means
DefaultTreeRewriter extends AstVisitor and overrides only the expression node types it can rewrite; visitExpression is the fallback for any unhandled Expression. Hitting it means the rewriter encountered an expression type (e.g. SubscriptExpression, LambdaExpression, BindExpression, functional calls) it does not know how to rewrite, and it aborts with UnsupportedOperationException naming both the rewriter class and the node class.
Source
Thrown at presto-verifier/src/main/java/com/facebook/presto/verifier/rewrite/DefaultTreeRewriter.java:101
/**
* A default implementation of {@link AstVisitor} that reconstructs a node if any of its children is reconstructed.
* Expression node reconstruction is not supported and left to the users. At the moment it is only used for presto.verifier package.
* Generalize it with caution.
*/
public class DefaultTreeRewriter<C>
extends AstVisitor<Node, C>
{
@Override
protected Node visitNode(Node node, C context)
{
return node;
}
@Override
protected Node visitExpression(Expression node, C context)
{
throw new UnsupportedOperationException("Not yet implemented: " + getClass().getSimpleName() + " for " + node.getClass().getName());
}
@Override
protected Node visitAddColumn(AddColumn node, C context)
{
Node column = process(node.getColumn(), context);
Optional<ColumnPosition> position = processColumnPosition(node.getPosition(), context);
if (node.getColumn() == column && sameElement(node.getPosition(), position)) {
return node;
}
return new AddColumn(node.getName(), (ColumnDefinition) column, position, node.isTableExists(), node.isColumnNotExists());
}
@Override
protected Node visitAliasedRelation(AliasedRelation node, C context)
{
Node relation = process(node.getRelation(), context);View on GitHub (pinned to 55bb57d202)
Solutions
- Identify the node class named in the exception message and check which SQL construct it corresponds to.
- Add an override in DefaultTreeRewriter (or a subclass) for that node type that rewrites or passes through the node.
- As an interim workaround, exclude queries using that expression from the verifier suite.
- Prefer a generic pass-through (return node) for expression types that need no rewriting.
Example fix
// before
@Override
protected Node visitExpression(Expression node, C context) {
throw new UnsupportedOperationException("Not yet implemented: " + getClass().getSimpleName() + " for " + node.getClass().getName());
}
// after
@Override
protected Node visitSubscriptExpression(SubscriptExpression node, C context) {
return new SubscriptExpression(process(node.getBase(), context), process(node.getIndex(), context));
} Defensive patterns
Strategy: try-catch
Validate before calling
// Java: pre-scan query AST for expression types the rewriter lacks handlers for
Set<Class<? extends Expression>> unsupported = ImmutableSet.of(LambdaExpression.class, BindExpression.class, SubscriptExpression.class);
for (Expression e : ExpressionTreeBuilder.collectExpressions(parsedBody)) {
if (unsupported.contains(e.getClass())) {
throw new IllegalArgumentException("Query uses unsupported expression: " + e.getClass().getSimpleName());
}
} Try / catch
try {
rewritten = treeRewriter.rewrite(expression, blacklist);
} catch (UnsupportedOperationException e) {
if (e.getMessage().startsWith("Not yet implemented")) {
report.skip(query, "Rewriter cannot handle: " + e.getMessage());
return;
}
throw e;
} Prevention
- Avoid verifier suites using lambdas/higher-order or exotic expressions.
- Add a pass-through override for expression types needing no rewriting.
- Update DefaultTreeRewriter when new Presto expression types are introduced.
- Test the rewriter against all expressions used in your suites.
When it happens
Trigger: Calling rewrite(...) with a SELECT query containing an expression not covered by the overridden visitXxx methods (e.g. lambda/higher-order function expressions, SubscriptExpression, Format/JsonFunction expressions in verifier test queries).
Common situations: Running the verifier on suites using newer SQL syntax (lambdas, subscript/JSON functions) that predates the added expression types; verifying queries from other engines' dialects containing exotic expressions; adding new Presto expressions without updating DefaultTreeRewriter.
Related errors
- Unsupported query type: %s
- Substituting %s in %s is not supported.
- Argument of type %s from %s is not supported.
- ROW comparison not supported for fields with null elements
- GENERIC_INTERNAL_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/c60a120e9a128be0.
Report an issue: GitHub.