Browse Source

[hiveserver2] Fix unpacking guid by using base64.b64decode for python3 (#2949)

Harsh Gupta 3 years ago
parent
commit
7e8bea6dd1
1 changed files with 2 additions and 1 deletions
  1. 2 1
      desktop/core/src/desktop/lib/thrift_util.py

+ 2 - 1
desktop/core/src/desktop/lib/thrift_util.py

@@ -605,7 +605,8 @@ def unpack_guid(guid):
   return "%016x:%016x" % struct.unpack(b"QQ", guid)
   return "%016x:%016x" % struct.unpack(b"QQ", guid)
 
 
 def unpack_guid_base64(guid):
 def unpack_guid_base64(guid):
-  return "%016x:%016x" % struct.unpack(b"QQ", base64.decodestring(guid))
+  decoded_guid = base64.b64decode(guid) if sys.version_info[0] > 2 else base64.decodestring(guid)
+  return "%016x:%016x" % struct.unpack(b"QQ", decoded_guid)
 
 
 def simpler_string(thrift_obj):
 def simpler_string(thrift_obj):
   """
   """