[ 
https://issues.apache.org/jira/browse/SPARK-11772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15009620#comment-15009620
 ] 

Greg Baker commented on SPARK-11772:
------------------------------------

Having looked at it more, it seems like this is less a Spark bug than an 
undesirable behaviour of Python. 
http://stackoverflow.com/questions/492483/setting-the-correct-encoding-when-piping-stdout-in-python

If I set PYTHONIOENCODING=utf8 for the command, it outputs fine.

> DataFrame.show() fails with non-ASCII strings
> ---------------------------------------------
>
>                 Key: SPARK-11772
>                 URL: https://issues.apache.org/jira/browse/SPARK-11772
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.5.1
>            Reporter: Greg Baker
>            Priority: Minor
>
> When given a non-ASCII string (in pyspark at least), the DataFrame.show() 
> method fails.
> {code:none}
> df = sqlContext.createDataFrame([[u'ab\u0255']])
> df.show()
> {code}
> Results in:
> {code:none}
> 15/11/16 21:36:54 INFO DAGScheduler: ResultStage 1 (showString at 
> NativeMethodAccessorImpl.java:-2) finished in 0.148 s
> 15/11/16 21:36:54 INFO DAGScheduler: Job 1 finished: showString at 
> NativeMethodAccessorImpl.java:-2, took 0.192634 s
> Traceback (most recent call last):
>   File ".../show_bug.py", line 8, in <module>
>     df.show()
>   File 
> ".../spark-1.5.2-bin-hadoop2.6/python/lib/pyspark.zip/pyspark/sql/dataframe.py",
>  line 256, in show
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u0255' in 
> position 21: ordinal not in range(128)
> 15/11/16 21:36:54 INFO SparkContext: Invoking stop() from shutdown hook
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to