apache/beam · error · RuntimeException
Cannot create a filter for an unsupported node: ${node}
Error message
Cannot create a filter for an unsupported node: ${node} What it means
In MongoDbTable.translateRexNodeToBson, when a RexCall's operands are translated and the operation is neither a recognized comparison nor a NOT of a boolean input ref, the code throws a RuntimeException naming the unsupported node. This indicates a Calcite predicate shape the BSON translator has no mapping for.
Source
Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/mongodb/MongoDbTable.java:257
case NOT_EQUALS:
return Filters.not(Filters.eq(inputFieldName, literal));
case LESS_THAN:
return Filters.lt(inputFieldName, literal);
case GREATER_THAN:
return Filters.gt(inputFieldName, literal);
case GREATER_THAN_OR_EQUAL:
return Filters.gte(inputFieldName, literal);
case LESS_THAN_OR_EQUAL:
return Filters.lte(inputFieldName, literal);
default:
// Encountered an unexpected node kind, RuntimeException below.
break;
}
} else if (node.getKind().equals(SqlKind.NOT)) {
// Ex: `where not boolean_field`
return Filters.not(translateRexNodeToBson(inputRef));
} else {
throw new RuntimeException(
"Cannot create a filter for an unsupported node: " + node.toString());
}
} else { // Operation is a conjunction/disjunction.
switch (node.getKind()) {
case AND:
// Recursively construct filter for each operand of conjunction.
return Filters.and(
compositeNode.getOperands().stream()
.map(this::translateRexNodeToBson)
.collect(Collectors.toList()));
case OR:
// Recursively construct filter for each operand of disjunction.
return Filters.or(
compositeNode.getOperands().stream()
.map(this::translateRexNodeToBson)
.collect(Collectors.toList()));
default:
// Encountered an unexpected node kind, RuntimeException below.View on GitHub (pinned to 12126d8942)
Solutions
- Rewrite the query so the unsupported predicate is computed after the scan (Beam computes it client-side) — keep only supported (=, <>, <, >, <=, >=, AND, OR, NOT) filters pushable to MongoDB.
- Simplify the filter into supported comparisons over columns against literals.
- If this is a valid common case, file/patch the provider to translate the additional SqlKind in translateRexNodeToBson.
Example fix
// before SELECT * FROM t WHERE name LIKE 'a%' // after SELECT * FROM t WHERE name >= 'a' AND name < 'b'
Defensive patterns
Strategy: validation
Validate before calling
Set<SqlKind> supported = EnumSet.of(SqlKind.EQUALS, SqlKind.NOT_EQUALS, SqlKind.LESS_THAN, SqlKind.LESS_THAN_OR_EQUAL, SqlKind.GREATER_THAN, SqlKind.GREATER_THAN_OR_EQUAL, SqlKind.AND, SqlKind.OR, SqlKind.NOT); boolean pushable = node.getKind() != null && supported.contains(node.getKind());
Try / catch
try { filter = MongoDbFilter.create(cnf); } catch (RuntimeException e) { filter = null; /* evaluate client-side */ } Prevention
- Restrict WHERE clauses to simple comparisons and AND/OR
- Avoid LIKE and arithmetic in filters on MongoDb tables
- Test push-down of all filters used in production queries
When it happens
Trigger: Pushing down a WHERE predicate using an operator the translator does not implement (e.g. LIKE, complex expressions such as 'a = b' with two non-literal operands, or other SqlKinds not handled in the switch) when the MongoDb provider attempts predicate push-down.
Common situations: Queries with string pattern matching (LIKE), arithmetic in filters, or non-boolean operands inside OR/AND clauses against a MongoDb external table.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Encountered an unexpected node kind: ${node.getKind()}
- Was expecting a RexCall or a boolean RexInputRef, but receiv
- Predicate node '${node.getClass().getSimpleName()}' should b
- Encountered an unexpected node type: ${node.getClass().getSi
- MongoDb location must be in the following format: 'mongodb:/
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/f6070394d11f96a1.
Report an issue: GitHub.