メインコンテンツまでスキップ
に最終更新

GROUP_BIT_AND

説明​

単一の整数型の列または式に含まれるすべての値に対して、ビット単位の AND 演算を行います。

構文​

GROUP_BIT_AND(<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_and(value) from group_bit;
+----------------------+
| group_bit_and(value) |
+----------------------+
| 0 |
+----------------------+
select group_bit_and(value) from group_bit where value is null;
+----------------------+
| group_bit_and(value) |
+----------------------+
| NULL |
+----------------------+