You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/12/16 08:49:13 UTC

[GitHub] [flink] shuiqiangchen opened a new pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

shuiqiangchen opened a new pull request #14401:
URL: https://github.com/apache/flink/pull/14401


   <!--
   *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   
   Currently, when users declare a TypeInfo in Python DataStream job it will create a Java TypeInfo instance when instantiating. We should make it in a lazy style that creates the Java TypeInfo instance only when calling TypeInformation.get_java_type_info().
   
   ## Brief change log
   
   - *Removed WrapperTypeInfo*
   - *No need to create Java TypeInfo in Python TypeInfo constructor*
   
   ## Verifying this change
   
   This change has test case covered by all existing IT cases.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): ( no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? ( not documented)
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199",
       "triggerID" : "749662559",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "749662559",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11214",
       "triggerID" : "749909458",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199",
       "triggerID" : "749909458",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * 2ea69af31eaafde2be7241f658399052c9e7af16 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167) Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11214) Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] shuiqiangchen commented on a change in pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on a change in pull request #14401:
URL: https://github.com/apache/flink/pull/14401#discussion_r545557068



##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -407,12 +406,12 @@ def to_internal_type(self, obj):
                 raise ValueError("Unexpected tuple %r with RowTypeInfo" % obj)
         else:
             if isinstance(obj, dict):
-                return tuple(obj.get(n) for n in self._j_typeinfo.getFieldNames())
+                return tuple(obj.get(n) for n in self.field_names)

Review comment:
       Here we should appy obj.get(field_name), it would return None if the field_name does not present in the obj while applying obj[field_name] will get a KeyError.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199",
       "triggerID" : "749662559",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "749662559",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11214",
       "triggerID" : "749909458",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * 2ea69af31eaafde2be7241f658399052c9e7af16 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199) Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167) Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11214) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 21093e3501f0ece1b38302e4a86ebed9e7938c4e Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104) 
   * 2ea69af31eaafde2be7241f658399052c9e7af16 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] shuiqiangchen commented on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-749662559


   @flinkbot run azure


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] shuiqiangchen commented on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-749909458


   @flinkbot run azure


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] shuiqiangchen commented on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-749418599


   Hi @dianfu , Thank you for reviewing. I have addressed the suggestions you gave and refactor the proto of the TypeInfo. Please have a look.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] shuiqiangchen commented on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-747157946


   @flinkbot run azure


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * 8f14cd73606d83ac976b9e17934c645d13a32947 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924) Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] HuangXingBo commented on a change in pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
HuangXingBo commented on a change in pull request #14401:
URL: https://github.com/apache/flink/pull/14401#discussion_r544789178



##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -91,66 +73,117 @@ def from_internal_type(self, obj):
         return obj
 
 
-class BasicTypeInfo(TypeInformation, ABC):
+class BasicTypes(Enum):

Review comment:
       ```suggestion
   class BasicType(Enum):
   ```

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -91,66 +73,117 @@ def from_internal_type(self, obj):
         return obj
 
 
-class BasicTypeInfo(TypeInformation, ABC):
+class BasicTypes(Enum):
+    STRING = "String"
+    BYTE = "Byte"
+    BOOLEAN = "Boolean"
+    SHORT = "Short"
+    INT = "Integer"
+    LONG = "Long"
+    FLOAT = "Float"
+    DOUBLE = "Double"
+    CHAR = "Char"
+    BIG_INT = "BigInteger"
+    BIG_DEC = "BigDecimal"
+
+
+class BasicTypeInformation(TypeInformation, ABC):

Review comment:
       ```suggestion
   class BasicTypeInformation(TypeInformation):
   ```

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -160,227 +193,193 @@ class SqlTimeTypeInfo(TypeInformation, ABC):
 
     @staticmethod
     def DATE():
-        return DateTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.DATE)
+        return DateTypeInformation()
 
     @staticmethod
     def TIME():
-        return TimeTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIME)
+        return TimeTypeInformation()
 
     @staticmethod
     def TIMESTAMP():
