You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/06/04 18:23:52 UTC

[GitHub] betodealmeida commented on a change in pull request #5121: [sql lab] Fix issue around VARBINARY type in Presto

betodealmeida commented on a change in pull request #5121: [sql lab] Fix issue around VARBINARY type in Presto
URL: https://github.com/apache/incubator-superset/pull/5121#discussion_r192836310
 
 

 ##########
 File path: superset/utils.py
 ##########
 @@ -323,6 +322,11 @@ def base_json_conv(obj):
         return str(obj)
     elif isinstance(obj, timedelta):
         return str(obj)
+    elif isinstance(obj, bytes):
+        try:
+            return '{}'.format(obj)
 
 Review comment:
   This will return different values depending on Python version. For Python 2 (where bytes are strings):
   
   ```python
   >>> print(repr('{}'.format(b'test')))
   'test'
   ```
   
   For Python 3:
   
   ```python
   >>> print(repr('{}'.format(b'test')))
   "b'test'"
   ```
   
   Why not return a list of integers here instead?
   
   ```python
   >>> list(b'test')
   [116, 101, 115, 116]
   ```
   
   What is the use case for `VARBINARY`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org