Preserve special characters and null while using spark dataframe csv write

28 Views Asked by At

I have data like below with NUL and special characters ABCDEF| ABC enter image description here

When I try to write this using csv, it prints out additional NUL characters that weren't part of data. I want to preseve the special characters. Here's the write statement and output. Basically, i want to change the delimiter to 3 character , and then write it to disk.

df.write.options(header="false",delimiter=',,,').mode("overwrite").csv("outputfile",quote="",encoding='ISO-8859-1',nullValue="NULL",escape="") ABCDEF| ABC enter image description here

This is what I have, would love to hear suggestions to improve handling special characters using csv.

0

There are 0 best solutions below