Performs a bitwise XOR operation across all values in a group. Returns a value where each bit is 1 if the number of input values with that bit set to 1 is odd.
INT64Diperbarui: 13 Jun 2026BIT_XOR(expression)The integer column or expression to XOR together
1 SELECT 2 BIT_XOR(value) as xor_result 3 FROM UNNEST([5, 3, 6]) as value; 4 -- 5 = 101 5 -- 3 = 011 6 -- 6 = 110 7 -- XOR = 000 = 0
XOR of 5, 3, and 6 produces 0.
1 SELECT 2 batch_id, 3 BIT_XOR(record_id) as checksum 4 FROM `project.dataset.batch_records` 5 GROUP BY batch_id;
Computes a simple checksum per batch for data integrity verification.
| batch_id | checksum |
|---|---|
| B001 | 12345 |
| B002 | 67890 |
1 SELECT 2 partition_key, 3 BIT_XOR(data_hash) as parity 4 FROM `project.dataset.distributed_data` 5 GROUP BY partition_key;
Computes parity for distributed data verification.
| partition_key | parity |
|---|---|
| P1 | 255 |
| P2 | 128 |
Sudah paham BIT_XOR? Latih langsung di browser
Latihan interaktif, langsung di browser.