You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by di...@apache.org on 2020/07/17 12:27:07 UTC

[flink] branch master updated: [FLINK-17285][python][doc-zh] Translate "Python Table API" page into Chinese

This is an automated email from the ASF dual-hosted git repository.

dianfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 4a77f6a  [FLINK-17285][python][doc-zh] Translate "Python Table API" page into Chinese
4a77f6a is described below

commit 4a77f6af60e10141b439886ef89a2da1243675a2
Author: billyrrr <bi...@me.com>
AuthorDate: Tue Jul 14 13:57:25 2020 -0700

    [FLINK-17285][python][doc-zh] Translate "Python Table API" page into Chinese
    
    This closes #12901.
---
 docs/dev/table/python/common_questions.md    |   2 +-
 docs/dev/table/python/common_questions.zh.md |  43 +++++----
 docs/dev/table/python/index.zh.md            |  17 ++--
 docs/dev/table/python/installation.zh.md     |   8 +-
 docs/dev/table/python/python_udfs.zh.md      | 131 +++++++++++++--------------
 5 files changed, 98 insertions(+), 103 deletions(-)

diff --git a/docs/dev/table/python/common_questions.md b/docs/dev/table/python/common_questions.md
index de6c75e..89e55a9 100644
--- a/docs/dev/table/python/common_questions.md
+++ b/docs/dev/table/python/common_questions.md
@@ -30,7 +30,7 @@ This page describes the solutions to some common questions for PyFlink users.
 ## Preparing Python Virtual Environment
 
 You can download a [convenience script]({{ site.baseurl }}/downloads/setup-pyflink-virtual-env.sh) to prepare a Python virtual env zip which can be used on Mac OS and most Linux distributions.
-You can specify the version parameter to generate a Python virtual environment required for the corresponding PyFlink version, otherwise the most recent version will be installed.
+You can specify the PyFlink version to generate a Python virtual environment required for the corresponding PyFlink version, otherwise the most recent version will be installed.
 
 {% highlight bash %}
 {% if site.is_stable %}
diff --git a/docs/dev/table/python/common_questions.zh.md b/docs/dev/table/python/common_questions.zh.md
index 3821c21..49ff2d0 100644
--- a/docs/dev/table/python/common_questions.zh.md
+++ b/docs/dev/table/python/common_questions.zh.md
@@ -22,15 +22,15 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-This page describes the solutions to some common questions for PyFlink users.
+本页介绍了针对PyFlink用户的一些常见问题的解决方案。
 
 * This will be replaced by the TOC
 {:toc}
 
-## Preparing Python Virtual Environment
+## 准备Python虚拟环境
 
-You can download a [convenience script]({{ site.baseurl }}/downloads/setup-pyflink-virtual-env.sh) to prepare a Python virtual env zip which can be used on Mac OS and most Linux distributions.
-You can specify the version parameter to generate a Python virtual environment required for the corresponding PyFlink version, otherwise the most recent version will be installed.
+您可以下载[便捷脚本]({{ site.baseurl }}/downloads/setup-pyflink-virtual-env.sh),以准备可在Mac OS和大多数Linux发行版上使用的Python虚拟环境包(virtual env zip)。
+您可以指定PyFlink的版本,来生成对应的PyFlink版本所需的Python虚拟环境,否则将安装最新版本的PyFlink所对应的Python虚拟环境。
 
 {% highlight bash %}
 {% if site.is_stable %}
@@ -40,11 +40,10 @@ $ sh setup-pyflink-virtual-env.sh
 {% endif %}
 {% endhighlight bash %}
 
