Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17267#discussion_r105654236
  
    --- Diff: python/pyspark/sql/utils.py ---
    @@ -24,7 +24,7 @@ def __init__(self, desc, stackTrace):
             self.stackTrace = stackTrace
     
         def __str__(self):
    -        return repr(self.desc)
    +        return str(self.desc)
    --- End diff --
    
    I just tested with this change as below to help:
    
    - before
    
    ```python
    >>> try:
    ...     spark.range(1).select("아")
    ... except Exception as e:
    ...     print e
    ...
    
    u"cannot resolve '`\uc544`' given input columns: [id];;\n'Project 
['\uc544]\n+- Range (0, 1, step=1, splits=Some(8))\n"
    >>>
    >>> spark.range(1).select("아")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../spark/python/pyspark/sql/dataframe.py", line 992, in select
        jdf = self._jdf.select(self._jcols(*cols))
      File ".../spark/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py", 
line 1133, in __call__
      File ".../spark/python/pyspark/sql/utils.py", line 69, in deco
        raise AnalysisException(s.split(': ', 1)[1], stackTrace)
    pyspark.sql.utils.AnalysisException: u"cannot resolve '`\uc544`' given 
input columns: [id];;\n'Project ['\uc544]\n+- Range (0, 1, step=1, 
splits=Some(8))\n"
    ```
    
    - after
    
    ```python
    >>> try:
    ...     spark.range(1).select("아")
    ... except Exception as e:
    ...     print e
    ...
    Traceback (most recent call last):
      File "<stdin>", line 4, in <module>
      File ".../spark/python/pyspark/sql/utils.py", line 27, in __str__
        return str(self.desc)
    UnicodeEncodeError: 'ascii' codec can't encode character u'\uc544' in 
position 17: ordinal not in range(128)
    
    >>> spark.range(1).select("아")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File ".../spark/python/pyspark/sql/dataframe.py", line 992, in select
        jdf = self._jdf.select(self._jcols(*cols))
      File ".../spark/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py", 
line 1133, in __call__
      File ".../spark/python/pyspark/sql/utils.py", line 69, in deco
        raise AnalysisException(s.split(': ', 1)[1], stackTrace)
    pyspark.sql.utils.AnalysisException
    >>>
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to