{"record":{"id":"e9187e88082af7a1","repo":"apache/beam","slug":"s-is-not-supported-in-bit-or","errorCode":null,"errorMessage":"[%s] is not supported in BIT_OR","messagePattern":"\\[(.+?)\\] is not supported in BIT_OR","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":236,"sourceCode":"      case INT64:\n        return new LongAvg();\n      case FLOAT:\n        return new FloatAvg();\n      case DOUBLE:\n        return new DoubleAvg();\n      case DECIMAL:\n        return new BigDecimalAvg();\n      default:\n        throw new UnsupportedOperationException(\n            String.format(\"[%s] is not supported in AVG\", fieldType));\n    }\n  }\n\n  static CombineFn createBitOr(Schema.FieldType fieldType) {\n    if (fieldType.getTypeName() == TypeName.INT64) {\n      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  }","sourceCodeStart":218,"sourceCodeEnd":254,"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#L218-L254","documentation":"createBitOr implements the BIT_OR aggregate, which is only defined for INT64 fields: if fieldType's TypeName is INT64 it returns the BitOr CombineFn, otherwise it unconditionally throws UnsupportedOperationException. There is no switch/default — any non-INT64 type fails immediately.","triggerScenarios":"Calling BeamBuiltinAggregations.createBitOr(fieldType) with any TypeName other than INT64 — e.g. SELECT BIT_OR(int32_col) where the column is INTEGER (INT32) rather than INT64, or a string/boolean column.","commonSituations":"BIT_OR over an INT32 column is the classic hit: users assume all integer widths work, but only INT64 does; also BIT_OR over string-stored flags.","solutions":["Cast the column to BIGINT/INT64 in the SQL query: SELECT BIT_OR(CAST(flags AS BIGINT)) ...","Change the schema so the column is declared INT64.","Write a custom CombineFn performing bitwise OR for the narrower integer width and register it."],"exampleFix":"// before\nCombineFn fn = BeamBuiltinAggregations.createBitOr(Schema.FieldType.INT32); // throws\n\n// after\nCombineFn fn = BeamBuiltinAggregations.createBitOr(Schema.FieldType.INT64);\n// SQL: SELECT BIT_OR(CAST(flags AS BIGINT)) FROM t","handlingStrategy":"validation","validationCode":"if (fieldType.getTypeName() != Schema.TypeName.INT64) {\n  throw new IllegalArgumentException(\"BIT_OR requires INT64, got \" + fieldType);\n}","typeGuard":"boolean bitOpSupported(Schema.FieldType t) {\n  return t.getTypeName() == Schema.TypeName.INT64;\n}","tryCatchPattern":"try {\n  CombineFn fn = BeamBuiltinAggregations.createBitOr(fieldType);\n} catch (UnsupportedOperationException e) {\n  // re-plan with CAST(col AS BIGINT) or custom int-width combiner\n}","preventionTips":["Declare bitmask columns as INT64/BIGINT in Beam schemas.","Always CAST narrower integers to BIGINT before BIT_OR/BIT_AND/BIT_XOR.","Remember only INT64 is accepted — even INT32 fails."],"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"}