tencent cloud

DocumentaçãoData Lake Compute

Bitwise Functions

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2024-08-07 17:31:33

BIT_COUNT

Function statement:
BIT_COUNT(<expr> bigint|boolean)
Supported engines: SparkSQL and Presto
Usage instructions: Set expr to an unsigned 64-bit integer and return the number of bits that are 1. If the parameter is NULL, NULL is returned.
Return type: integer
Example:
> SELECT bit_count(5);
2

BIT_GET

Function statement:
BIT_GET(<expr> bigint|boolean, <pos> integer)
Supported engines: SparkSQL and Presto
Usage instructions: Return the value of the bit at the specified position (0 or 1). Positions are numbered from right to left, starting at zero. The position parameter cannot be negative.
Return type: integer
Example:
> SELECT bit_get(11, 0);
1
> SELECT bit_get(11, 2);
0

GETBIT

Function statement:
GETBIT(<expr> bigint|boolean, <pos> integer)
Supported engines: SparkSQL and Presto
Usage instructions: Return the value of the bit at the specified position (0 or 1). Positions are numbered from right to left, starting at zero. The position parameter cannot be negative.
Return type: integer
Example:
> SELECT getbit(11, 0);
1
> SELECT getbit(11, 2);
0



Ajuda e Suporte

Esta página foi útil?

comentários