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/08/10 03:08:58 UTC

[GitHub] [flink] WeiZhong94 commented on a change in pull request #13084: [FLINK-18847][docs][python] Add documentation about data types in Python Table API

WeiZhong94 commented on a change in pull request #13084:
URL: https://github.com/apache/flink/pull/13084#discussion_r466900408



##########
File path: docs/dev/table/python/python_types.md
##########
@@ -0,0 +1,74 @@
+---
+title: "Python Data Types"
+nav-parent_id: python_tableapi
+nav-pos: 15
+---
+<!--
+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.
+-->
+
+This page describes the data types supported in PyFlink Table API.
+
+* This will be replaced by the TOC
+{:toc}
+
+Data Type
+---------
+
+A *data type* describes the logical type of a value in the table ecosystem. It can be used to declare input and/or
+output types of Python user-defined functions. Users of the Python Table API work with instances of
+`pyflink.table.types.DataType` within the Python Table API or when defining user-defined functions.
+
+A `DataType` instance declares the **logical type** which does not imply a concrete physical representation for transmission
+or storage. All pre-defined data types are available in `pyflink.table.types` and can be instantiated with the utility methods
+defined in `pyflink.table.types.DataTypes`.
+
+A list of all pre-defined data types can be found [below]({{ site.baseurl }}/dev/table/types.html#list-of-data-types).
+
+Data Type and Python type mapping

Review comment:
       Capitalize the first letter?

##########
File path: docs/dev/table/types.zh.md
##########
@@ -397,6 +438,21 @@ DataTypes.DECIMAL(p, s)
 |`java.math.BigDecimal`                    | X     | X      | *缺省*               |
 |`org.apache.flink.table.data.DecimalData` | X     | X      | 内部数据结构。 |
 
+</div>
+
+<div data-lang="Python" markdown="1">
+{% highlight python %}
+DataTypes.DECIMAL(p, s)
+{% endhighlight %}
+
+<span class="label label-danger">注意</span> 当前,声明`DataTypes.DECIMAL(p, s)`中的所指定的精度 `p` 必须为38,尾数 `n` 必须为 `18`。

Review comment:
       38 -> \`38\`?

##########
File path: docs/dev/table/types.zh.md
##########
@@ -698,6 +797,21 @@ DataTypes.TIMESTAMP(p)
 |`java.sql.Timestamp`                        | X     | X      |                                   |
 |`org.apache.flink.table.data.TimestampData` | X     | X      | 内部数据结构。                      |
 
+</div>
+
+<div data-lang="Python" markdown="1">
+{% highlight python %}
+DataTypes.TIMESTAMP(p)
+{% endhighlight %}
+
+<span class="label label-danger">注意</span> 当前,声明`DataTypes.TIMESTAMP(p)`中的所指定的精度 `p` 必须为3。

Review comment:
       ditto

##########
File path: docs/dev/table/types.zh.md
##########
@@ -656,6 +749,19 @@ DataTypes.TIME(p)
 |`java.lang.Long`      | X     | X      | 描述自当天以来的纳秒数。     |
 |`long`                | X     | (X)    | 描述自当天以来的纳秒数。<br>仅当类型不可为空时才输出。 |
 
+</div>
+
+<div data-lang="Python" markdown="1">
+{% highlight python %}
+DataTypes.TIME(p)
+{% endhighlight %}
+
+<span class="label label-danger">注意</span> 当前,声明`DataTypes.TIME(p)`中的所指定的精度 `p` 必须为0。

Review comment:
       0 -> \`0\`?




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