auroflow commented on code in PR #28843:
URL: https://github.com/apache/flink/pull/28843#discussion_r3694830179


##########
flink-python/pyflink/dataframe/datatype.py:
##########
@@ -81,5 +189,260 @@ def string(cls) -> "DataType":
         """
         return cls(DataTypes.STRING())
 
+    @classmethod
+    @PublicEvolving()
+    def fixed_size_string(cls, length: int) -> "DataType":
+        """
+        Create a fixed-length character string type.
+
+        :param length: Number of characters.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(DataTypes.CHAR(length))
+
+    @classmethod
+    @PublicEvolving()
+    def binary(cls) -> "DataType":
+        """
+        Create a variable-length binary string type.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(DataTypes.BYTES())
+
+    @classmethod
+    @PublicEvolving()
+    def fixed_size_binary(cls, length: int) -> "DataType":
+        """
+        Create a fixed-length binary string type.
+
+        :param length: Number of bytes.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(DataTypes.BINARY(length))
+
+    @classmethod
+    @PublicEvolving()
+    def bool(cls) -> "DataType":
+        """
+        Create a boolean type.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(DataTypes.BOOLEAN())
+
+    @classmethod
+    @PublicEvolving()
+    def null(cls) -> "DataType":
+        """
+        Create a null type.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(DataTypes.NULL())
+
+    @classmethod
+    @PublicEvolving()
+    def date(cls) -> "DataType":
+        """
+        Create a date type.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(DataTypes.DATE())
+
+    @classmethod
+    @PublicEvolving()
+    def time(cls, precision: int = 0) -> "DataType":
+        """
+        Create a time type.
+
+        :param precision: Number of fractional-second digits.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(DataTypes.TIME(precision))
+
+    @classmethod
+    @PublicEvolving()
+    def timestamp(cls, precision: int = 6) -> "DataType":
+        """
+        Create a timestamp type without a time zone.
+
+        :param precision: Number of fractional-second digits.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(DataTypes.TIMESTAMP(precision))
+
+    @classmethod
+    @PublicEvolving()
+    def timestamp_ltz(cls, precision: int = 6) -> "DataType":
+        """
+        Create a timestamp type with a local time zone.
+
+        :param precision: Number of fractional-second digits.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(DataTypes.TIMESTAMP_LTZ(precision))
+
+    @classmethod
+    @PublicEvolving()
+    def list(cls, dtype: "DataType") -> "DataType":
+        """
+        Create a list type.
+
+        :param dtype: Type of each list element.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(DataTypes.ARRAY(dtype._to_table_data_type()))
+
+    @classmethod
+    @PublicEvolving()
+    def map(cls, key_type: "DataType", value_type: "DataType") -> "DataType":
+        """
+        Create a map type.
+
+        :param key_type: Type of each map key.
+        :param value_type: Type of each map value.
+
+        .. versionadded:: 2.4.0
+        """
+        return cls(
+            DataTypes.MAP(
+                key_type._to_table_data_type(),
+                value_type._to_table_data_type(),
+            )
+        )
+
+    @classmethod
+    @PublicEvolving()
+    def struct(
+        cls,
+        fields: Union[
+            Dict[str, "DataType"],
+            List[Tuple[str, "DataType"]],
+        ],
+    ) -> "DataType":
+        """
+        Create a struct type with named fields.
+
+        ``fields`` may be an insertion-ordered dictionary or a list of name 
and type pairs.
+
+        :param fields: Field names and their data types.
+
+        Example::
+
+            >>> import pyflink.dataframe as pf
+            >>> person_type = pf.DataType.struct({
+            ...     "name": pf.DataType.string(),
+            ...     "age": pf.DataType.int32(),

Review Comment:
   Added.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to