-        return TimestampTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIMESTAMP)
+        return TimestampTypeInformation()
 
 
-class PrimitiveArrayTypeInfo(WrapperTypeInfo, ABC):
+class PrimitiveArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of primitive types (int, long, double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
 
-    @staticmethod
-    def BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def BYTE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(PrimitiveArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JPrimitiveArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .PrimitiveArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JPrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JPrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JPrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JPrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JPrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JPrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JPrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JPrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def LONG_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, PrimitiveArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def FLOAT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __repr__(self) -> str:
+        return "PrimitiveArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def CHAR_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO)
+def is_primitive_array_type_info(type_info: TypeInformation):
+    return isinstance(type_info, PrimitiveArrayTypeInformation)
 
 
-def is_primitive_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO()
-    }
-
-
-class BasicArrayTypeInfo(WrapperTypeInfo, ABC):
+class BasicArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of boxed primitive types (Integer, Long, Double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
-    @staticmethod
-    def BOOLEAN_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def BYTE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(BasicArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def LONG_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JBasicArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .BasicArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JBasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JBasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JBasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JBasicArrayTypeInfo.INT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JBasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JBasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JBasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JBasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO
+        elif self._element_type == Types.STRING():
+            return JBasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def FLOAT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, BasicArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def DOUBLE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO)
+    def __repr__(self):
+        return "BasicArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def CHAR_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def STRING_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO)
+def is_basic_array_type_info(type_info: TypeInformation):
+    return isinstance(type_info, BasicArrayTypeInformation)
 
 
-def is_basic_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO()
-    }
-
-
-class PickledBytesTypeInfo(WrapperTypeInfo, ABC):
+class PickledBytesTypeInfo(TypeInformation, ABC):

Review comment:
       ```suggestion
   class PickledBytesTypeInfo(TypeInformation):
   ```

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -48,30 +48,12 @@ class acts as the tool to generate serializers and comparators, and to perform s
     nested types).
     """
 
-
-class WrapperTypeInfo(TypeInformation):
-    """
-    A wrapper class for java TypeInformation Objects.
-    """
-
-    def __init__(self, j_typeinfo):
-        self._j_typeinfo = j_typeinfo
+    def __init__(self):
+        self._j_typeinfo = None
 
     def get_java_type_info(self) -> JavaObject:

Review comment:
       Since the subclasses of `TypeInformation` will always override this method, I think this method can be declared as an abstract method.

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -160,227 +193,193 @@ class SqlTimeTypeInfo(TypeInformation, ABC):
 
     @staticmethod
     def DATE():
-        return DateTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.DATE)
+        return DateTypeInformation()
 
     @staticmethod
     def TIME():
-        return TimeTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIME)
+        return TimeTypeInformation()
 
     @staticmethod
     def TIMESTAMP():
-        return TimestampTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIMESTAMP)
+        return TimestampTypeInformation()
 
 
-class PrimitiveArrayTypeInfo(WrapperTypeInfo, ABC):
+class PrimitiveArrayTypeInformation(TypeInformation, ABC):

Review comment:
       ```suggestion
   class PrimitiveArrayTypeInformation(TypeInformation):
   ```

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -160,227 +193,193 @@ class SqlTimeTypeInfo(TypeInformation, ABC):
 
     @staticmethod
     def DATE():
-        return DateTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.DATE)
+        return DateTypeInformation()
 
     @staticmethod
     def TIME():
-        return TimeTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIME)
+        return TimeTypeInformation()
 
     @staticmethod
     def TIMESTAMP():
-        return TimestampTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIMESTAMP)
+        return TimestampTypeInformation()
 
 
-class PrimitiveArrayTypeInfo(WrapperTypeInfo, ABC):
+class PrimitiveArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of primitive types (int, long, double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
 
-    @staticmethod
-    def BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def BYTE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(PrimitiveArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JPrimitiveArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .PrimitiveArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JPrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JPrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JPrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JPrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JPrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JPrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JPrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JPrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def LONG_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, PrimitiveArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def FLOAT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __repr__(self) -> str:
+        return "PrimitiveArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def CHAR_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO)
+def is_primitive_array_type_info(type_info: TypeInformation):
+    return isinstance(type_info, PrimitiveArrayTypeInformation)
 
 
-def is_primitive_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO()
-    }
-
-
-class BasicArrayTypeInfo(WrapperTypeInfo, ABC):
+class BasicArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of boxed primitive types (Integer, Long, Double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
-    @staticmethod
-    def BOOLEAN_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def BYTE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(BasicArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def LONG_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JBasicArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .BasicArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JBasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JBasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JBasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JBasicArrayTypeInfo.INT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JBasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JBasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JBasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JBasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO
+        elif self._element_type == Types.STRING():
+            return JBasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def FLOAT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, BasicArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def DOUBLE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO)
+    def __repr__(self):
+        return "BasicArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def CHAR_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def STRING_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO)
+def is_basic_array_type_info(type_info: TypeInformation):

Review comment:
       I think we can remove this method

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -160,227 +193,193 @@ class SqlTimeTypeInfo(TypeInformation, ABC):
 
     @staticmethod
     def DATE():
-        return DateTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.DATE)
+        return DateTypeInformation()
 
     @staticmethod
     def TIME():
-        return TimeTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIME)
+        return TimeTypeInformation()
 
     @staticmethod
     def TIMESTAMP():
-        return TimestampTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIMESTAMP)
+        return TimestampTypeInformation()
 
 
-class PrimitiveArrayTypeInfo(WrapperTypeInfo, ABC):
+class PrimitiveArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of primitive types (int, long, double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
 
-    @staticmethod
-    def BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def BYTE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(PrimitiveArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JPrimitiveArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .PrimitiveArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JPrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JPrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JPrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JPrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JPrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JPrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JPrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JPrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def LONG_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, PrimitiveArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def FLOAT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __repr__(self) -> str:
+        return "PrimitiveArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def CHAR_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO)
+def is_primitive_array_type_info(type_info: TypeInformation):

Review comment:
       I think we can remove this method.

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -160,227 +193,193 @@ class SqlTimeTypeInfo(TypeInformation, ABC):
 
     @staticmethod
     def DATE():
-        return DateTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.DATE)
+        return DateTypeInformation()
 
     @staticmethod
     def TIME():
-        return TimeTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIME)
+        return TimeTypeInformation()
 
     @staticmethod
     def TIMESTAMP():
-        return TimestampTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIMESTAMP)
+        return TimestampTypeInformation()
 
 
-class PrimitiveArrayTypeInfo(WrapperTypeInfo, ABC):
+class PrimitiveArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of primitive types (int, long, double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
 
-    @staticmethod
-    def BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def BYTE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(PrimitiveArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JPrimitiveArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .PrimitiveArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JPrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JPrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JPrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JPrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JPrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JPrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JPrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JPrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def LONG_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, PrimitiveArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def FLOAT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __repr__(self) -> str:
+        return "PrimitiveArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def CHAR_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO)
+def is_primitive_array_type_info(type_info: TypeInformation):
+    return isinstance(type_info, PrimitiveArrayTypeInformation)
 
 
-def is_primitive_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO()
-    }
-
-
-class BasicArrayTypeInfo(WrapperTypeInfo, ABC):
+class BasicArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of boxed primitive types (Integer, Long, Double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
-    @staticmethod
-    def BOOLEAN_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def BYTE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(BasicArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def LONG_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JBasicArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .BasicArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JBasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JBasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JBasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JBasicArrayTypeInfo.INT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JBasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JBasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JBasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JBasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO
+        elif self._element_type == Types.STRING():
+            return JBasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def FLOAT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, BasicArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def DOUBLE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO)
+    def __repr__(self):
+        return "BasicArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def CHAR_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def STRING_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO)
+def is_basic_array_type_info(type_info: TypeInformation):
+    return isinstance(type_info, BasicArrayTypeInformation)
 
 
-def is_basic_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO()
-    }
-
-
-class PickledBytesTypeInfo(WrapperTypeInfo, ABC):
+class PickledBytesTypeInfo(TypeInformation, ABC):
     """
     A PickledBytesTypeInfo indicates the data is a primitive byte array generated by pickle
     serializer.
     """
 
     @staticmethod
     def PICKLED_BYTE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(get_gateway().jvm.org.apache.flink.streaming.api.typeinfo.python
-                               .PickledByteArrayTypeInfo.PICKLED_BYTE_ARRAY_TYPE_INFO)
+        return PickledBytesTypeInfo()

Review comment:
       Why do we need to provide this static factory method without parameters? I guess you want to implement a singleton, but doing so will not achieve the effect
   

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -160,227 +193,193 @@ class SqlTimeTypeInfo(TypeInformation, ABC):
 
     @staticmethod
     def DATE():
-        return DateTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.DATE)
+        return DateTypeInformation()
 
     @staticmethod
     def TIME():
-        return TimeTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIME)
+        return TimeTypeInformation()
 
     @staticmethod
     def TIMESTAMP():
-        return TimestampTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIMESTAMP)
+        return TimestampTypeInformation()
 
 
-class PrimitiveArrayTypeInfo(WrapperTypeInfo, ABC):
+class PrimitiveArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of primitive types (int, long, double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
 
-    @staticmethod
-    def BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def BYTE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(PrimitiveArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JPrimitiveArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .PrimitiveArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JPrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JPrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JPrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JPrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JPrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JPrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JPrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JPrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def LONG_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, PrimitiveArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def FLOAT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __repr__(self) -> str:
+        return "PrimitiveArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def CHAR_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO)
+def is_primitive_array_type_info(type_info: TypeInformation):
+    return isinstance(type_info, PrimitiveArrayTypeInformation)
 
 
-def is_primitive_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO()
-    }
-
-
-class BasicArrayTypeInfo(WrapperTypeInfo, ABC):
+class BasicArrayTypeInformation(TypeInformation, ABC):

Review comment:
       ```suggestion
   class BasicArrayTypeInformation(TypeInformation):
   ```

##########
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:

Review comment:
       I think we need to override the `__repr__` method.
   
   

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -407,12 +406,12 @@ def to_internal_type(self, obj):
                 raise ValueError("Unexpected tuple %r with RowTypeInfo" % obj)
         else:
             if isinstance(obj, dict):
-                return tuple(obj.get(n) for n in self._j_typeinfo.getFieldNames())
+                return tuple(obj.get(n) for n in self.field_names)

Review comment:
       ```suggestion
                   return tuple(obj[n] for n in self.field_names)
   ```

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -407,12 +406,12 @@ def to_internal_type(self, obj):
                 raise ValueError("Unexpected tuple %r with RowTypeInfo" % obj)
         else:
             if isinstance(obj, dict):
-                return tuple(obj.get(n) for n in self._j_typeinfo.getFieldNames())
+                return tuple(obj.get(n) for n in self.field_names)
             elif isinstance(obj, (list, tuple)):
                 return tuple(obj)
             elif hasattr(obj, "__dict__"):
                 d = obj.__dict__
-                return tuple(d.get(n) for n in self._j_typeinfo.getFieldNames())
+                return tuple(d.get(n) for n in self.field_names)

Review comment:
       ```suggestion
                   return tuple(d[n] for n in self.field_names)
   ```

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -160,227 +193,193 @@ class SqlTimeTypeInfo(TypeInformation, ABC):
 
     @staticmethod
     def DATE():
-        return DateTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.DATE)
+        return DateTypeInformation()
 
     @staticmethod
     def TIME():
-        return TimeTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIME)
+        return TimeTypeInformation()
 
     @staticmethod
     def TIMESTAMP():
-        return TimestampTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIMESTAMP)
+        return TimestampTypeInformation()
 
 
-class PrimitiveArrayTypeInfo(WrapperTypeInfo, ABC):
+class PrimitiveArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of primitive types (int, long, double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
 
-    @staticmethod
-    def BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def BYTE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(PrimitiveArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JPrimitiveArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .PrimitiveArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JPrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JPrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JPrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JPrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JPrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JPrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JPrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JPrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def LONG_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, PrimitiveArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def FLOAT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __repr__(self) -> str:
+        return "PrimitiveArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def CHAR_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO)
+def is_primitive_array_type_info(type_info: TypeInformation):
+    return isinstance(type_info, PrimitiveArrayTypeInformation)
 
 
-def is_primitive_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO()
-    }
-
-
-class BasicArrayTypeInfo(WrapperTypeInfo, ABC):
+class BasicArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of boxed primitive types (Integer, Long, Double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
-    @staticmethod
-    def BOOLEAN_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def BYTE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(BasicArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def LONG_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JBasicArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .BasicArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JBasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JBasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JBasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JBasicArrayTypeInfo.INT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JBasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JBasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JBasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JBasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO
+        elif self._element_type == Types.STRING():
+            return JBasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def FLOAT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, BasicArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def DOUBLE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO)
+    def __repr__(self):
+        return "BasicArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def CHAR_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def STRING_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO)
+def is_basic_array_type_info(type_info: TypeInformation):
+    return isinstance(type_info, BasicArrayTypeInformation)
 
 
-def is_basic_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO()
-    }
-
-
-class PickledBytesTypeInfo(WrapperTypeInfo, ABC):
+class PickledBytesTypeInfo(TypeInformation, ABC):
     """
     A PickledBytesTypeInfo indicates the data is a primitive byte array generated by pickle
     serializer.
     """
 
     @staticmethod
     def PICKLED_BYTE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(get_gateway().jvm.org.apache.flink.streaming.api.typeinfo.python
-                               .PickledByteArrayTypeInfo.PICKLED_BYTE_ARRAY_TYPE_INFO)
+        return PickledBytesTypeInfo()
+
+    def get_java_type_info(self) -> JavaObject:
+        self._j_typeinfo = get_gateway().jvm.org.apache.flink.streaming.api.typeinfo.python\
+            .PickledByteArrayTypeInfo.PICKLED_BYTE_ARRAY_TYPE_INFO
+        return self._j_typeinfo
 
+    def __eq__(self, o: object) -> bool:
+        return isinstance(o, PickledBytesTypeInfo)
 
-class RowTypeInfo(WrapperTypeInfo):
+    def __repr__(self):
+        return "PickledByteArrayTypeInformation"
+
+
+class RowTypeInfo(TypeInformation):
     """
     TypeInformation for Row.
     """
 
     def __init__(self, types: List[TypeInformation], field_names: List[str] = None):
         self.types = types
         self.field_names = field_names
-        self.j_types_array = get_gateway().new_array(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.TypeInformation, len(types))
-        for i in range(len(types)):
-            wrapper_typeinfo = types[i]
-            if isinstance(wrapper_typeinfo, WrapperTypeInfo):
-                self.j_types_array[i] = wrapper_typeinfo.get_java_type_info()
-
-        if field_names is None:
-            self._j_typeinfo = get_gateway().jvm.org.apache.flink.api.java.typeutils.RowTypeInfo(
-                self.j_types_array)
-        else:
-            j_names_array = get_gateway().new_array(get_gateway().jvm.java.lang.String,
-                                                    len(field_names))
-            for i in range(len(field_names)):
-                j_names_array[i] = field_names[i]
-            self._j_typeinfo = get_gateway().jvm.org.apache.flink.api.java.typeutils.RowTypeInfo(
-                self.j_types_array, j_names_array)
-        self._need_conversion = [f.need_conversion() if isinstance(f, WrapperTypeInfo) else None
-                                 for f in types]
+        self._need_conversion = [f.need_conversion() if isinstance(f, TypeInformation) else None
+                                 for f in self.types]
         self._need_serialize_any_field = any(self._need_conversion)
-        super(RowTypeInfo, self).__init__(self._j_typeinfo)
+        super(RowTypeInfo, self).__init__()
 
     def get_field_names(self) -> List[str]:
-        j_field_names = self._j_typeinfo.getFieldNames()
-        field_names = [name for name in j_field_names]
-        return field_names
+        if not self.field_names:
+            j_field_names = self.get_java_type_info().getFieldNames()
+            self.field_names = [name for name in j_field_names]
+        return self.field_names
 
     def get_field_index(self, field_name: str) -> int:
-        return self._j_typeinfo.getFieldIndex(field_name)
+        if self.field_names:
+            return self.field_names.index(field_name)
+        return -1
 
     def get_field_types(self) -> List[TypeInformation]:
         return self.types
 
-    def __eq__(self, other) -> bool:
-        return self._j_typeinfo.equals(other._j_typeinfo)
+    def get_java_type_info(self) -> JavaObject:
+        if not self._j_typeinfo:
+            j_types_array = get_gateway()\
+                .new_array(get_gateway().jvm.org.apache.flink.api.common.typeinfo.TypeInformation,
+                           len(self.types))
+            for i in range(len(self.types)):
+                wrapper_typeinfo = self.types[i]
+                if isinstance(wrapper_typeinfo, TypeInformation):
+                    j_types_array[i] = wrapper_typeinfo.get_java_type_info()
+
+            if self.field_names is None:
+                self._j_typeinfo = get_gateway().jvm\
+                    .org.apache.flink.api.java.typeutils.RowTypeInfo(j_types_array)
+            else:
+                j_names_array = get_gateway().new_array(get_gateway().jvm.java.lang.String,
+                                                        len(self.field_names))
+                for i in range(len(self.field_names)):
+                    j_names_array[i] = self.field_names[i]
+                self._j_typeinfo = get_gateway().jvm\
+                    .org.apache.flink.api.java.typeutils.RowTypeInfo(j_types_array, j_names_array)
+        return self._j_typeinfo
 
-    def __hash__(self) -> int:
-        return self._j_typeinfo.hashCode()
+    def __eq__(self, other) -> bool:
+        if isinstance(other, RowTypeInfo):
+            return self.types == other.types
+        return False
 
     def __str__(self) -> str:

Review comment:
       I think we need to override the `__repr__` method.

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -160,227 +193,193 @@ class SqlTimeTypeInfo(TypeInformation, ABC):
 
     @staticmethod
     def DATE():
-        return DateTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.DATE)
+        return DateTypeInformation()
 
     @staticmethod
     def TIME():
-        return TimeTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIME)
+        return TimeTypeInformation()
 
     @staticmethod
     def TIMESTAMP():
-        return TimestampTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIMESTAMP)
+        return TimestampTypeInformation()
 
 
-class PrimitiveArrayTypeInfo(WrapperTypeInfo, ABC):
+class PrimitiveArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of primitive types (int, long, double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
 
-    @staticmethod
-    def BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def BYTE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(PrimitiveArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JPrimitiveArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .PrimitiveArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JPrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JPrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JPrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JPrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JPrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JPrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JPrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JPrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def LONG_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, PrimitiveArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def FLOAT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __repr__(self) -> str:
+        return "PrimitiveArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def CHAR_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO)
+def is_primitive_array_type_info(type_info: TypeInformation):
+    return isinstance(type_info, PrimitiveArrayTypeInformation)
 
 
-def is_primitive_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO()
-    }
-
-
-class BasicArrayTypeInfo(WrapperTypeInfo, ABC):
+class BasicArrayTypeInformation(TypeInformation, ABC):
     """
     A TypeInformation for arrays of boxed primitive types (Integer, Long, Double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
-    @staticmethod
-    def BOOLEAN_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def BYTE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(BasicArrayTypeInformation, self).__init__()
 
-    @staticmethod
-    def SHORT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def LONG_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        JBasicArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+            .BasicArrayTypeInfo
+        if self._element_type == Types.BOOLEAN():
+            return JBasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO
+        elif self._element_type == Types.BYTE():
+            return JBasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.SHORT():
+            return JBasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.INT():
+            return JBasicArrayTypeInfo.INT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.LONG():
+            return JBasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO
+        elif self._element_type == Types.FLOAT():
+            return JBasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO
+        elif self._element_type == Types.DOUBLE():
+            return JBasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO
+        elif self._element_type == Types.CHAR():
+            return JBasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO
+        elif self._element_type == Types.STRING():
+            return JBasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO
+        else:
+            raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def FLOAT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, BasicArrayTypeInformation):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def DOUBLE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO)
+    def __repr__(self):
+        return "BasicArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def CHAR_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def STRING_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO)
+def is_basic_array_type_info(type_info: TypeInformation):
+    return isinstance(type_info, BasicArrayTypeInformation)
 
 
-def is_basic_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO()
-    }
-
-
-class PickledBytesTypeInfo(WrapperTypeInfo, ABC):
+class PickledBytesTypeInfo(TypeInformation, ABC):
     """
     A PickledBytesTypeInfo indicates the data is a primitive byte array generated by pickle
     serializer.
     """
 
     @staticmethod
     def PICKLED_BYTE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(get_gateway().jvm.org.apache.flink.streaming.api.typeinfo.python
-                               .PickledByteArrayTypeInfo.PICKLED_BYTE_ARRAY_TYPE_INFO)
+        return PickledBytesTypeInfo()
+
+    def get_java_type_info(self) -> JavaObject:
+        self._j_typeinfo = get_gateway().jvm.org.apache.flink.streaming.api.typeinfo.python\
+            .PickledByteArrayTypeInfo.PICKLED_BYTE_ARRAY_TYPE_INFO
+        return self._j_typeinfo
 
