apache/beam · error · RuntimeException
Encountered an unexpected node type: ${node.getClass().getSi
Error message
Encountered an unexpected node type: ${node.getClass().getSimpleName()} What it means
MongoDbFilter.isSupported recognizes only RexCall nodes it can translate and bare RexInputRef nodes (boolean fields). Any other RexNode subclass reaching the else branch triggers this RuntimeException with the node's simple class name, signaling the filter-support checker encountered an unhandled node type.
Source
Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/mongodb/MongoDbTable.java:492
// Ex: `field1 == field2` is not supported.
// TODO: Can be supported via Filters#where.
if (fields == 1) {
return true;
}
} else if (node.getKind().equals(AND) || node.getKind().equals(OR)) {
// Nested ANDs and ORs are supported as long as all operands are supported.
for (RexNode operand : compositeNode.getOperands()) {
if (!isSupported(operand)) {
return false;
}
}
return true;
}
} else if (node instanceof RexInputRef) {
// When field is a boolean.
return true;
} else {
throw new RuntimeException(
"Encountered an unexpected node type: " + node.getClass().getSimpleName());
}
return false;
}
}
}
View on GitHub (pinned to 12126d8942)
Solutions
- Restrict pushed predicates to comparison RexCalls and boolean RexInputRefs.
- Pre-filter the CNF list, skipping nodes that are not RexCall or RexInputRef so they are computed post-scan.
- Extend isSupported in the provider if the node type should be pushable.
Example fix
// before filterCreate(cnf) // cnf contains a RexLiteral // after cnf.removeIf(n -> !(n instanceof RexCall || n instanceof RexInputRef)); filterCreate(cnf)
Defensive patterns
Strategy: type-guard
Validate before calling
if (!(node instanceof RexCall) && !(node instanceof RexInputRef)) {
throw new IllegalArgumentException("Unsupported node in CNF: " + node.getClass());
} Type guard
boolean isSupportedNode(RexNode n) { return n instanceof RexCall || n instanceof RexInputRef; } Try / catch
try { support = MongoDbFilter.isSupported(node); } catch (RuntimeException e) { support = false; } Prevention
- Pre-filter CNF lists to RexCall/RexInputRef
- Handle literals locally rather than pushing
- Add tests with optimizer-rewritten plans
When it happens
Trigger: Evaluating predicate support for a CNF list containing RexLiteral, RexFieldAccess, RexCorrelVariable, or other non-call/non-input-ref nodes — e.g. during create() when deciding which predicates are pushable to MongoDB.
Common situations: Optimizer-rewritten plans injecting literals or field accesses; programmatic predicate construction bypassing normal SQL parsing.
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
- Cannot create a filter for an unsupported node: ${node}
- Encountered an unexpected node kind: ${node.getKind()}
- Was expecting a RexCall or a boolean RexInputRef, but receiv
- Predicate node '${node.getClass().getSimpleName()}' should b
- MongoDb location must be in the following format: 'mongodb:/
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/9e7e1283e867b8a8.
Report an issue: GitHub.