You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/11/11 13:50:42 UTC

[GitHub] [spark] zero323 commented on a change in pull request #30322: [SPARK-33415][PYTHON][SQL] Don't encode JVM response in Column.__repr__

zero323 commented on a change in pull request #30322:
URL: https://github.com/apache/spark/pull/30322#discussion_r521370982



##########
File path: python/pyspark/sql/column.py
##########
@@ -906,7 +906,7 @@ def __nonzero__(self):
     __bool__ = __nonzero__
 
     def __repr__(self):
-        return 'Column<%s>' % self._jc.toString().encode('utf8')
+        return "Column<'%s'>" % self._jc.toString()

Review comment:
       For example in IPython
   
   ```
   >>> import sys
   >>> sys.version_info
   sys.version_info(major=2, minor=7, micro=15, releaselevel='final', serial=0)
   >>> class Foo:
   ...     def __repr__(self):
   ...         return u"œ"
   ...     
   ...     
   >>> Foo().__repr__()
   u'\u0153'
   >>> Foo()
   Traceback (most recent call last):
     File "/path/to/lib/python2.7/site-packages/IPython/core/formatters.py", line 686, in __call__
       return repr(obj)
   UnicodeEncodeError: 'ascii' codec can't encode character u'\u0153' in position 0: ordinal not in range(128)
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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