+    def __eq__(self, o: object) -> bool:
+        return isinstance(o, PickledBytesTypeInfo)
 
-class RowTypeInfo(WrapperTypeInfo):
+    def __repr__(self):
+        return "PickledByteArrayTypeInformation"
+
+
+class RowTypeInfo(TypeInformation):
     """
     TypeInformation for Row.
     """
 
     def __init__(self, types: List[TypeInformation], field_names: List[str] = None):
         self.types = types
         self.field_names = field_names
-        self.j_types_array = get_gateway().new_array(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.TypeInformation, len(types))
-        for i in range(len(types)):
-            wrapper_typeinfo = types[i]
-            if isinstance(wrapper_typeinfo, WrapperTypeInfo):
-                self.j_types_array[i] = wrapper_typeinfo.get_java_type_info()
-
-        if field_names is None:
-            self._j_typeinfo = get_gateway().jvm.org.apache.flink.api.java.typeutils.RowTypeInfo(
-                self.j_types_array)
-        else:
-            j_names_array = get_gateway().new_array(get_gateway().jvm.java.lang.String,
-                                                    len(field_names))
-            for i in range(len(field_names)):
-                j_names_array[i] = field_names[i]
-            self._j_typeinfo = get_gateway().jvm.org.apache.flink.api.java.typeutils.RowTypeInfo(
-                self.j_types_array, j_names_array)
-        self._need_conversion = [f.need_conversion() if isinstance(f, WrapperTypeInfo) else None
-                                 for f in types]
+        self._need_conversion = [f.need_conversion() if isinstance(f, TypeInformation) else None
+                                 for f in self.types]
         self._need_serialize_any_field = any(self._need_conversion)
