Κοινοποίηση μέσω


character_length

Returns the character length of string data or number of bytes of binary data.

  • The length of string data includes the trailing spaces.
  • The length of binary data includes binary zeros.

For the corresponding Databricks SQL function, see character_length function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.character_length(str=<str>)

Parameters

Parameter Type Description
str pyspark.sql.Column or str Input column or strings.

Examples

from pyspark.databricks.sql import functions as dbf
spark.range(1).select(dbf.character_length(dbf.lit("SparkSQL"))).show()
+--------------------------+
|character_length(SparkSQL)|
+--------------------------+
|                         8|
+--------------------------+