shuiqiangchen commented on a change in pull request #13983:
URL: https://github.com/apache/flink/pull/13983#discussion_r530902086



##########
File path: flink-python/pyflink/datastream/utils.py
##########
@@ -26,29 +26,31 @@
 
 
 def convert_to_python_obj(data, type_info):
-    if type_info is None:
+    if type_info == Types.PICKLED_BYTE_ARRAY():
         return pickle.loads(data)
     else:
         gateway = get_gateway()
         pickle_bytes = gateway.jvm.PythonBridgeUtils. \
             getPickledBytesFromJavaObject(data, type_info.get_java_type_info())
-        pickle_bytes = list(pickle_bytes[1:])
-        field_data = zip(pickle_bytes, type_info.types)
-        fields = []
-        for data, field_type in field_data:
-            if len(data) == 0:
-                fields.append(None)
-            else:
-                fields.append(java_to_python_converter(data, field_type))
-        return tuple(fields)
+        if hasattr(type_info, 'types'):
+            field_data = zip(list(pickle_bytes[1:]), 
type_info.get_field_types())
+            fields = []
+            for data, field_type in field_data:
+                if len(data) == 0:
+                    fields.append(None)
+                else:
+                    fields.append(pickled_bytes_to_python_converter(data, 
field_type))
+            return tuple(fields)

Review comment:
       What if the type_info is a Row type? if it was a complex type info (Row, 
Tuple, Array, Map, etc) maybe we should convert field_types respectively.




----------------------------------------------------------------
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]


Reply via email to