HuangXingBo commented on code in PR #21079: URL: https://github.com/apache/flink/pull/21079#discussion_r996658315
########## flink-python/pyflink/common/typeinfo.py: ########## @@ -720,6 +720,39 @@ def __repr__(self) -> str: return 'MapTypeInfo<{}, {}>'.format(self._key_type_info, self._value_type_info) +class LocalTimeTypeInfo(TypeInformation): + + class TimeType(Enum): + LOCAL_DATE = 0 + LOCAL_TIME = 1 + LOCAL_DATE_TIME = 2 + + def __init__(self, time_type: TimeType): + super(LocalTimeTypeInfo, self).__init__() + self._time_type = time_type + self._j_typeinfo = None + + def get_java_type_info(self) -> JavaObject: + if self._j_typeinfo is None: + jvm = get_gateway().jvm + if self._time_type == LocalTimeTypeInfo.TimeType.LOCAL_DATE: + self._j_typeinfo = \ + jvm.org.apache.flink.api.common.typeinfo.LocalTimeTypeInfo.LOCAL_DATE + elif self._time_type == LocalTimeTypeInfo.TimeType.LOCAL_TIME: + self._j_typeinfo = \ + jvm.org.apache.flink.api.common.typeinfo.LocalTimeTypeInfo.LOCAL_TIME + if self._time_type == LocalTimeTypeInfo.TimeType.LOCAL_DATE_TIME: Review Comment: And raise an Exception when `self._time_type` is not a expected type ########## flink-python/pyflink/common/typeinfo.py: ########## @@ -720,6 +720,39 @@ def __repr__(self) -> str: return 'MapTypeInfo<{}, {}>'.format(self._key_type_info, self._value_type_info) +class LocalTimeTypeInfo(TypeInformation): + + class TimeType(Enum): + LOCAL_DATE = 0 + LOCAL_TIME = 1 + LOCAL_DATE_TIME = 2 + + def __init__(self, time_type: TimeType): + super(LocalTimeTypeInfo, self).__init__() + self._time_type = time_type + self._j_typeinfo = None Review Comment: We have set `self._j_typeinfo = None` in the base class `TypeInformation`, so we can remove this line ########## flink-python/pyflink/common/typeinfo.py: ########## @@ -720,6 +720,39 @@ def __repr__(self) -> str: return 'MapTypeInfo<{}, {}>'.format(self._key_type_info, self._value_type_info) +class LocalTimeTypeInfo(TypeInformation): + + class TimeType(Enum): + LOCAL_DATE = 0 + LOCAL_TIME = 1 + LOCAL_DATE_TIME = 2 + + def __init__(self, time_type: TimeType): + super(LocalTimeTypeInfo, self).__init__() + self._time_type = time_type + self._j_typeinfo = None + + def get_java_type_info(self) -> JavaObject: + if self._j_typeinfo is None: + jvm = get_gateway().jvm + if self._time_type == LocalTimeTypeInfo.TimeType.LOCAL_DATE: + self._j_typeinfo = \ + jvm.org.apache.flink.api.common.typeinfo.LocalTimeTypeInfo.LOCAL_DATE + elif self._time_type == LocalTimeTypeInfo.TimeType.LOCAL_TIME: + self._j_typeinfo = \ + jvm.org.apache.flink.api.common.typeinfo.LocalTimeTypeInfo.LOCAL_TIME + if self._time_type == LocalTimeTypeInfo.TimeType.LOCAL_DATE_TIME: Review Comment: ```suggestion eif self._time_type == LocalTimeTypeInfo.TimeType.LOCAL_DATE_TIME: ``` -- 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. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org