-
-
Save kretes/58f7f66a0780681a44c175a2ac3c0da2 to your computer and use it in GitHub Desktop.
Repro for spark csv escape issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a,b | |
at_the_end\,1 | |
in_\_side,1 | |
"comma,at_the_end\\",1 | |
"comma,in_\\_side",1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = spark.createDataFrame([{'a':"at_the_end\\", "b":1}, | |
{'a':"in_\\_side", "b":1}, | |
{'a':"comma,at_the_end\\", "b":1}, | |
{'a':"comma,in_\\_side", "b":1} | |
]) | |
path = "/tmp/spark-quote9" | |
df.coalesce(1).write.mode("overwrite").csv(path, header=True, escape="\\", quote='"') | |
! hdfs dfs -text {path}/* > /tmp/csv | |
pd.read_csv("/tmp/csv", escapechar="\\") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi Tomasz Bartczak,
This is my first jira, which i am going to check. please guide me to check the issue.