-        super(RowTypeInfo, self).__init__(self._j_typeinfo)
+        super(RowTypeInfo, self).__init__()
 
     def get_field_names(self) -> List[str]:
-        j_field_names = self._j_typeinfo.getFieldNames()
-        field_names = [name for name in j_field_names]
-        return field_names
+        if not self.field_names:
+            j_field_names = self.get_java_type_info().getFieldNames()
+            self.field_names = [name for name in j_field_names]
+        return self.field_names
 
     def get_field_index(self, field_name: str) -> int:
-        return self._j_typeinfo.getFieldIndex(field_name)
+        if self.field_names:
+            return self.field_names.index(field_name)
+        return -1
 
     def get_field_types(self) -> List[TypeInformation]:
         return self.types
 
-    def __eq__(self, other) -> bool:
-        return self._j_typeinfo.equals(other._j_typeinfo)
+    def get_java_type_info(self) -> JavaObject:
+        if not self._j_typeinfo:
+            j_types_array = get_gateway()\
+                .new_array(get_gateway().jvm.org.apache.flink.api.common.typeinfo.TypeInformation,
+                           len(self.types))
+            for i in range(len(self.types)):
+                wrapper_typeinfo = self.types[i]

Review comment:
       `wrapper_typeinfo` -> `field_typeinfo`




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 21093e3501f0ece1b38302e4a86ebed9e7938c4e Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104) 
   * 2ea69af31eaafde2be7241f658399052c9e7af16 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 21093e3501f0ece1b38302e4a86ebed9e7938c4e Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * 8f14cd73606d83ac976b9e17934c645d13a32947 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971) Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] dianfu closed pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
