pyspark.sql.functions.
bit_length
Calculates the bit length for the specified string column.
New in version 3.3.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
Source column or strings
Bit length of the col
Examples
>>> from pyspark.sql.functions import bit_length >>> spark.createDataFrame([('cat',), ( '🐈',)], ['cat']) \ ... .select(bit_length('cat')).collect() [Row(bit_length(cat)=24), Row(bit_length(cat)=32)]