Skip to main content

length

The length of character data includes the trailing spaces. The length of binary data includes binary zeros.

For the corresponding Databricks SQL function, see length function.

Syntax​

Python
from pyspark.sql import functions as dbf

dbf.length(col=<col>)

Parameters​

Parameter

Type

Description

col

pyspark.sql.Column or str

target column to work on.

Parameter

Type

Description

col

pyspark.sql.Column or str

target column to work on.

Returns​

pyspark.sql.Column: length of the value.

Examples​

Python
from pyspark.sql import functions as dbf
spark.createDataFrame([('ABC ',)], ['a']).select('*', dbf.length('a')).show()