apache/beam · error · UnsupportedOperationException

[ ] is not supported in BIT_XOR

Error message

[%s] is not supported in BIT_XOR

What it means

createBitXOr implements the BIT_XOR aggregate, defined only for INT64 fields (returning the BitXOr CombineFn). Any other field type throws UnsupportedOperationException. Identical guard structure to BIT_OR/BIT_AND.

Solutions

  1. Cast the column to BIGINT/INT64 in the query.
  2. Adjust the schema so the column type is INT64.
  3. Implement a custom XOR CombineFn for other integer widths.

Example fix

// before
CombineFn fn = BeamBuiltinAggregations.createBitXOr(Schema.FieldType.INT32); // throws

// after
CombineFn fn = BeamBuiltinAggregations.createBitXOr(Schema.FieldType.INT64);
Defensive patterns

Strategy: validation

Validate before calling

if (fieldType.getTypeName() != Schema.TypeName.INT64) {
  throw new IllegalArgumentException("BIT_XOR requires INT64, got " + fieldType);
}

Type guard

boolean bitXorSupported(Schema.FieldType t) {
  return t.getTypeName() == Schema.TypeName.INT64;
}

Try / catch

try {
  CombineFn fn = BeamBuiltinAggregations.createBitXOr(fieldType);
} catch (UnsupportedOperationException e) {
  // re-plan with CAST(col AS BIGINT) or custom XOR combiner
}

Prevention

When it happens

Trigger: Calling BeamBuiltinAggregations.createBitXOr(fieldType) with a TypeName other than INT64 — e.g. an INTEGER (INT32) column, DECIMAL, or string column passed to BIT_XOR in a query or programmatic aggregation.

Common situations: BIT_XOR checksum-style queries over INT32 columns; porting BIT_XOR usage from engines with wider type support.

Related errors


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

Appendix: source

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

      return new BitOr();
    }
    throw new UnsupportedOperationException(
        String.format("[%s] is not supported in BIT_OR", fieldType));
  }

  static CombineFn createBitAnd(Schema.FieldType fieldType) {
    if (fieldType.getTypeName() == TypeName.INT64) {
      return new BitAnd();
    }
    throw new UnsupportedOperationException(
        String.format("[%s] is not supported in BIT_AND", fieldType));
  }

  public static CombineFn createBitXOr(Schema.FieldType fieldType) {
    if (fieldType.getTypeName() == TypeName.INT64) {
      return new BitXOr();
    }
    throw new UnsupportedOperationException(
        String.format("[%s] is not supported in BIT_XOR", fieldType));
  }

  static class CustMax<T extends Comparable<T>> extends Combine.BinaryCombineFn<T> {
    @Override
    public T apply(T left, T right) {
      return (right == null || right.compareTo(left) < 0) ? left : right;
    }
  }

  static class CustMin<T extends Comparable<T>> extends Combine.BinaryCombineFn<T> {
    @Override
    public T apply(T left, T right) {
      return (left == null || left.compareTo(right) < 0) ? left : right;
    }
  }

  static class IntegerSum extends Combine.BinaryCombineFn<Integer> {

View on GitHub (pinned to 12126d8942)