dianfu closed pull request #14401:
URL: https://github.com/apache/flink/pull/14401


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8f14cd73606d83ac976b9e17934c645d13a32947 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971) Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924) 
   * 21093e3501f0ece1b38302e4a86ebed9e7938c4e UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199",
       "triggerID" : "749662559",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * 2ea69af31eaafde2be7241f658399052c9e7af16 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167) Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2ea69af31eaafde2be7241f658399052c9e7af16 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8f14cd73606d83ac976b9e17934c645d13a32947 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199",
       "triggerID" : "749662559",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "749662559",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * 2ea69af31eaafde2be7241f658399052c9e7af16 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199) Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8f14cd73606d83ac976b9e17934c645d13a32947 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * 8f14cd73606d83ac976b9e17934c645d13a32947 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971) Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] shuiqiangchen commented on a change in pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745935868


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 8f14cd73606d83ac976b9e17934c645d13a32947 (Wed Dec 16 08:50:55 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
    * **This pull request references an unassigned [Jira ticket](https://issues.apache.org/jira/browse/FLINK-20621).** According to the [code contribution guide](https://flink.apache.org/contributing/contribute-code.html), tickets need to be assigned before starting with the implementation work.
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199",
       "triggerID" : "749662559",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "2ea69af31eaafde2be7241f658399052c9e7af16",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167",
       "triggerID" : "749662559",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * 2ea69af31eaafde2be7241f658399052c9e7af16 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11199) Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11167) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "747157946",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104",
       "triggerID" : "21093e3501f0ece1b38302e4a86ebed9e7938c4e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8f14cd73606d83ac976b9e17934c645d13a32947 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10971) Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924) 
   * 21093e3501f0ece1b38302e4a86ebed9e7938c4e Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11104) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] dianfu commented on a change in pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
dianfu commented on a change in pull request #14401:
URL: https://github.com/apache/flink/pull/14401#discussion_r545551111



##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -91,66 +73,117 @@ def from_internal_type(self, obj):
         return obj
 
 
-class BasicTypeInfo(TypeInformation, ABC):
+class BasicTypes(Enum):
+    STRING = "String"
+    BYTE = "Byte"
+    BOOLEAN = "Boolean"
+    SHORT = "Short"
+    INT = "Integer"
+    LONG = "Long"
+    FLOAT = "Float"
+    DOUBLE = "Double"
+    CHAR = "Char"
+    BIG_INT = "BigInteger"
+    BIG_DEC = "BigDecimal"
+
+
+class BasicTypeInformation(TypeInformation, ABC):
     """
     Type information for primitive types (int, long, double, byte, ...), String, BigInteger,
     and BigDecimal.
     """
 
+    def __init__(self, basic_type: BasicTypes):
+        self._basic_type = basic_type
+        super(BasicTypeInformation, self).__init__()
+
+    def get_java_type_info(self) -> JavaObject:

Review comment:
       Could we refactor it a bit to make it more simple, e.g. introducing JBasicTypeInfo?
   ```
   JBasicTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo
   ```

##########
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:
       Why rename it?

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -484,17 +485,25 @@ def from_internal_type(self, v):
         if v is not None:
             return datetime.date.fromordinal(v + self.EPOCH_ORDINAL)
 
+    def get_java_type_info(self) -> JavaObject:
+        self._j_typeinfo = get_gateway().jvm\

