pyspark.sql.functions.is_valid_utf8#
- pyspark.sql.functions.is_valid_utf8(str)[source]#
Returns true if the input is a valid UTF-8 string, otherwise returns false.
Added in version 4.0.0.
- Parameters:
- str
Columnor column name A column of strings, each representing a UTF-8 byte sequence. A column that evaluates to a string.
- str
- Returns:
Columnwhether the input string is a valid UTF-8 string. Returns a column that evaluates to a boolean.
See also
Examples
>>> import pyspark.sql.functions as sf >>> spark.range(1).select(sf.is_valid_utf8(sf.lit("SparkSQL"))).show() +-----------------------+ |is_valid_utf8(SparkSQL)| +-----------------------+ | true| +-----------------------+