snowflake.snowpark.functions.bitmap_bit_position

snowflake.snowpark.functions.bitmap_bit_position(numeric_expr: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.30.0/snowpark-python/src/snowflake/snowpark/functions.py#L10958-L10970)

Returns the position of the first set bit (i.e., the first ‘1’ bit) in the binary representation of the input number.

Example:

>>> df = session.create_dataframe([1, 2, 3, 32768, 32769], schema=["a"])
>>> df.select(bitmap_bit_position("a").alias("bit_position")).collect()
[Row(BIT_POSITION=0), Row(BIT_POSITION=1), Row(BIT_POSITION=2), Row(BIT_POSITION=32767), Row(BIT_POSITION=0)]
Copy
语言: 中文