Skip to main content

octet_length

Calculates the byte length for the specified string column.

For the corresponding Databricks SQL function, see octet_length function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.octet_length(col=<col>)

Parameters

Parameter

Type

Description

col

pyspark.sql.Column or str

Source column or strings

Returns

pyspark.sql.Column: Byte length of the col

Examples

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('cat',), ( '\U0001F408',)], ['cat'])
df.select('*', dbf.octet_length('cat')).show()