prestodb/presto · error · PrestoException

DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION

DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION

Error message

${operator} is not supported in Druid filter

What it means

When converting a Presto filter expression for pushdown to Druid, a logical binary operator (AND/OR/NOT family) was encountered whose operator name is not in LOGICAL_BINARY_OPS_FILTER. DruidFilterExpressionConverter only pushes down operators it can translate to Druid filter syntax, so it throws DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION.

Source

Thrown at presto-druid/src/main/java/com/facebook/presto/druid/DruidFilterExpressionConverter.java:90

            SpecialFormExpression specialForm,
            boolean isWhitelist,
            Function<VariableReferenceExpression, Selection> context)
    {
        return derived(format("(%s %s (%s))",
                specialForm.getArguments().get(0).accept(this, context).getDefinition(),
                isWhitelist ? "IN" : "NOT IN",
                specialForm.getArguments().subList(1, specialForm.getArguments().size()).stream()
                        .map(argument -> argument.accept(this, context).getDefinition())
                        .collect(Collectors.joining(", "))));
    }

    private DruidExpression handleLogicalBinary(
            String operator,
            CallExpression call,
            Function<VariableReferenceExpression, Selection> context)
    {
        if (!LOGICAL_BINARY_OPS_FILTER.contains(operator)) {
            throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, operator + " is not supported in Druid filter");
        }
        List<RowExpression> arguments = call.getArguments();
        if (arguments.size() == 2) {
            return derived(format(
                    "(%s %s %s)",
                    arguments.get(0).accept(this, context).getDefinition(),
                    operator,
                    arguments.get(1).accept(this, context).getDefinition()));
        }
        throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unknown logical binary: " + call);
    }

    private DruidExpression handleBetween(
            CallExpression between,
            Function<VariableReferenceExpression, Selection> context)
    {
        if (between.getArguments().size() == 3) {
            RowExpression value = between.getArguments().get(0);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Rewrite the WHERE predicate using plain AND/OR comparisons that Druid supports
  2. Drop the unsupported operator from the query so the filter is not pushed down
  3. Check LOGICAL_BINARY_OPS_FILTER in DruidFilterExpressionConverter to see which operators are accepted
  4. Upgrade the Presto/Druid connector — supported operator sets have expanded across versions

Example fix

-- before
SELECT * FROM druid_table WHERE a IS DISTINCT FROM b;
-- after
SELECT * FROM druid_table WHERE a != b OR (a IS NULL AND b IS NULL);
Defensive patterns

Strategy: validation

Validate before calling

// Keep WHERE predicates limited to AND/OR over comparison operators
// Avoid: IS DISTINCT FROM and other non-standard logical operators in Druid queries

Try / catch

try {
    runQuery(sql);
} catch (PrestoException e) {
    if (e.getErrorCode().getCode() == DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION.toErrorCode().getCode()) {
        log.warn("Filter not pushable to Druid, rewriting: {}", e.getMessage());
        runQuery(rewritePredicate(sql));
    } else { throw e; }
}

Prevention

When it happens

Trigger: visitCall dispatches a CallExpression with an OperatorType flagged as a comparison/logical binary whose operator string (e.g. some non-standard logical op) is not contained in LOGICAL_BINARY_OPS_FILTER when handleLogicalBinary is invoked.

Common situations: Queries using operators the Druid connector cannot push down (e.g. IS DISTINCT FROM-style or exotic logical operators in WHERE clauses); the predicate then needs to be evaluated in Presto instead.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/379cd19ba0b95ae6. Report an issue: GitHub.