Kopīgot, izmantojot


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

from pyspark.databricks.sql import functions as dbf

dbf.length(col=<col>)

Parameters

Parameter Type Description
col pyspark.sql.Column or str target column to work on.

Returns

pyspark.sql.Column: length of the value.

Examples

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