-## Execute PyFlink jobs with Python virtual environment
+## 使用Python虚拟环境执行PyFlink任务
+在设置了[python虚拟环境](#准备python虚拟环境)之后(如上一节所述),您应该在执行PyFlink作业之前激活虚拟环境。
 
-After setting up a [python virtual environment](#preparing-python-virtual-environment), as described in the previous section, you should activate the environment before executing the PyFlink job.
-
-#### Local
+#### 本地(Local)
 
 {% highlight shell %}
 # activate the conda python virtual environment
@@ -52,35 +51,35 @@ $ source venv/bin/activate
 $ python xxx.py
 {% endhighlight %}
 
-#### Cluster
+#### 集群(Cluster)
 
 {% highlight shell %}
-$ # specify the Python virtual environment
+$ # 指定Python虚拟环境
 $ table_env.add_python_archive("venv.zip")
-$ # specify the path of the python interpreter which is used to execute the python UDF workers
+$ # 指定用于执行python UDF workers (用户自定义函数工作者) 的python解释器的路径
 $ table_env.get_config().set_python_executable("venv.zip/venv/bin/python")
 {% endhighlight %}
 
-For details on the usage of `add_python_archive` and `set_python_executable`, you can refer to [the relevant documentation]({{ site.baseurl }}/zh/dev/table/python/dependency_management.html#usage).
+如果需要了解`add_python_archive`和`set_python_executable`用法的详细信息,请参阅[相关文档]({{ site.baseurl }}/zh/dev/table/python/dependency_management.html#usage)。
 
-## Adding Jar Files
+## 添加Jar文件
 
-A PyFlink job may depend on jar files, i.e. connectors, Java UDFs, etc.
-You can specify the dependencies with the following Python Table APIs or through <a href="{{ site.baseurl }}/zh/ops/cli.html#usage">command-line arguments</a> directly when submitting the job.
+PyFlink作业可能依赖jar文件,比如connector,Java UDF等。
+您可以在提交作业时使用以下Python Table API或通过<a href="{{ site.baseurl }}/zh/ops/cli.html#usage">命令行参数</a>来指定依赖项。
 
 {% highlight python %}
-# NOTE: Only local file URLs (start with "file:") are supported.
+# 注意:仅支持本地文件URL(以"file:"开头)。
 table_env.get_config().get_configuration().set_string("pipeline.jars", "file:///my/jar/path/connector.jar;file:///my/jar/path/udf.jar")
 
-# NOTE: The Paths must specify a protocol (e.g. "file") and users should ensure that the URLs are accessible on both the client and the cluster.
+# 注意:路径必须指定协议(例如:文件——"file"),并且用户应确保在客户端和群集上都可以访问这些URL。
 table_env.get_config().get_configuration().set_string("pipeline.classpaths", "file:///my/jar/path/connector.jar;file:///my/jar/path/udf.jar")
 {% endhighlight %}
 
-For details about the APIs of adding Java dependency, you can refer to [the relevant documentation]({{ site.baseurl }}/zh/dev/table/python/dependency_management.html##java-dependency)
+有关添加Java依赖项的API的详细信息,请参阅[相关文档]({{ site.baseurl }}/zh/dev/table/python/dependency_management.html##java-dependency)。
 
-## Adding Python Files
-You can use the command-line arguments `pyfs` or the API `add_python_file` of `TableEnvironment` to add python file dependencies which could be python files, python packages or local directories.
-For example, if you have a directory named `myDir` which has the following hierarchy:
+## 添加Python文件
+您可以使用命令行参数`pyfs`或TableEnvironment的API `add_python_file`添加python文件依赖,这些依赖可以是python文件,python软件包或本地目录。
+例如,如果您有一个名为`myDir`的目录,该目录具有以下层次结构:
 
 ```
 myDir
@@ -89,7 +88,7 @@ myDir
     ├──my_util.py
 ```
 
-You can add the Python files of directory `myDir` as following:
+您可以将添加目录`myDir`添加到Python依赖中,如下所示:
 
 {% highlight python %}
 table_env.add_python_file('myDir')
diff --git a/docs/dev/table/python/index.zh.md b/docs/dev/table/python/index.zh.md
index 6c3a0bd..cb1031d 100644
--- a/docs/dev/table/python/index.zh.md
+++ b/docs/dev/table/python/index.zh.md
@@ -24,15 +24,16 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-Python Table API allows users to develop [Table API]({{ site.baseurl }}/zh/dev/table/tableApi.html) programs using the Python language.
-Apache Flink has provided Python Table API support since 1.9.0.
+Python Table API允许用户使用Python语言开发[Table API]({{ site.baseurl }}/zh/dev/table/tableApi.html)程序。
+
+自1.9.0起,Apache Flink就提供了Python Table API支持。
 
 ## Where to go next?
 
-- [环境安装]({{ site.baseurl }}/zh/dev/table/python/installation.html): Introduction of how to set up the Python Table API execution environment.
-- [自定义函数]({{ site.baseurl }}/zh/dev/table/python/python_udfs.html): Explanation of how to define Python user-defined functions.
-- [自定义向量化函数]({{ site.baseurl }}/zh/dev/table/python/vectorized_python_udfs.html): Explanation of how to define vectorized Python user-defined functions.
-- [PyFlink Table 和 Pandas DataFrame 互转]({{ site.baseurl }}/zh/dev/table/python/conversion_of_pandas.html): Explanation of how to convert between PyFlink Table and Pandas DataFrame.
-- [依赖管理]({{ site.baseurl }}/zh/dev/table/python/dependency_management.html): Specification of how to use third-part dependencies in a Python Table API program.
-- [配置]({{ site.baseurl }}/zh/dev/table/python/python_config.html): Description of the config options available for Python Table API programs.
+- [环境安装]({{ site.baseurl }}/zh/dev/table/python/installation.html): 介绍了如何设置Python Table API的执行环境。
+- [自定义函数]({{ site.baseurl }}/zh/dev/table/python/python_udfs.html): 有关如何定义Python用户自定义函数的说明。
+- [自定义向量化函数]({{ site.baseurl }}/zh/dev/table/python/vectorized_python_udfs.html): 有关如何定义向量化Python用户自定义函数的说明。
+- [PyFlink Table 和 Pandas DataFrame 互转]({{ site.baseurl }}/zh/dev/table/python/conversion_of_pandas.html): 介绍了PyFlink Table和Pandas DataFrame之间如何互转。
+- [依赖管理]({{ site.baseurl }}/zh/dev/table/python/dependency_management.html): 在Python Table API作业中如何使用第三方依赖。
+- [配置]({{ site.baseurl }}/zh/dev/table/python/python_config.html): 描述了Python Table API程序的配置项。
 - [常见问题]({{ site.baseurl }}/zh/dev/table/python/common_questions.html)
diff --git a/docs/dev/table/python/installation.zh.md b/docs/dev/table/python/installation.zh.md
index 6e4e45f..ab37885 100644
--- a/docs/dev/table/python/installation.zh.md
+++ b/docs/dev/table/python/installation.zh.md
@@ -26,7 +26,7 @@ under the License.
 {:toc}
 
 ## 环境要求
-<span class="label label-info">注意</span> PyFlink 需要特定的Python 版本(3.5, 3.6 或 3.7)。请运行如下的命令确保版本满足要求。
+<span class="label label-info">注意</span> PyFlink需要特定的Python版本(3.5, 3.6 或 3.7)。请运行以下命令,以确保Python版本满足要求。
 
 {% highlight bash %}
 $ python --version
@@ -35,12 +35,12 @@ $ python --version
 
 ## PyFlink 安装
 
-PyFlink 已经被部署到 PyPi,可以按如下方式安装:
+PyFlink已经被发布到PyPi,可以通过如下方式安装PyFlink:
 
 {% highlight bash %}
 $ python -m pip install apache-flink
 {% endhighlight %}
 
-你也可以从源码手动构建 PyFlink,具体可以参见[开发指南]({{ site.baseurl }}/zh/flinkDev/building.html#build-pyflink).
+您也可以从源码手动构建PyFlink,具体可以参见[开发指南]({{ site.baseurl }}/zh/flinkDev/building.html#build-pyflink).
 
-<span class="label label-info">注意</span> 从 Flink 1.11 版本开始, PyFlink 作业可以支持在 Windows 系统上本地运行,因此你也可以在 Windows 上开发和调试 PyFlink 作业了。
+<span class="label label-info">注意</span> 从Flink 1.11版本开始, PyFlink作业支持在Windows系统上运行,因此您也可以在Windows上开发和调试PyFlink作业了。
diff --git a/docs/dev/table/python/python_udfs.zh.md b/docs/dev/table/python/python_udfs.zh.md
index c1618fb..456280e 100644
--- a/docs/dev/table/python/python_udfs.zh.md
+++ b/docs/dev/table/python/python_udfs.zh.md
@@ -1,5 +1,5 @@
 ---
-title: "自定义函数"
+title: "自定义函数(UDF)"
 nav-parent_id: python_tableapi
 nav-pos: 20
 ---
@@ -22,21 +22,20 @@ specific language governing permissions and limitations
 under the License.
 -->
 
-User-defined functions are important features, because they significantly extend the expressiveness of Python Table API programs.
+用户自定义函数是重要的功能,因为它们极大地扩展了Python Table API程序的表达能力。
 
-**NOTE:** Python UDF execution requires Python version (3.5, 3.6 or 3.7) with PyFlink installed. It's required on both the client side and the cluster side.
+**注意:** 要执行Python用户自定义函数,客户端和集群端都需要安装Python版本3.5、3.6或3.7,并安装PyFlink。
 
 * This will be replaced by the TOC
 {:toc}
 
-## Scalar Functions
-It supports to use Python scalar functions in Python Table API programs. In order to define a Python scalar function,
-one can extend the base class `ScalarFunction` in `pyflink.table.udf` and implement an evaluation method.
-The behavior of a Python scalar function is defined by the evaluation method which is named `eval`.
-The evaluation method can support variable arguments, such as `eval(*args)`.
+## 标量函数(ScalarFunction)
 
-The following example shows how to define your own Python hash code function, register it in the TableEnvironment, and call it in a query.
-Note that you can configure your scalar function via a constructor before it is registered:
+PyFlink支持在Python Table API程序中使用Python标量函数。 如果要定义Python标量函数,
+可以继承`pyflink.table.udf`中的基类ScalarFunction,并实现eval方法。
+Python标量函数的行为由名为`eval`的方法定义,eval方法支持可变长参数,例如`eval(* args)`。
+
+以下示例显示了如何定义自己的Python哈希函数、如何在TableEnvironment中注册它以及如何在作业中使用它。
 
 {% highlight python %}
 class HashCode(ScalarFunction):
@@ -48,30 +47,30 @@ class HashCode(ScalarFunction):
 
 table_env = BatchTableEnvironment.create(env)
 
-# configure the off-heap memory of current taskmanager to enable the python worker uses off-heap memory.
+# Python worker进程默认使用off-heap内存,配置当前taskmanager的off-heap内存大小
 table_env.get_config().get_configuration().set_string("taskmanager.memory.task.off-heap.size", '80m')
 
-# register the Python function
+# 注册Python自定义函数
 table_env.register_function("hash_code", udf(HashCode(), result_type=DataTypes.BIGINT()))
 
-# use the Python function in Python Table API
+# 在Python Table API中使用Python自定义函数
 my_table.select("string, bigint, bigint.hash_code(), hash_code(bigint)")
 
-# use the Python function in SQL API
+# 在SQL API中使用Python自定义函数
 table_env.sql_query("SELECT string, bigint, hash_code(bigint) FROM MyTable")
 {% endhighlight %}
 
-<span class="label label-info">Note</span> If not using RocksDB as state backend, you can also configure the python
-worker to use the managed memory of taskmanager by setting **python.fn-execution.memory.managed** to be **true**.
-Then there is no need to set the the configuration **taskmanager.memory.task.off-heap.size**.
+<span class="label label-info">注意</span>当前不支持Python worker进程与RocksDB state backend同时使用managed memory。
+如果作业中不使用RocksDB state backend的话, 您也可以将配置项**python.fn-execution.memory.managed**设置为**true**,
+配置Python worker进程使用managed memory。这样的话,就不需要配置**taskmanager.memory.task.off-heap.size**了。
 
-It also supports to use Java/Scala scalar functions in Python Table API programs.
+除此之外,还支持在Python Table API程序中使用Java / Scala标量函数。
 
 {% highlight python %}
 '''
 Java code:
 
-// The Java class must have a public no-argument constructor and can be founded in current Java classloader.
+// Java类必须具有公共的无参数构造函数,并且可以在当前的Java类加载器中可以加载到。
 public class HashCode extends ScalarFunction {
   private int factor = 12;
 
@@ -83,70 +82,66 @@ public class HashCode extends ScalarFunction {
 
 table_env = BatchTableEnvironment.create(env)
 
-# configure the off-heap memory of current taskmanager to enable the python worker uses off-heap memory.
+# Python worker进程默认使用off-heap内存,配置当前taskmanager的off-heap内存大小
 table_env.get_config().get_configuration().set_string("taskmanager.memory.task.off-heap.size", '80m')
 
-# register the Java function
+# 注册Java函数
 table_env.register_java_function("hash_code", "my.java.function.HashCode")
 
-# use the Java function in Python Table API
+# 在Python Table API中使用Java函数
 my_table.select("string.hash_code(), hash_code(string)")
 
-# use the Java function in SQL API
+# 在SQL API中使用Java函数
 table_env.sql_query("SELECT string, bigint, hash_code(string) FROM MyTable")
 {% endhighlight %}
 
-<span class="label label-info">Note</span> If not using RocksDB as state backend, you can also configure the python
-worker to use the managed memory of taskmanager by setting **python.fn-execution.memory.managed** to be **true**.
-Then there is no need to set the the configuration **taskmanager.memory.task.off-heap.size**.
+<span class="label label-info">注意</span>当前不支持Python worker进程与RocksDB state backend同时使用managed memory。
+如果作业中不使用RocksDB state backend的话, 您也可以将配置项**python.fn-execution.memory.managed**设置为**true**,
+配置Python worker进程使用managed memory。这样的话,就不需要配置**taskmanager.memory.task.off-heap.size**了。
 
-There are many ways to define a Python scalar function besides extending the base class `ScalarFunction`.
-The following examples show the different ways to define a Python scalar function which takes two columns of
-bigint as the input parameters and returns the sum of them as the result.
+除了扩展基类`ScalarFunction`之外,还支持多种方式来定义Python标量函数。
+以下示例显示了多种定义Python标量函数的方式。该函数需要两个类型为bigint的参数作为输入参数,并返回它们的总和作为结果。
 
 {% highlight python %}
-# option 1: extending the base class `ScalarFunction`
+# 方式一:扩展基类`ScalarFunction`
 class Add(ScalarFunction):
   def eval(self, i, j):
     return i + j
 
 add = udf(Add(), result_type=DataTypes.BIGINT())
 
-# option 2: Python function
+# 方式二:普通Python函数
 @udf(result_type=DataTypes.BIGINT())
 def add(i, j):
   return i + j
 
-# option 3: lambda function
+# 方式三:lambda函数
 add = udf(lambda i, j: i + j, result_type=DataTypes.BIGINT())
 
-# option 4: callable function
+# 方式四:callable函数
 class CallableAdd(object):
   def __call__(self, i, j):
     return i + j
 
 add = udf(CallableAdd(), result_type=DataTypes.BIGINT())
 
-# option 5: partial function
+# 方式五:partial函数
 def partial_add(i, j, k):
   return i + j + k
 
 add = udf(functools.partial(partial_add, k=1), result_type=DataTypes.BIGINT())
 
-# register the Python function
+# 注册Python自定义函数
 table_env.register_function("add", add)
-# use the function in Python Table API
+# 在Python Table API中使用Python自定义函数
 my_table.select("add(a, b)")
 {% endhighlight %}
 
-## Table Functions
-Similar to a Python user-defined scalar function, a user-defined table function takes zero, one, or 
-multiple scalar values as input parameters. However in contrast to a scalar function, it can return 
-an arbitrary number of rows as output instead of a single value. The return type of a Python UDTF 
-could be of types Iterable, Iterator or generator.
+## 表值函数
+与Python用户自定义标量函数类似,Python用户自定义表值函数以零个,一个或者多个列作为输入参数。但是,与标量函数不同的是,表值函数可以返回
+任意数量的行作为输出而不是单个值。Python用户自定义表值函数的返回类型可以是Iterable,Iterator或generator类型。
 
-The following example shows how to define your own Python multi emit function, register it in the 
-TableEnvironment, and call it in a query.
+以下示例说明了如何定义自己的Python自定义表值函数,将其注册到TableEnvironment中,并在作业中使用它。
 
 {% highlight python %}
 class Split(TableFunction):
@@ -158,33 +153,33 @@ env = StreamExecutionEnvironment.get_execution_environment()
 table_env = StreamTableEnvironment.create(env)
 my_table = ...  # type: Table, table schema: [a: String]
 
-# configure the off-heap memory of current taskmanager to enable the python worker uses off-heap memory.
+# Python worker进程默认使用off-heap内存,配置当前taskmanager的off-heap内存大小
 table_env.get_config().get_configuration().set_string("taskmanager.memory.task.off-heap.size", '80m')
 
-# register the Python Table Function
+# 注册Python表值函数
 table_env.register_function("split", udtf(Split(), result_types=[DataTypes.STRING(), DataTypes.INT()]))
 
-# use the Python Table Function in Python Table API
+# 在Python Table API中使用Python表值函数
 my_table.join_lateral("split(a) as (word, length)")
 my_table.left_outer_join_lateral("split(a) as (word, length)")
 
-# use the Python Table function in SQL API
+# 在SQL API中使用Python表值函数
 table_env.sql_query("SELECT a, word, length FROM MyTable, LATERAL TABLE(split(a)) as T(word, length)")
 table_env.sql_query("SELECT a, word, length FROM MyTable LEFT JOIN LATERAL TABLE(split(a)) as T(word, length) ON TRUE")
 
 {% endhighlight %}
 
-<span class="label label-info">Note</span> If not using RocksDB as state backend, you can also configure the python
-worker to use the managed memory of taskmanager by setting **python.fn-execution.memory.managed** to be **true**.
-Then there is no need to set the the configuration **taskmanager.memory.task.off-heap.size**.
+<span class="label label-info">注意</span>当前不支持Python worker进程与RocksDB state backend同时使用managed memory。
+如果作业中不使用RocksDB state backend的话, 您也可以将配置项**python.fn-execution.memory.managed**设置为**true**,
+配置Python worker进程使用managed memory。这样的话,就不需要配置**taskmanager.memory.task.off-heap.size**了。
 
-It also supports to use Java/Scala table functions in Python Table API programs.
+除此之外,还支持在Python Table API程序中使用Java / Scala表值函数。
 {% highlight python %}
 '''
 Java code:
 
-// The generic type "Tuple2<String, Integer>" determines the schema of the returned table as (String, Integer).
-// The java class must have a public no-argument constructor and can be founded in current java classloader.
+// 类型"Tuple2 <String,Integer>"代表,表值函数的输出类型为(String,Integer)。
+// Java类必须具有公共的无参数构造函数,并且可以在当前的Java类加载器中加载到。
 public class Split extends TableFunction<Tuple2<String, Integer>> {
     private String separator = " ";
     
@@ -201,46 +196,46 @@ env = StreamExecutionEnvironment.get_execution_environment()
 table_env = StreamTableEnvironment.create(env)
 my_table = ...  # type: Table, table schema: [a: String]
 
-# configure the off-heap memory of current taskmanager to enable the python worker uses off-heap memory.
+# Python worker进程默认使用off-heap内存,配置当前taskmanager的off-heap内存大小
 table_env.get_config().get_configuration().set_string("taskmanager.memory.task.off-heap.size", '80m')
 
-# Register the java function.
+# 注册java自定义函数。
 table_env.register_java_function("split", "my.java.function.Split")
 
-# Use the table function in the Python Table API. "as" specifies the field names of the table.
+# 在Python Table API中使用表值函数。 "as"指定表的字段名称。
 my_table.join_lateral("split(a) as (word, length)").select("a, word, length")
 my_table.left_outer_join_lateral("split(a) as (word, length)").select("a, word, length")
 
-# Register the python function.
+# 注册python函数。
 
-# Use the table function in SQL with LATERAL and TABLE keywords.
-# CROSS JOIN a table function (equivalent to "join" in Table API).
+# 在SQL中将table函数与LATERAL和TABLE关键字一起使用。
+# CROSS JOIN表值函数(等效于Table API中的"join")。
 table_env.sql_query("SELECT a, word, length FROM MyTable, LATERAL TABLE(split(a)) as T(word, length)")
-# LEFT JOIN a table function (equivalent to "left_outer_join" in Table API).
+# LEFT JOIN一个表值函数(等同于Table API中的"left_outer_join")。
 table_env.sql_query("SELECT a, word, length FROM MyTable LEFT JOIN LATERAL TABLE(split(a)) as T(word, length) ON TRUE")
 {% endhighlight %}
 
-<span class="label label-info">Note</span> If not using RocksDB as state backend, you can also configure the python
-worker to use the managed memory of taskmanager by setting **python.fn-execution.memory.managed** to be **true**.
-Then there is no need to set the the configuration **taskmanager.memory.task.off-heap.size**.
+<span class="label label-info">注意</span>当前不支持Python worker进程与RocksDB state backend同时使用managed memory。
+如果作业中不使用RocksDB state backend的话, 您也可以将配置项**python.fn-execution.memory.managed**设置为**true**,
+配置Python worker进程使用managed memory。这样的话,就不需要配置**taskmanager.memory.task.off-heap.size**了。
 
-Like Python scalar functions, you can use the above five ways to define Python TableFunctions.
+像Python标量函数一样,您可以使用上述五种方式来定义Python表值函数。
 
-<span class="label label-info">Note</span> The only difference is that the return type of Python Table Functions needs to be an iterable, iterator or generator.
+<span class="label label-info">注意</span> 唯一的区别是,Python表值函数的返回类型必须是iterable(可迭代子类), iterator(迭代器) or generator(生成器)。
 
 {% highlight python %}
-# option 1: generator function
+# 方式一:生成器函数
 @udtf(result_types=DataTypes.BIGINT())
 def generator_func(x):
       yield 1
       yield 2
 
-# option 2: return iterator
+# 方式二:返回迭代器
 @udtf(result_types=DataTypes.BIGINT())
 def iterator_func(x):
       return range(5)
 
-# option 3: return iterable
+# 方式三:返回可迭代子类
 @udtf(result_types=DataTypes.BIGINT())
 def iterable_func(x):
       result = [1, 2, 3]