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



##########
File path: flink-python/pyflink/common/typeinfo.py
##########
@@ -0,0 +1,523 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
+from abc import ABC, abstractmethod
+
+from py4j.java_gateway import JavaClass, JavaObject
+from typing import List, Union
+
+from pyflink.java_gateway import get_gateway
+
+
+class TypeInformation(ABC):
+    """
+    TypeInformation is the core class of Flink's type system. FLink requires a 
type information
+    for all types that are used as input or return type of a user function. 
This type information
+    class acts as the tool to generate serializers and comparators, and to 
perform semantic checks
+    such as whether the fields that are used as join/grouping keys actually 
exist.
+
+    The type information also bridges between the programming languages object 
model and a logical
+    flat schema. It maps fields from the types to columns (fields) in a flat 
schema. Not all fields
+    from a type are mapped to a separate fields in the flat schema and often, 
entire types are
+    mapped to one field.. It is important to notice that the schema must hold 
for all instances of a
+    type. For that reason, elements in lists and arrays are not assigned to 
individual fields, but
+    the lists and arrays are considered to be one field in total, to account 
for different lengths
+    in the arrays.
+        a) Basic types are indivisible and are considered as a single field.
+        b) Arrays and collections are one field.
+        c) Tuples represents as many fields as the class has fields.
+    To represent this properly, each type has an arity (the number of fields 
it contains directly),
+    and a total number of fields (number of fields in the entire schema of 
this type, including
+    nested types).
+    """
+
+    @abstractmethod
+    def is_basic_type(self) -> bool:
+        """
+        Checks if this type information represents a basic type.
+        Basic types are defined in BasicTypeInfo and are primitives, their 
boxing type, Strings ...
+
+        :return:  True, if this type information describes a basic type, false 
otherwise.
+        """
+        pass
+
+    @abstractmethod
+    def is_tuple_type(self) -> bool:
+        """
+        Checks if this type information represents a Tuple type.
+
+        :return: True, if this type information describes a tuple type, false 
otherwise.
+        """
+        pass
+
+    @abstractmethod
+    def get_arity(self) -> int:
+        """
+        Gets the arity of this type - the number of fields without nesting.
+
+        :return: the number of fields in this type without nesting.
+        """
+        pass
+
+    @abstractmethod
+    def get_total_fields(self) -> int:
+        """
+        Gets the number of logical fields in this type. This includes its 
nested and transitively
+        nested fields, in the case of composite types.
+        The total number of fields must be at lest 1.
+
+        :return: The number of fields in this type, including its sub-fields 
(for composite types).
+        """
+        pass

Review comment:
       Agree, I will remove them.




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


Reply via email to