pyspark.sql.functions.octet_length¶
-
pyspark.sql.functions.
octet_length
(col: ColumnOrName) → pyspark.sql.column.Column[source]¶ Calculates the byte length for the specified string column.
New in version 3.3.0.
Changed in version 3.4.0: Supports Spark Connect.
Examples
>>> from pyspark.sql.functions import octet_length >>> spark.createDataFrame([('cat',), ( '🐈',)], ['cat']) \ ... .select(octet_length('cat')).collect() [Row(octet_length(cat)=3), Row(octet_length(cat)=4)]