Review comment:
       I guess it could be cached to avoid computed again if called multiple times?

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -48,30 +48,12 @@ class acts as the tool to generate serializers and comparators, and to perform s
     nested types).
     """
 
-
-class WrapperTypeInfo(TypeInformation):
-    """
-    A wrapper class for java TypeInformation Objects.
-    """
-
-    def __init__(self, j_typeinfo):
-        self._j_typeinfo = j_typeinfo
+    def __init__(self):
+        self._j_typeinfo = None
 
     def get_java_type_info(self) -> JavaObject:

Review comment:
       +1. I have the same feeling.

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -91,66 +73,117 @@ def from_internal_type(self, obj):
         return obj
 
 
-class BasicTypeInfo(TypeInformation, ABC):
+class BasicTypes(Enum):
+    STRING = "String"
+    BYTE = "Byte"
+    BOOLEAN = "Boolean"
+    SHORT = "Short"
+    INT = "Integer"
+    LONG = "Long"
+    FLOAT = "Float"
+    DOUBLE = "Double"
+    CHAR = "Char"
+    BIG_INT = "BigInteger"
+    BIG_DEC = "BigDecimal"
+
+
+class BasicTypeInformation(TypeInformation, ABC):

Review comment:
       Why rename it to BasicTypeInformation?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] dianfu commented on a change in pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
dianfu commented on a change in pull request #14401:
URL: https://github.com/apache/flink/pull/14401#discussion_r546606700



##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -91,296 +73,297 @@ def from_internal_type(self, obj):
         return obj
 
 
-class BasicTypeInfo(TypeInformation, ABC):
+class BasicType(Enum):
+    STRING = "String"
+    BYTE = "Byte"
+    BOOLEAN = "Boolean"
+    SHORT = "Short"
+    INT = "Integer"
+    LONG = "Long"
+    FLOAT = "Float"
+    DOUBLE = "Double"
+    CHAR = "Char"
+    BIG_INT = "BigInteger"
+    BIG_DEC = "BigDecimal"
+
+
+class BasicTypeInfo(TypeInformation):
     """
     Type information for primitive types (int, long, double, byte, ...), String, BigInteger,
     and BigDecimal.
     """
 
+    def __init__(self, basic_type: BasicType):
+        self._basic_type = basic_type
+        super(BasicTypeInfo, self).__init__()
+
+    def get_java_type_info(self) -> JavaObject:
+        JBasicTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo

Review comment:
       We can return self._j_typeinfo directly if it's not none.

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -518,15 +514,24 @@ def from_internal_type(self, t):
             hours, minutes = divmod(minutes, 60)
             return datetime.time(hours, minutes, seconds, microseconds)
 
+    def get_java_type_info(self) -> JavaObject:
+        if not self._j_typeinfo:
+            self._j_typeinfo = get_gateway().jvm\
+                .org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIME
+        return self._j_typeinfo
+
+    def __eq__(self, o: object) -> bool:
+        return isinstance(o, TimeTypeInfo)
+
+    def __repr__(self) -> str:
+        return "TimeTypeInformation"

Review comment:
       ```suggestion
           return "TimeTypeInfo"
   ```

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -91,296 +73,297 @@ def from_internal_type(self, obj):
         return obj
 
 
-class BasicTypeInfo(TypeInformation, ABC):
+class BasicType(Enum):
+    STRING = "String"
+    BYTE = "Byte"
+    BOOLEAN = "Boolean"
+    SHORT = "Short"
+    INT = "Integer"
+    LONG = "Long"
+    FLOAT = "Float"
+    DOUBLE = "Double"
+    CHAR = "Char"
+    BIG_INT = "BigInteger"
+    BIG_DEC = "BigDecimal"
+
+
+class BasicTypeInfo(TypeInformation):
     """
     Type information for primitive types (int, long, double, byte, ...), String, BigInteger,
     and BigDecimal.
     """
 
+    def __init__(self, basic_type: BasicType):
+        self._basic_type = basic_type
+        super(BasicTypeInfo, self).__init__()
+
+    def get_java_type_info(self) -> JavaObject:
+        JBasicTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo
+        if self._basic_type == BasicType.STRING:
+            self._j_typeinfo = JBasicTypeInfo.STRING_TYPE_INFO
+        elif self._basic_type == BasicType.BYTE:
+            self._j_typeinfo = JBasicTypeInfo.BYTE_TYPE_INFO
+        elif self._basic_type == BasicType.BOOLEAN:
+            self._j_typeinfo = JBasicTypeInfo.BOOLEAN_TYPE_INFO
+        elif self._basic_type == BasicType.SHORT:
+            self._j_typeinfo = JBasicTypeInfo.SHORT_TYPE_INFO
+        elif self._basic_type == BasicType.INT:
+            self._j_typeinfo = JBasicTypeInfo.INT_TYPE_INFO
+        elif self._basic_type == BasicType.LONG:
+            self._j_typeinfo = JBasicTypeInfo.LONG_TYPE_INFO
+        elif self._basic_type == BasicType.FLOAT:
+            self._j_typeinfo = JBasicTypeInfo.FLOAT_TYPE_INFO
+        elif self._basic_type == BasicType.DOUBLE:
+            self._j_typeinfo = JBasicTypeInfo.DOUBLE_TYPE_INFO
+        elif self._basic_type == BasicType.CHAR:
+            self._j_typeinfo = JBasicTypeInfo.CHAR_TYPE_INFO
+        elif self._basic_type == BasicType.BIG_INT:
+            self._j_typeinfo = JBasicTypeInfo.BIG_INT_TYPE_INFO
+        elif self._basic_type == BasicType.BIG_DEC:
+            self._j_typeinfo = JBasicTypeInfo.BIG_DEC_TYPE_INFO

Review comment:
       Raise an exception if _basic_type doesn't match any of the above?

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -484,17 +471,26 @@ def from_internal_type(self, v):
         if v is not None:
             return datetime.date.fromordinal(v + self.EPOCH_ORDINAL)
 
+    def get_java_type_info(self) -> JavaObject:
+        if not self._j_typeinfo:
+            self._j_typeinfo = get_gateway().jvm\
+                .org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.DATE
+        return self._j_typeinfo
+
+    def __eq__(self, o: object) -> bool:
+        return isinstance(o, DateTypeInfo)
+
+    def __repr__(self):
+        return "DateTypeInformation"

Review comment:
       ```suggestion
           return "DateTypeInfo"
   ```

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -602,57 +668,43 @@ def PRIMITIVE_ARRAY(element_type: TypeInformation):
         Returns type information for arrays of primitive type (such as byte[]). The array must not
         be null.
 
-        :param element_type element type of the array (e.g. Types.BOOLEAN(), Types.INT(),
+        :param element_type: element type of the array (e.g. Types.BOOLEAN(), Types.INT(),
         Types.DOUBLE())
         """
-        if element_type == Types.BOOLEAN():
-            return PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO()
-        elif element_type == Types.BYTE():
-            return PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO()
-        elif element_type == Types.SHORT():
-            return PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO()
-        elif element_type == Types.INT():
-            return PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO()
-        elif element_type == Types.LONG():
-            return PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO()
-        elif element_type == Types.FLOAT():
-            return PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO()
-        elif element_type == Types.DOUBLE():
-            return PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO()
-        elif element_type == Types.CHAR():
-            return PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO()
-        else:
-            raise TypeError("Invalid element type for a primitive array.")
+        return PrimitiveArrayTypeInfo(element_type)
 
     @staticmethod
     def BASIC_ARRAY(element_type: TypeInformation) -> TypeInformation:
         """
         Returns type information for arrays of boxed primitive type (such as Integer[]).
 
-        :param element_type element type of the array (e.g. Types.BOOLEAN(), Types.INT(),
+        :param element_type: element type of the array (e.g. Types.BOOLEAN(), Types.INT(),
         Types.DOUBLE())
         """
