跳到主要内容

GROUP_BIT_XOR

描述

对单个整数列或表达式中的所有值执行按位 xor 运算。

语法

GROUP_BIT_XOR(<expr>)

参数

参数说明
<expr>支持类型为 TinyInt,SmallInt,Integer,BigInt,LargeInt。

返回值

返回一个整数值,类型与 相同。如果所有值均为 NULL,则返回 NULL。NULL 值不参与按位运算。

举例

-- setup
create table group_bit(
value int
) distributed by hash(value) buckets 1
properties ("replication_num"="1");

insert into group_bit values
(3),
(1),
(2),
(4),
(NULL);
select group_bit_xor(value) from group_bit;
+----------------------+
| group_bit_xor(value) |
+----------------------+
| 4 |
+----------------------+
select group_bit_xor(value) from group_bit where value is null;
+----------------------+
| group_bit_xor(value) |
+----------------------+
| NULL |
+----------------------+