snowflake.snowpark.functions.bit_length¶
- snowflake.snowpark.functions.bit_length(e: Union[Column, str]) Column [source]¶
Returns the length of a string or binary value in bits.
Example:
>>> df = session.create_dataframe([['abc'], ['Δ']], schema=["v"]) >>> df = df.withColumn("b", lit("A1B2").cast("binary")) >>> df.select(bit_length(col("v")).alias("BIT_LENGTH_V"), bit_length(col("b")).alias("BIT_LENGTH_B")).collect() [Row(BIT_LENGTH_V=24, BIT_LENGTH_B=16), Row(BIT_LENGTH_V=16, BIT_LENGTH_B=16)]