[
https://issues.apache.org/jira/browse/SPARK-32965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17200743#comment-17200743
]
Punit Shah commented on SPARK-32965:
------------------------------------
It looks similar. I've attached a utf-16le file to this ticket. The pyspark
code is essentially:
spark.read.csv("16le.csv", inferSchema=True, header=True, encoding="utf_16le").
The attached picture shows the result.
> pyspark reading csv files with utf_16le encoding
> ------------------------------------------------
>
> Key: SPARK-32965
> URL: https://issues.apache.org/jira/browse/SPARK-32965
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.4.7, 3.0.0, 3.0.1
> Reporter: Punit Shah
> Priority: Major
> Attachments: 16le.csv, 32965.png
>
>
> If you have a file encoded in utf_16le or utf_16be and try to use
> spark.read.csv("<file_name>", encoding="utf_16le") the dataframe isn't
> rendered properly
> if you use python decoding like:
> prdd = spark_session._sc.binaryFiles(path_url).values().flatMap(lambda x :
> x.decode("utf_16le").splitlines())
> and then do spark.read.csv(prdd), then it works.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]