I need to replace a null character in a spark sql string.
I can't find an equivalent of COLLATE in spark sql.
Can you help?
If you are looking for a way to replace every NULL character in a string you can use regexp_replace. Depending on the encoding and programming language you use the NULL character can be different: \000, \x00, \z, or \u0000. [Wikipedia]
null_character = u'\u0000'
replacement = ' '
df = df.withColumn('e', F.regexp_replace(F.col('columnX'), null_character, replacement))
Related response: https://stackoverflow.com/a/41152572/14338716
coalesce?