{"record":{"id":"c106d40419ab11cc","repo":"apache/beam","slug":"does-not-support-s","errorCode":null,"errorMessage":"Does not support %s","messagePattern":"Does not support (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/utils/SerializableRexFieldAccess.java","lineNumber":41,"sourceCode":"import org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.rex.RexFieldAccess;\nimport org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.rex.RexInputRef;\n\n/** SerializableRexFieldAccess. */\npublic class SerializableRexFieldAccess extends SerializableRexNode {\n  private List<Integer> indexes = new ArrayList<>();\n\n  public SerializableRexFieldAccess(RexFieldAccess rexFieldAccess) {\n    indexes.add(rexFieldAccess.getField().getIndex());\n    RexFieldAccess curr = rexFieldAccess;\n    while (curr.getReferenceExpr() instanceof RexFieldAccess) {\n      curr = (RexFieldAccess) curr.getReferenceExpr();\n      indexes.add(rexFieldAccess.getField().getIndex());\n    }\n\n    // curr.getReferenceExpr() is not a RexFieldAccess. Check if it is RexInputRef, which is only\n    // allowed RexNode type in RexFieldAccess.\n    if (!(curr.getReferenceExpr() instanceof RexInputRef)) {\n      throw new UnsupportedOperationException(\n          \"Does not support \" + curr.getReferenceExpr().getType());\n    }\n\n    // curr.getReferenceExpr() is a RexInputRef.\n    RexInputRef inputRef = (RexInputRef) curr.getReferenceExpr();\n    indexes.add(inputRef.getIndex());\n\n    Collections.reverse(indexes);\n  }\n\n  public List<Integer> getIndexes() {\n    return indexes;\n  }\n}\n","sourceCodeStart":23,"sourceCodeEnd":56,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/utils/SerializableRexFieldAccess.java#L23-L56","documentation":"SerializableRexFieldAccess serializes a Calcite RexFieldAccess chain for use in DoFns. While walking the chain, the reference expression of the final/current node must be a RexInputRef; any other RexNode type (e.g. RexCall) triggers UnsupportedOperationException with the type's toString. Only simple field accesses over an input row are supported.","triggerScenarios":"Constructing new SerializableRexFieldAccess(rexFieldAccess, rowTypeInfo) where some node in the access chain's getReferenceExpr() is not a RexInputRef — e.g. the accessed field is the result of a Calcite expression (RexCall like CAST or arithmetic) rather than a plain input column.","commonSituations":"Beam SQL plans where a correlating/subquery expression accesses computed columns (casted or computed field accesses) instead of raw input refs; using field accesses from optimized/rewritten plans.","solutions":["Ensure the RexFieldAccess refers to a plain input column; pre-compute/cast expressions in an upstream Project so the access target is a RexInputRef.","Insert an additional projection (e.g. via Project/RexProgram) to materialize computed values into input refs before creating SerializableRexFieldAccess.","Check the plan and avoid applying SerializableRexFieldAccess to nodes with RexCall references.","Extend the class to handle the specific RexNode type if you control the pipeline."],"exampleFix":"// before\nSerializableRexFieldAccess access = new SerializableRexFieldAccess(rexCallAccess, rowTypeInfo); // reference is RexCall\n// after\n// materialize the expression in a preceding Project so the access is over a RexInputRef\nRexNode projected = rexBuilder.makeInputRef(computedType, computedIndex);\nSerializableRexFieldAccess access = new SerializableRexFieldAccess(rexBuilder.makeFieldAccess(projected, 0), rowTypeInfo);","handlingStrategy":"try-catch","validationCode":"if (!(rexFieldAccess.getReferenceExpr() instanceof RexInputRef)) {\n  throw new IllegalArgumentException(\"SerializableRexFieldAccess only supports RexInputRef references\");\n}","typeGuard":"boolean isSerializableFieldAccess(RexFieldAccess fa) {\n  return fa.getReferenceExpr() instanceof RexInputRef;\n}","tryCatchPattern":"try { access = new SerializableRexFieldAccess(rexFieldAccess, rowTypeInfo); }\ncatch (UnsupportedOperationException e) { /* materialize expression in a preceding Project, then retry */ }","preventionTips":["Ensure accessed columns are plain input refs by adding an upstream Project","Inspect the Rex plan before constructing field accesses","Avoid passing computed/casted RexCalls as access targets","Add unit tests over representative plans containing computed columns"],"tags":["beam-sql","calcite","rex-node","unsupported-operation"],"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"}