-        if element_type == Types.BOOLEAN():
-            return BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO()
-        elif element_type == Types.BYTE():
-            return BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO()
-        elif element_type == Types.SHORT():
-            return BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO()
-        elif element_type == Types.INT():
-            return BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO()
-        elif element_type == Types.LONG():
-            return BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO()
-        elif element_type == Types.FLOAT():
-            return BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO()
-        elif element_type == Types.DOUBLE():
-            return BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO()
-        elif element_type == Types.CHAR():
-            return BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO()
-        elif element_type == Types.STRING():
-            return BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO()
-        else:
-            raise TypeError("Invalid element type for a boxed primitive array: %s" %
-                            str(element_type))
+
+        return BasicArrayTypeInfo(element_type)
+
+    @staticmethod
+    def MAP(key_type_info: TypeInformation, value_type_info: TypeInformation) -> TypeInformation:
+        """
+        Special TypeInformation used by MapStateDescriptor
+
+        :param key_type_info: Element type of key (e.g. Types.BOOLEAN(), Types.INT(),
+                              Types.DOUBLE())
+        :param value_type_info: Element type of value (e.g. Types.BOOLEAN(), Types.INT(),
+                                Types.DOUBLE())
+        """
+        return MapTypeInfo(key_type_info, value_type_info)
+
+    @staticmethod
+    def LIST(element_type_info: TypeInformation) -> TypeInformation:
+        """
+        A TypeInformation for the list type.
+
+        :param element_type_info: The type of the elements in the list
+        :return:

Review comment:
       the return statement could be removed.

##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -91,296 +73,297 @@ def from_internal_type(self, obj):
         return obj
 
 
-class BasicTypeInfo(TypeInformation, ABC):
+class BasicType(Enum):
+    STRING = "String"
+    BYTE = "Byte"
+    BOOLEAN = "Boolean"
+    SHORT = "Short"
+    INT = "Integer"
+    LONG = "Long"
+    FLOAT = "Float"
+    DOUBLE = "Double"
+    CHAR = "Char"
+    BIG_INT = "BigInteger"
+    BIG_DEC = "BigDecimal"
+
+
+class BasicTypeInfo(TypeInformation):
     """
     Type information for primitive types (int, long, double, byte, ...), String, BigInteger,
     and BigDecimal.
     """
 
+    def __init__(self, basic_type: BasicType):
+        self._basic_type = basic_type
+        super(BasicTypeInfo, self).__init__()
+
+    def get_java_type_info(self) -> JavaObject:
+        JBasicTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo
+        if self._basic_type == BasicType.STRING:
+            self._j_typeinfo = JBasicTypeInfo.STRING_TYPE_INFO
+        elif self._basic_type == BasicType.BYTE:
+            self._j_typeinfo = JBasicTypeInfo.BYTE_TYPE_INFO
+        elif self._basic_type == BasicType.BOOLEAN:
+            self._j_typeinfo = JBasicTypeInfo.BOOLEAN_TYPE_INFO
+        elif self._basic_type == BasicType.SHORT:
+            self._j_typeinfo = JBasicTypeInfo.SHORT_TYPE_INFO
+        elif self._basic_type == BasicType.INT:
+            self._j_typeinfo = JBasicTypeInfo.INT_TYPE_INFO
+        elif self._basic_type == BasicType.LONG:
+            self._j_typeinfo = JBasicTypeInfo.LONG_TYPE_INFO
+        elif self._basic_type == BasicType.FLOAT:
+            self._j_typeinfo = JBasicTypeInfo.FLOAT_TYPE_INFO
+        elif self._basic_type == BasicType.DOUBLE:
+            self._j_typeinfo = JBasicTypeInfo.DOUBLE_TYPE_INFO
+        elif self._basic_type == BasicType.CHAR:
+            self._j_typeinfo = JBasicTypeInfo.CHAR_TYPE_INFO
+        elif self._basic_type == BasicType.BIG_INT:
+            self._j_typeinfo = JBasicTypeInfo.BIG_INT_TYPE_INFO
+        elif self._basic_type == BasicType.BIG_DEC:
+            self._j_typeinfo = JBasicTypeInfo.BIG_DEC_TYPE_INFO
+        return self._j_typeinfo
+
+    def __eq__(self, o) -> bool:
+        if isinstance(o, BasicTypeInfo):
+            return self._basic_type == o._basic_type
+        return False
+
+    def __repr__(self):
+        return self._basic_type.value
+
     @staticmethod
     def STRING_TYPE_INFO():
-        return WrapperTypeInfo(get_gateway().jvm
-                               .org.apache.flink.api.common.typeinfo.BasicTypeInfo.STRING_TYPE_INFO)
+        return BasicTypeInfo(BasicType.STRING)
 
     @staticmethod
     def BOOLEAN_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo.BOOLEAN_TYPE_INFO)
+        return BasicTypeInfo(BasicType.BOOLEAN)
 
     @staticmethod
     def BYTE_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo.BYTE_TYPE_INFO)
+        return BasicTypeInfo(BasicType.BYTE)
 
     @staticmethod
     def SHORT_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo.SHORT_TYPE_INFO)
+        return BasicTypeInfo(BasicType.SHORT)
 
     @staticmethod
     def INT_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo.INT_TYPE_INFO)
+        return BasicTypeInfo(BasicType.INT)
 
     @staticmethod
     def LONG_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo.LONG_TYPE_INFO)
+        return BasicTypeInfo(BasicType.LONG)
 
     @staticmethod
     def FLOAT_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo.FLOAT_TYPE_INFO)
+        return BasicTypeInfo(BasicType.FLOAT)
 
     @staticmethod
     def DOUBLE_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo.DOUBLE_TYPE_INFO)
+        return BasicTypeInfo(BasicType.DOUBLE)
 
     @staticmethod
     def CHAR_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo.CHAR_TYPE_INFO)
+        return BasicTypeInfo(BasicType.CHAR)
 
     @staticmethod
     def BIG_INT_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo.BIG_INT_TYPE_INFO)
+        return BasicTypeInfo(BasicType.BIG_INT)
 
     @staticmethod
     def BIG_DEC_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.BasicTypeInfo.BIG_DEC_TYPE_INFO)
+        return BasicTypeInfo(BasicType.BIG_DEC)
 
 
-class SqlTimeTypeInfo(TypeInformation, ABC):
+class SqlTimeTypeInfo(TypeInformation):
     """
     SqlTimeTypeInfo enables users to get Sql Time TypeInfo.
     """
 
     @staticmethod
     def DATE():
-        return DateTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.DATE)
+        return DateTypeInfo()
 
     @staticmethod
     def TIME():
-        return TimeTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIME)
+        return TimeTypeInfo()
 
     @staticmethod
     def TIMESTAMP():
-        return TimestampTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo.SqlTimeTypeInfo.TIMESTAMP)
+        return TimestampTypeInfo()
 
 
-class PrimitiveArrayTypeInfo(WrapperTypeInfo, ABC):
+class PrimitiveArrayTypeInfo(TypeInformation):
     """
     A TypeInformation for arrays of primitive types (int, long, double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
 
-    @staticmethod
-    def BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def BYTE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(PrimitiveArrayTypeInfo, self).__init__()
 
-    @staticmethod
-    def SHORT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def INT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        if not self._j_typeinfo:
+            JPrimitiveArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+                .PrimitiveArrayTypeInfo
+            if self._element_type == Types.BOOLEAN():
+                self._j_typeinfo = JPrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO
+            elif self._element_type == Types.BYTE():
+                self._j_typeinfo = JPrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO
+            elif self._element_type == Types.SHORT():
+                self._j_typeinfo = JPrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO
+            elif self._element_type == Types.INT():
+                self._j_typeinfo = JPrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO
+            elif self._element_type == Types.LONG():
+                self._j_typeinfo = JPrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO
+            elif self._element_type == Types.FLOAT():
+                self._j_typeinfo = JPrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO
+            elif self._element_type == Types.DOUBLE():
+                self._j_typeinfo = JPrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO
+            elif self._element_type == Types.CHAR():
+                self._j_typeinfo = JPrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO
+            else:
+                raise TypeError("Invalid element type for a primitive array.")
+        return self._j_typeinfo
 
-    @staticmethod
-    def LONG_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, PrimitiveArrayTypeInfo):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def FLOAT_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO)
+    def __repr__(self) -> str:
+        return "PrimitiveArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def CHAR_PRIMITIVE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO)
-
-
-def is_primitive_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO(),
-        PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO()
-    }
-
-
-class BasicArrayTypeInfo(WrapperTypeInfo, ABC):
+class BasicArrayTypeInfo(TypeInformation):
     """
     A TypeInformation for arrays of boxed primitive types (Integer, Long, Double, ...).
     Supports the creation of dedicated efficient serializers for these types.
     """
