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.
New in version 4.0.0.
- Parameters
- str
Column
or column name A column of strings, each representing a UTF-8 byte sequence.
- str
- Returns
Column
whether the input string is a valid UTF-8 string.
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| +-----------------------+