apache/beam · error · RuntimeException

Cannot create a filter for an unsupported 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.

Solutions

  1. 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.
  2. Simplify the filter into supported comparisons over columns against literals.
  3. 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

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


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/f6070394d11f96a1. Report an issue: GitHub.

Appendix: 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)