-    @staticmethod
-    def BOOLEAN_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO)
-
-    @staticmethod
-    def BYTE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def SHORT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO)
+    def __init__(self, element_type: TypeInformation):
+        self._element_type = element_type
+        super(BasicArrayTypeInfo, self).__init__()
 
-    @staticmethod
-    def INT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        if not self._j_typeinfo:
+            JBasicArrayTypeInfo = get_gateway().jvm.org.apache.flink.api.common.typeinfo \
+                .BasicArrayTypeInfo
+            if self._element_type == Types.BOOLEAN():
+                self._j_typeinfo = JBasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO
+            elif self._element_type == Types.BYTE():
+                self._j_typeinfo = JBasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO
+            elif self._element_type == Types.SHORT():
+                self._j_typeinfo = JBasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO
+            elif self._element_type == Types.INT():
+                self._j_typeinfo = JBasicArrayTypeInfo.INT_ARRAY_TYPE_INFO
+            elif self._element_type == Types.LONG():
+                self._j_typeinfo = JBasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO
+            elif self._element_type == Types.FLOAT():
+                self._j_typeinfo = JBasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO
+            elif self._element_type == Types.DOUBLE():
+                self._j_typeinfo = JBasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO
+            elif self._element_type == Types.CHAR():
+                self._j_typeinfo = JBasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO
+            elif self._element_type == Types.STRING():
+                self._j_typeinfo = JBasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO
+            else:
+                raise TypeError("Invalid element type for a primitive array.")
 
-    @staticmethod
-    def LONG_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO)
+        return self._j_typeinfo
 
-    @staticmethod
-    def FLOAT_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO)
+    def __eq__(self, o) -> bool:
+        if isinstance(o, BasicArrayTypeInfo):
+            return self._element_type == o._element_type
+        return False
 
-    @staticmethod
-    def DOUBLE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO)
+    def __repr__(self):
+        return "BasicArrayTypeInformation<%s>" % self._element_type
 
-    @staticmethod
-    def CHAR_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO)
 
-    @staticmethod
-    def STRING_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(
-            get_gateway().jvm.org.apache.flink.api.common.typeinfo
-            .BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO)
-
-
-def is_basic_array_type_info(type_info: TypeInformation):
-    return type_info in {
-        BasicArrayTypeInfo.BOOLEAN_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.BYTE_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.SHORT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.INT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.LONG_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.FLOAT_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.DOUBLE_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.CHAR_ARRAY_TYPE_INFO(),
-        BasicArrayTypeInfo.STRING_ARRAY_TYPE_INFO()
-    }
-
-
-class PickledBytesTypeInfo(WrapperTypeInfo, ABC):
+class PickledBytesTypeInfo(TypeInformation):
     """
     A PickledBytesTypeInfo indicates the data is a primitive byte array generated by pickle
     serializer.
     """
 
-    @staticmethod
-    def PICKLED_BYTE_ARRAY_TYPE_INFO():
-        return WrapperTypeInfo(get_gateway().jvm.org.apache.flink.streaming.api.typeinfo.python
-                               .PickledByteArrayTypeInfo.PICKLED_BYTE_ARRAY_TYPE_INFO)
+    def get_java_type_info(self) -> JavaObject:
+        if not self._j_typeinfo:
+            self._j_typeinfo = get_gateway().jvm.org.apache.flink.streaming.api.typeinfo.python\
+                .PickledByteArrayTypeInfo.PICKLED_BYTE_ARRAY_TYPE_INFO
+        return self._j_typeinfo
+
+    def __eq__(self, o: object) -> bool:
+        return isinstance(o, PickledBytesTypeInfo)
 
+    def __repr__(self):
+        return "PickledByteArrayTypeInformation"

Review comment:
       ```suggestion
           return "PickledBytesTypeInfo"
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14401: [FLINK-20621][python] Refactor the TypeInformation implementation in Python DataStream API.

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14401:
URL: https://github.com/apache/flink/pull/14401#issuecomment-745968134


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924",
       "triggerID" : "8f14cd73606d83ac976b9e17934c645d13a32947",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8f14cd73606d83ac976b9e17934c645d13a32947 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=10924) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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:
users@infra.apache.org