apache/beam · error · UnsupportedOperationException

Encountered an unexpected node type

Error message

Encountered an unexpected node type: ${nodeClass}

What it means

IcebergFilter.isSupported walks a predicate RexNode tree and only understands RexCall, RexInputRef, and RexLiteral. Any other Calcite RexNode subclass encountered during filter analysis is explicitly rejected because the code has no logic to evaluate its supportedness.

Solutions

  1. Rewrite the query to avoid the unsupported construct (e.g. inline the subquery or correlated value before filtering)
  2. Check which node class appears in the message and confirm whether a newer Beam version adds support for it
  3. Flatten/simplify the predicate (CnfHelper) before pushdown so only calls, refs, and literals remain
  4. If legitimate, extend the isSupported switch in IcebergFilter to handle the new RexNode type

Example fix

// before
String sql = "SELECT * FROM t WHERE col = (SELECT MAX(c) FROM other)";
// after
String sql = "SELECT * FROM t WHERE col = 42"; // inline the scalar first
Defensive patterns

Strategy: validation

Validate before calling

java.util.Set.of(RexCall.class, RexInputRef.class, RexLiteral.class).contains(node.getClass())

Type guard

boolean isSupportedRexType(RexNode n) { return n instanceof RexCall || n instanceof RexInputRef || n instanceof RexLiteral; }

Try / catch

try { filter.isSupported(node); } catch (UnsupportedOperationException e) { log.warn("Unsupported predicate, falling back to non-pushed filter", e); }

Prevention

When it happens

Trigger: Pushing down a predicate containing a RexNode type outside the handled set (e.g. RexFieldAccess, RexSubQuery, RexCorrelVariable) into an Iceberg table via SQL pushdown or childSupported/maybeInitialize analysis.

Common situations: Subqueries or correlated references in WHERE clauses pushed to Iceberg, Calcite rewrites introducing unusual node types, custom planners producing node shapes IcebergFilter does not anticipate.

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/994297e79711f177. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/extensions/sql/iceberg/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/iceberg/IcebergFilter.java:138

      if (!SUPPORTED_OPS.contains(node.getKind())) {
        isSupported = false;
      } else {
        for (RexNode operand : compositeNode.getOperands()) {
          // All operands must be supported for a parent node to be supported.
          Pair<Boolean, Integer> childSupported = isSupported(operand);
          if (!node.getKind().belongsTo(ImmutableSet.of(AND, OR))) {
            numberOfInputRefs += childSupported.getRight();
          }
          // Predicate functions with multiple columns are unsupported.
          isSupported = numberOfInputRefs < 2 && childSupported.getLeft();
        }
      }
    } else if (node instanceof RexInputRef) {
      numberOfInputRefs = 1;
    } else if (node instanceof RexLiteral) {
      // RexLiterals are expected, but no action is needed.
    } else {
      throw new UnsupportedOperationException(
          "Encountered an unexpected node type: " + node.getClass().getSimpleName());
    }

    return Pair.of(isSupported, numberOfInputRefs);
  }
}

View on GitHub (pinned to 12126d8942)