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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to