{"record":{"id":"994297e79711f177","repo":"apache/beam","slug":"encountered-an-unexpected-node-type-nodeclass","errorCode":null,"errorMessage":"Encountered an unexpected node type: ${nodeClass}","messagePattern":"Encountered an unexpected node type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/iceberg/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/iceberg/IcebergFilter.java","lineNumber":138,"sourceCode":"      if (!SUPPORTED_OPS.contains(node.getKind())) {\n        isSupported = false;\n      } else {\n        for (RexNode operand : compositeNode.getOperands()) {\n          // All operands must be supported for a parent node to be supported.\n          Pair<Boolean, Integer> childSupported = isSupported(operand);\n          if (!node.getKind().belongsTo(ImmutableSet.of(AND, OR))) {\n            numberOfInputRefs += childSupported.getRight();\n          }\n          // Predicate functions with multiple columns are unsupported.\n          isSupported = numberOfInputRefs < 2 && childSupported.getLeft();\n        }\n      }\n    } else if (node instanceof RexInputRef) {\n      numberOfInputRefs = 1;\n    } else if (node instanceof RexLiteral) {\n      // RexLiterals are expected, but no action is needed.\n    } else {\n      throw new UnsupportedOperationException(\n          \"Encountered an unexpected node type: \" + node.getClass().getSimpleName());\n    }\n\n    return Pair.of(isSupported, numberOfInputRefs);\n  }\n}\n","sourceCodeStart":120,"sourceCodeEnd":145,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/iceberg/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/iceberg/IcebergFilter.java#L120-L145","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rewrite the query to avoid the unsupported construct (e.g. inline the subquery or correlated value before filtering)","Check which node class appears in the message and confirm whether a newer Beam version adds support for it","Flatten/simplify the predicate (CnfHelper) before pushdown so only calls, refs, and literals remain","If legitimate, extend the isSupported switch in IcebergFilter to handle the new RexNode type"],"exampleFix":"// before\nString sql = \"SELECT * FROM t WHERE col = (SELECT MAX(c) FROM other)\";\n// after\nString sql = \"SELECT * FROM t WHERE col = 42\"; // inline the scalar first","handlingStrategy":"validation","validationCode":"java.util.Set.of(RexCall.class, RexInputRef.class, RexLiteral.class).contains(node.getClass())","typeGuard":"boolean isSupportedRexType(RexNode n) { return n instanceof RexCall || n instanceof RexInputRef || n instanceof RexLiteral; }","tryCatchPattern":"try { filter.isSupported(node); } catch (UnsupportedOperationException e) { log.warn(\"Unsupported predicate, falling back to non-pushed filter\", e); }","preventionTips":["Avoid subqueries/correlations in pushed predicates","Simplify predicates before pushdown","Test custom RexNode trees against isSupported"],"tags":["sql","iceberg","predicate-pushdown","calcite"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}