Fonction bitmap_bit_position
S’applique à : Databricks SQL
Databricks Runtime 13.3 LTS et versions ultérieures
Renvoie la position du bit de base 0 d'un nombre BIGINT
donné dans un compartiment.
En combinaison avec la fonction bitmap_bucket_number(), il identifie de manière unique n'importe quel numéro BIGINT
.
Syntaxe
bitmap_bit_position(expr)
Arguments
expr
: expressionBIGINT
.
Retours
Un BIGINT
compris entre 0 et 32767.
Si expr
est >0
le résultat correspond : (expr - 1) % 32768
.
Si expr
est <= 0
le résultat correspond : abs(expr) % 32768
.
Exemples
> SELECT bitmap_bucket_number(1), bitmap_bit_position(1);
1 0
> SELECT bitmap_bucket_number(32768), bitmap_bit_position(32768);
1 32767
> SELECT bitmap_bucket_number(32769), bitmap_bit_position(32769);
2 0
> SELECT bitmap_bucket_number(0), bitmap_bit_position(0);
0 0
> SELECT bitmap_bucket_number(-32767), bitmap_bit_position(-32767);
0 32767
> SELECT bitmap_bucket_number(-32768), bitmap_bit_position(-32768);
-1 0