shuiqiangchen commented on a change in pull request #14401:
URL: https://github.com/apache/flink/pull/14401#discussion_r545606417
##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -431,45 +430,47 @@ def from_internal_type(self, obj):
return tuple(values)
-class TupleTypeInfo(WrapperTypeInfo):
+class TupleTypeInfo(TypeInformation):
"""
TypeInformation for Tuple.
"""
def __init__(self, types: List[TypeInformation]):
self.types = types
+ super(TupleTypeInfo, self).__init__()
+
+ def get_field_types(self) -> List[TypeInformation]:
+ return self.types
+
+ def get_java_type_info(self) -> JavaObject:
j_types_array = get_gateway().new_array(
-
get_gateway().jvm.org.apache.flink.api.common.typeinfo.TypeInformation,
len(types))
+
get_gateway().jvm.org.apache.flink.api.common.typeinfo.TypeInformation,
len(self.types))
- for i in range(len(types)):
- field_type = types[i]
- if isinstance(field_type, WrapperTypeInfo):
+ for i in range(len(self.types)):
+ field_type = self.types[i]
+ if isinstance(field_type, TypeInformation):
j_types_array[i] = field_type.get_java_type_info()
- j_typeinfo = get_gateway().jvm \
+ self._j_typeinfo = get_gateway().jvm \
.org.apache.flink.api.java.typeutils.TupleTypeInfo(j_types_array)
- super(TupleTypeInfo, self).__init__(j_typeinfo=j_typeinfo)
-
- def get_field_types(self) -> List[TypeInformation]:
- return self.types
+ return self._j_typeinfo
def __eq__(self, other) -> bool:
- return self._j_typeinfo.equals(other._j_typeinfo)
-
- def __hash__(self) -> int:
- return self._j_typeinfo.hashCode()
+ if isinstance(other, TupleTypeInfo):
+ return self.types == other.types
+ return False
def __str__(self) -> str:
- return "TupleTypeInfo(%s)" % ', '.join([field_type.__str__() for
field_type in self.types])
+ return "TupleTypeInfo(%s)" % ', '.join([str(field_type) for field_type
in self.types])
-class DateTypeInfo(WrapperTypeInfo):
+class DateTypeInformation(TypeInformation):
Review comment:
Sorry, I changed it mistakenly. I'll rename it back.
----------------------------------------------------------------
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]