2021-02-02 12:00:41 +00:00
|
|
|
|
---
|
|
|
|
|
toc_priority: 127
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# groupBitXor {#groupbitxor}
|
|
|
|
|
|
2021-02-05 15:50:14 +00:00
|
|
|
|
对于数字序列按位应用 `XOR` 。
|
|
|
|
|
|
|
|
|
|
**语法**
|
2021-02-02 12:00:41 +00:00
|
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
|
groupBitXor(expr)
|
|
|
|
|
```
|
|
|
|
|
|
2021-02-05 15:50:14 +00:00
|
|
|
|
**参数**
|
2021-02-02 12:00:41 +00:00
|
|
|
|
|
2021-02-05 15:50:14 +00:00
|
|
|
|
`expr` – 结果为 `UInt*` 类型的表达式。
|
2021-02-02 12:00:41 +00:00
|
|
|
|
|
2021-02-05 15:50:14 +00:00
|
|
|
|
**返回值**
|
2021-02-02 12:00:41 +00:00
|
|
|
|
|
2021-02-05 15:50:14 +00:00
|
|
|
|
`UInt*` 类型的值。
|
2021-02-02 12:00:41 +00:00
|
|
|
|
|
2021-02-05 15:50:14 +00:00
|
|
|
|
**示例**
|
2021-02-02 12:00:41 +00:00
|
|
|
|
|
2021-02-05 15:50:14 +00:00
|
|
|
|
测试数据:
|
2021-02-02 12:00:41 +00:00
|
|
|
|
|
|
|
|
|
``` text
|
|
|
|
|
binary decimal
|
|
|
|
|
00101100 = 44
|
|
|
|
|
00011100 = 28
|
|
|
|
|
00001101 = 13
|
|
|
|
|
01010101 = 85
|
|
|
|
|
```
|
|
|
|
|
|
2021-02-05 15:50:14 +00:00
|
|
|
|
查询:
|
2021-02-02 12:00:41 +00:00
|
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
|
SELECT groupBitXor(num) FROM t
|
|
|
|
|
```
|
|
|
|
|
|
2021-02-05 15:50:14 +00:00
|
|
|
|
`num` 是包含测试数据的列。
|
2021-02-02 12:00:41 +00:00
|
|
|
|
|
2021-02-05 15:50:14 +00:00
|
|
|
|
结果:
|
2021-02-02 12:00:41 +00:00
|
|
|
|
|
|
|
|
|
``` text
|
|
|
|
|
binary decimal
|
|
|
|
|
01101000 = 104
|
|
|
|
|
```
|