apache/beam · error · UnsupportedOperationException

Operator %s is not supported in join condition

Error message

Operator %s is not supported in join condition

What it means

BeamJoinTransforms.JoinAsLookup.joinFieldsMapping only handles equality ('=') predicates when extracting the join condition between the fact table and the lookup side. Any other operator in the join condition throws UnsupportedOperationException naming the offending operator.

Source

Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamJoinTransforms.java:140

      factJoinIdx = new ArrayList<>();
      List<Schema.Field> lkpJoinFields = new ArrayList<>();

      RexCall call = (RexCall) joinCondition;
      if ("AND".equals(call.getOperator().getName())) {
        List<RexNode> operands = call.getOperands();
        for (RexNode rexNode : operands) {
          factJoinIdx.add(
              ((RexInputRef) ((RexCall) rexNode).getOperands().get(0)).getIndex() - factColOffset);
          int lkpJoinIdx =
              ((RexInputRef) ((RexCall) rexNode).getOperands().get(1)).getIndex() - lkpColOffset;
          lkpJoinFields.add(lkpSchema.getField(lkpJoinIdx));
        }
      } else if ("=".equals(call.getOperator().getName())) {
        factJoinIdx.add(((RexInputRef) call.getOperands().get(0)).getIndex() - factColOffset);
        int lkpJoinIdx = ((RexInputRef) call.getOperands().get(1)).getIndex() - lkpColOffset;
        lkpJoinFields.add(lkpSchema.getField(lkpJoinIdx));
      } else {
        throw new UnsupportedOperationException(
            "Operator " + call.getOperator().getName() + " is not supported in join condition");
      }

      joinSubsetType = Schema.builder().addFields(lkpJoinFields).build();
    }

    @Override
    public PCollection<Row> expand(PCollection<Row> input) {
      return input
          .apply(
              "join_as_lookup",
              ParDo.of(
                  new DoFn<Row, Row>() {
                    @Setup
                    public void setup() {
                      seekableTable.setUp(joinSubsetType);
                    }

View on GitHub (pinned to 12126d8942)

Solutions

  1. Rewrite the join condition as an equality predicate (equi-join)
  2. Pre-filter or pre-compute the relationship outside the JOIN (e.g. filter after joining on equality keys)
  3. Re-implement the join manually with CoGroupByKey or side inputs supporting the predicate
  4. Use a join strategy in Beam SQL that supports non-equi predicates if available in your version

Example fix

// before
String sql = "SELECT * FROM orders o JOIN dim d ON o.country <> d.code";
// after
String sql = "SELECT * FROM orders o JOIN dim d ON o.country = d.code WHERE o.country <> d.code";
Defensive patterns

Strategy: validation

Validate before calling

// Inspect join condition operators before submitting the SQL
if (!joinConditionOps.stream().allMatch(op -> op.equals("="))) {
  throw new IllegalArgumentException("Lookup join supports only '=' conditions, found: " + joinConditionOps);
}

Try / catch

try {
  result = beamSqlCtx.run(sql);
} catch (UnsupportedOperationException e) {
  if (e.getMessage() != null && e.getMessage().contains("not supported in join condition")) {
    throw new IllegalArgumentException("Rewrite join as equi-join", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: Declaring a JOIN whose ON clause uses !=, <, >, <=, >=, LIKE, or a compound non-equality condition on a join that Beam SQL resolves through the lookup-join transform.

Common situations: Writing theta joins or range joins (e.g. ON a.id != b.id or ON a.ts < b.ts) against a side input/lookup table; expecting general join predicates where only equi-joins are supported.

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/367b6e8e52fb3cb6. Report an issue: GitHub.