Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
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 char_length function.
Syntax
from pyspark.sql import functions as dbf
dbf.char_length(str=<str>)
Parameters
| Parameter | Type | Description |
|---|---|---|
str |
pyspark.sql.Column or str |
Input column or strings |
Examples
from pyspark.sql import functions as dbf
spark.range(1).select(dbf.char_length(dbf.lit("SparkSQL"))).show()
+---------------------+
|char_length(SparkSQL)|
+---------------------+
| 8|
+---------------------+