prestodb/presto · error · PrestoException
DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION
DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION
Error message
Unsupported pushdown for Druid connector with plan node of type ${node} What it means
DruidQueryGenerator's Visitor.visitPlan is the default fallback for any PlanNode type the Druid query generator does not implement. Hitting it means the plan subtree contains a node type the connector cannot translate into a Druid query, so pushdown is refused with DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION.
Source
Thrown at presto-druid/src/main/java/com/facebook/presto/druid/DruidQueryGenerator.java:186
.add("pushdown", pushdown)
.toString();
}
}
private class DruidQueryPlanVisitor
extends PlanVisitor<DruidQueryGeneratorContext, DruidQueryGeneratorContext>
{
private final ConnectorSession session;
protected DruidQueryPlanVisitor(ConnectorSession session)
{
this.session = session;
}
@Override
public DruidQueryGeneratorContext visitPlan(PlanNode node, DruidQueryGeneratorContext context)
{
throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unsupported pushdown for Druid connector with plan node of type " + node);
}
protected VariableReferenceExpression getVariableReference(RowExpression expression)
{
if (expression instanceof VariableReferenceExpression) {
return ((VariableReferenceExpression) expression);
}
throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unsupported pushdown for Druid connector. Expect variable reference, but get: " + expression);
}
@Override
public DruidQueryGeneratorContext visitMarkDistinct(MarkDistinctNode node, DruidQueryGeneratorContext context)
{
requireNonNull(context, "context is null");
return node.getSource().accept(this, context);
}
@OverrideView on GitHub (pinned to 55bb57d202)
Solutions
- Identify the unsupported node via EXPLAIN and restructure the query to avoid it above the Druid scan (e.g. avoid window functions/joins in the pushed-down portion).
- Force partial (non-whole-plan) pushdown or disable pushdown for the query so unsupported nodes execute in Presto.
- Split the query into a pushdown-friendly inner query over Druid plus outer processing in Presto.
- Upgrade or patch the connector to add a visit override for the node type.
Example fix
// before SELECT lag(cnt) OVER (ORDER BY day) FROM druid_agg; // after SELECT day, cnt FROM druid_agg; -- compute lag in Presto/client outside pushed-down scan
Defensive patterns
Strategy: fallback
Validate before calling
// Restrict plan shape before pushdown: only scan/project/filter/aggregation
boolean pushablePlan(PlanNode n) {
return n instanceof ScanFilterProjectNode || n instanceof ProjectNode
|| n instanceof FilterNode || n instanceof AggregationNode;
} Type guard
boolean isUnsupportedNode(PlanNode n) {
return n instanceof WindowNode || n instanceof TopNNode || n instanceof SortNode
|| n instanceof UnnestNode || n instanceof JoinNode;
} Try / catch
try { druidQuery = new DruidQueryGenerator(plan, session).generate(); }
catch (PrestoException e) {
if (e.getErrorCode().getName().equals("DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION")) { executePartialPushdown(plan); }
else throw e;
} Prevention
- Avoid window functions, unnest, sorts, and joins inside the pushed-down portion over Druid.
- Run EXPLAIN to spot unsupported node types above the Druid scan.
- Structure queries as simple scan/project/filter/aggregate over Druid.
- Recheck plan shapes after Presto upgrades (new optimizer rules).
When it happens
Trigger: node.getSource().accept(this, ...) reaches a PlanNode subclass without a visit override (e.g. WindowNode, TopNNode, UnnestNode, SortNode, JoinNode, etc.) during Druid query generation.
Common situations: Queries with window functions, DISTINCT-beyond-MarkDistinct shapes, unnest, sorts, or joins over a Druid table that the planner attempted to push down; plans changed by new optimizer rules in a Presto upgrade.
Related errors
- DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION
- DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION
- DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION
- DRUID_BROKER_RESULT_ERROR
- DRUID_BROKER_RESULT_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/6e3dcf7bf21f4122.
Report an issue: GitHub.