{"record":{"id":"4225e95ce66a80e1","repo":"apache/beam","slug":"s-is-not-supported-in-bit-xor","errorCode":null,"errorMessage":"[%s] is not supported in BIT_XOR","messagePattern":"\\[(.+?)\\] is not supported in BIT_XOR","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamBuiltinAggregations.java","lineNumber":252,"sourceCode":"      return new BitOr();\n    }\n    throw new UnsupportedOperationException(\n        String.format(\"[%s] is not supported in BIT_OR\", fieldType));\n  }\n\n  static CombineFn createBitAnd(Schema.FieldType fieldType) {\n    if (fieldType.getTypeName() == TypeName.INT64) {\n      return new BitAnd();\n    }\n    throw new UnsupportedOperationException(\n        String.format(\"[%s] is not supported in BIT_AND\", fieldType));\n  }\n\n  public static CombineFn createBitXOr(Schema.FieldType fieldType) {\n    if (fieldType.getTypeName() == TypeName.INT64) {\n      return new BitXOr();\n    }\n    throw new UnsupportedOperationException(\n        String.format(\"[%s] is not supported in BIT_XOR\", fieldType));\n  }\n\n  static class CustMax<T extends Comparable<T>> extends Combine.BinaryCombineFn<T> {\n    @Override\n    public T apply(T left, T right) {\n      return (right == null || right.compareTo(left) < 0) ? left : right;\n    }\n  }\n\n  static class CustMin<T extends Comparable<T>> extends Combine.BinaryCombineFn<T> {\n    @Override\n    public T apply(T left, T right) {\n      return (left == null || left.compareTo(right) < 0) ? left : right;\n    }\n  }\n\n  static class IntegerSum extends Combine.BinaryCombineFn<Integer> {","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamBuiltinAggregations.java#L234-L270","documentation":"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.","triggerScenarios":"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.","commonSituations":"BIT_XOR checksum-style queries over INT32 columns; porting BIT_XOR usage from engines with wider type support.","solutions":["Cast the column to BIGINT/INT64 in the query.","Adjust the schema so the column type is INT64.","Implement a custom XOR CombineFn for other integer widths."],"exampleFix":"// before\nCombineFn fn = BeamBuiltinAggregations.createBitXOr(Schema.FieldType.INT32); // throws\n\n// after\nCombineFn fn = BeamBuiltinAggregations.createBitXOr(Schema.FieldType.INT64);","handlingStrategy":"validation","validationCode":"if (fieldType.getTypeName() != Schema.TypeName.INT64) {\n  throw new IllegalArgumentException(\"BIT_XOR requires INT64, got \" + fieldType);\n}","typeGuard":"boolean bitXorSupported(Schema.FieldType t) {\n  return t.getTypeName() == Schema.TypeName.INT64;\n}","tryCatchPattern":"try {\n  CombineFn fn = BeamBuiltinAggregations.createBitXOr(fieldType);\n} catch (UnsupportedOperationException e) {\n  // re-plan with CAST(col AS BIGINT) or custom XOR combiner\n}","preventionTips":["Cast to BIGINT before BIT_XOR checksum-style queries.","Keep XOR-target columns INT64 in the source schema.","Write a test covering every aggregate function/type pair your pipeline uses."],"tags":["beam-sql","unsupported-type","bitwise","java"],"backgroundTag":"unsupported-enum-value","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"}