This is an automated email from the ASF dual-hosted git repository. dianfu pushed a commit to branch release-1.13 in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.13 by this push: new 70f7e2d [hotfix][docs] Improve the documentation about the data types supported in Python DataStream API 70f7e2d is described below commit 70f7e2d0a5b31ad60fdb49dc023333330192e0d6 Author: Dian Fu <dia...@apache.org> AuthorDate: Wed Jun 23 19:21:03 2021 +0800 [hotfix][docs] Improve the documentation about the data types supported in Python DataStream API --- .../docs/dev/python/datastream/data_types.md | 62 ++++++++++++++++------ .../docs/dev/python/datastream/data_types.md | 62 ++++++++++++++++------ 2 files changed, 90 insertions(+), 34 deletions(-) diff --git a/docs/content.zh/docs/dev/python/datastream/data_types.md b/docs/content.zh/docs/dev/python/datastream/data_types.md index 54109e6..8adfd40 100644 --- a/docs/content.zh/docs/dev/python/datastream/data_types.md +++ b/docs/content.zh/docs/dev/python/datastream/data_types.md @@ -94,22 +94,50 @@ Explicit types allow PyFlink to use efficient serializers when moving records th ## Supported Data Types -You can use `pyflink.common.typeinfo.Types` to specify types in Python DataStream API. -The table below shows the type supported now and how to define them: +You can use `pyflink.common.typeinfo.Types` to define types in Python DataStream API. +The table below shows the types supported now and how to define them: -| PyFlink Type | Usage | Corresponding Python Type | +| PyFlink Type | Python Type | Java Type | |:-----------------|:-----------------------|:-----------------------| -| `BOOLEAN` | `Types.BOOLEAN()` | `bool` | -| `SHORT` | `Types.SHORT()` | `int` | -| `INT` | `Types.INT()` | `int` | -| `LONG` | `Types.LONG()` | `int` | -| `FLOAT` | `Types.FLOAT()` | `float` | -| `DOUBLE` | `Types.DOUBLE()` | `float` | -| `CHAR` | `Types.CHAR()` | `str` | -| `BIG_INT` | `Types.BIG_INT()` | `bytes` | -| `BIG_DEC` | `Types.BIG_DEC()` | `decimal.Decimal` | -| `STRING` | `Types.STRING()` | `str` | -| `BYTE` | `Types.BYTE()` | `int` | -| `TUPLE` | `Types.TUPLE()` | `tuple` | -| `PRIMITIVE_ARRAY` | `Types.PRIMITIVE_ARRAY()` | `list` | -| `ROW` | `Types.ROW()` | `dict` | +|`Types.BOOLEAN()` | `bool` | `java.lang.Boolean` | +|`Types.BYTE()` | `int` | `java.lang.Byte` | +|`Types.SHORT()` | `int` | `java.lang.Short` | +|`Types.INT()` | `int` | `java.lang.Integer` | +|`Types.LONG()` | `int` | `java.lang.Long` | +|`Types.FLOAT()` | `float` | `java.lang.Float` | +|`Types.DOUBLE()` | `float` | `java.lang.Double` | +|`Types.CHAR()` | `str` | `java.lang.Character` | +|`Types.STRING()` | `str` | `java.lang.String` | +|`Types.BIG_INT()` | `int` | `java.math.BigInteger` | +|`Types.BIG_DEC()` | `decimal.Decimal` | `java.math.BigDecimal` | +|`Types.TUPLE()` | `tuple` | `org.apache.flink.api.java.tuple.Tuple0` ~ `org.apache.flink.api.java.tuple.Tuple25` | +|`Types.ROW()` | `pyflink.common.Row` | `org.apache.flink.types.Row` | +|`Types.ROW_NAMED()` | `pyflink.common.Row` | `org.apache.flink.types.Row` | +|`Types.MAP()` | `dict` | `java.util.Map` | +|`Types.PICKLED_BYTE_ARRAY()` | `The actual unpickled Python object` | `byte[]` | +|`Types.SQL_DATE()` | `datetime.date` | `java.sql.Date` | +|`Types.SQL_TIME()` | `datetime.time` | `java.sql.Time` | +|`Types.SQL_TIMESTAMP()` | `datetime.datetime` | `java.sql.Timestamp` | +|`Types.LIST()` | `list of Python object` | `java.util.List` | + +The table below shows the array types supported: + +| PyFlink Array Type | Python Type | Java Type | +|:-----------------|:-----------------------|:-----------------------| +|`Types.PRIMITIVE_ARRAY(Types.BYTE())` | `bytes` | `byte[]` | +|`Types.PRIMITIVE_ARRAY(Types.BOOLEAN())` | `list of bool` | `boolean[]` | +|`Types.PRIMITIVE_ARRAY(Types.SHORT())` | `list of int` | `short[]` | +|`Types.PRIMITIVE_ARRAY(Types.INT())` | `list of int` | `int[]` | +|`Types.PRIMITIVE_ARRAY(Types.LONG())` | `list of int` | `long[]` | +|`Types.PRIMITIVE_ARRAY(Types.FLOAT())` | `list of float` | `float[]` | +|`Types.PRIMITIVE_ARRAY(Types.DOUBLE())` | `list of float` | `double[]` | +|`Types.PRIMITIVE_ARRAY(Types.CHAR())` | `list of str` | `char[]` | +|`Types.BASIC_ARRAY(Types.BYTE())` | `list of int` | `java.lang.Byte[]` | +|`Types.BASIC_ARRAY(Types.BOOLEAN())` | `list of bool` | `java.lang.Boolean[]` | +|`Types.BASIC_ARRAY(Types.SHORT())` | `list of int` | `java.lang.Short[]` | +|`Types.BASIC_ARRAY(Types.INT())` | `list of int` | `java.lang.Integer[]` | +|`Types.BASIC_ARRAY(Types.LONG())` | `list of int` | `java.lang.Long[]` | +|`Types.BASIC_ARRAY(Types.FLOAT())` | `list of float` | `java.lang.Float[]` | +|`Types.BASIC_ARRAY(Types.DOUBLE())` | `list of float` | `java.lang.Double[]` | +|`Types.BASIC_ARRAY(Types.CHAR())` | `list of str` | `java.lang.Character[]` | +|`Types.BASIC_ARRAY(Types.STRING())` | `list of str` | `java.lang.String[]` | diff --git a/docs/content/docs/dev/python/datastream/data_types.md b/docs/content/docs/dev/python/datastream/data_types.md index be0b683..35d0340 100644 --- a/docs/content/docs/dev/python/datastream/data_types.md +++ b/docs/content/docs/dev/python/datastream/data_types.md @@ -94,22 +94,50 @@ Explicit types allow PyFlink to use efficient serializers when moving records th ## Supported Data Types -You can use `pyflink.common.typeinfo.Types` to specify types in Python DataStream API. -The table below shows the type supported now and how to define them: +You can use `pyflink.common.typeinfo.Types` to define types in Python DataStream API. +The table below shows the types supported now and how to define them: -| PyFlink Type | Usage | Corresponding Python Type | +| PyFlink Type | Python Type | Java Type | |:-----------------|:-----------------------|:-----------------------| -| `BOOLEAN` | `Types.BOOLEAN()` | `bool` | -| `SHORT` | `Types.SHORT()` | `int` | -| `INT` | `Types.INT()` | `int` | -| `LONG` | `Types.LONG()` | `int` | -| `FLOAT` | `Types.FLOAT()` | `float` | -| `DOUBLE` | `Types.DOUBLE()` | `float` | -| `CHAR` | `Types.CHAR()` | `str` | -| `BIG_INT` | `Types.BIG_INT()` | `bytes` | -| `BIG_DEC` | `Types.BIG_DEC()` | `decimal.Decimal` | -| `STRING` | `Types.STRING()` | `str` | -| `BYTE` | `Types.BYTE()` | `int` | -| `TUPLE` | `Types.TUPLE()` | `tuple` | -| `PRIMITIVE_ARRAY` | `Types.PRIMITIVE_ARRAY()` | `list` | -| `ROW` | `Types.ROW()` | `dict` | +|`Types.BOOLEAN()` | `bool` | `java.lang.Boolean` | +|`Types.BYTE()` | `int` | `java.lang.Byte` | +|`Types.SHORT()` | `int` | `java.lang.Short` | +|`Types.INT()` | `int` | `java.lang.Integer` | +|`Types.LONG()` | `int` | `java.lang.Long` | +|`Types.FLOAT()` | `float` | `java.lang.Float` | +|`Types.DOUBLE()` | `float` | `java.lang.Double` | +|`Types.CHAR()` | `str` | `java.lang.Character` | +|`Types.STRING()` | `str` | `java.lang.String` | +|`Types.BIG_INT()` | `int` | `java.math.BigInteger` | +|`Types.BIG_DEC()` | `decimal.Decimal` | `java.math.BigDecimal` | +|`Types.TUPLE()` | `tuple` | `org.apache.flink.api.java.tuple.Tuple0` ~ `org.apache.flink.api.java.tuple.Tuple25` | +|`Types.ROW()` | `pyflink.common.Row` | `org.apache.flink.types.Row` | +|`Types.ROW_NAMED()` | `pyflink.common.Row` | `org.apache.flink.types.Row` | +|`Types.MAP()` | `dict` | `java.util.Map` | +|`Types.PICKLED_BYTE_ARRAY()` | `The actual unpickled Python object` | `byte[]` | +|`Types.SQL_DATE()` | `datetime.date` | `java.sql.Date` | +|`Types.SQL_TIME()` | `datetime.time` | `java.sql.Time` | +|`Types.SQL_TIMESTAMP()` | `datetime.datetime` | `java.sql.Timestamp` | +|`Types.LIST()` | `list of Python object` | `java.util.List` | + +The table below shows the array types supported: + +| PyFlink Array Type | Python Type | Java Type | +|:-----------------|:-----------------------|:-----------------------| +|`Types.PRIMITIVE_ARRAY(Types.BYTE())` | `bytes` | `byte[]` | +|`Types.PRIMITIVE_ARRAY(Types.BOOLEAN())` | `list of bool` | `boolean[]` | +|`Types.PRIMITIVE_ARRAY(Types.SHORT())` | `list of int` | `short[]` | +|`Types.PRIMITIVE_ARRAY(Types.INT())` | `list of int` | `int[]` | +|`Types.PRIMITIVE_ARRAY(Types.LONG())` | `list of int` | `long[]` | +|`Types.PRIMITIVE_ARRAY(Types.FLOAT())` | `list of float` | `float[]` | +|`Types.PRIMITIVE_ARRAY(Types.DOUBLE())` | `list of float` | `double[]` | +|`Types.PRIMITIVE_ARRAY(Types.CHAR())` | `list of str` | `char[]` | +|`Types.BASIC_ARRAY(Types.BYTE())` | `list of int` | `java.lang.Byte[]` | +|`Types.BASIC_ARRAY(Types.BOOLEAN())` | `list of bool` | `java.lang.Boolean[]` | +|`Types.BASIC_ARRAY(Types.SHORT())` | `list of int` | `java.lang.Short[]` | +|`Types.BASIC_ARRAY(Types.INT())` | `list of int` | `java.lang.Integer[]` | +|`Types.BASIC_ARRAY(Types.LONG())` | `list of int` | `java.lang.Long[]` | +|`Types.BASIC_ARRAY(Types.FLOAT())` | `list of float` | `java.lang.Float[]` | +|`Types.BASIC_ARRAY(Types.DOUBLE())` | `list of float` | `java.lang.Double[]` | +|`Types.BASIC_ARRAY(Types.CHAR())` | `list of str` | `java.lang.Character[]` | +|`Types.BASIC_ARRAY(Types.STRING())` | `list of str` | `java.lang.String[]` |