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 42f9d6e [hotfix][python][docs] Add documentation to remind users to
bundle Python UDF definitions when submitting the job
42f9d6e is described below
commit 42f9d6ee8f5ce2f39ce56dcab872aef852cbb871
Author: Yik San Chan <[email protected]>
AuthorDate: Wed Apr 28 08:13:45 2021 +0800
[hotfix][python][docs] Add documentation to remind users to bundle Python
UDF definitions when submitting the job
This closes #15790.
---
docs/content.zh/docs/dev/python/table/udfs/python_udfs.md | 5 +++++
docs/content/docs/dev/python/table/udfs/python_udfs.md | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/docs/content.zh/docs/dev/python/table/udfs/python_udfs.md
b/docs/content.zh/docs/dev/python/table/udfs/python_udfs.md
index cbcdc3e..e9f9217 100644
--- a/docs/content.zh/docs/dev/python/table/udfs/python_udfs.md
+++ b/docs/content.zh/docs/dev/python/table/udfs/python_udfs.md
@@ -553,3 +553,8 @@ class
ListViewConcatTableAggregateFunction(TableAggregateFunction):
def get_result_type(self):
return DataTypes.ROW([DataTypes.FIELD("a", DataTypes.STRING())])
```
+
+## 打包 UDFs
+
+如果你在非 local 模式下运行 Python UDFs 和 Pandas UDFs,且 Python UDFs 没有定义在含 `main()` 入口的
Python 主文件中,强烈建议你通过 [`python-files`]({{< ref "docs/dev/python/python_config"
>}}#python-files) 配置项指定 Python UDF 的定义。
+否则,如果你将 Python UDFs 定义在名为 `my_udf.py` 的文件中,你可能会遇到 `ModuleNotFoundError: No
module named 'my_udf'` 这样的报错。
diff --git a/docs/content/docs/dev/python/table/udfs/python_udfs.md
b/docs/content/docs/dev/python/table/udfs/python_udfs.md
index f8ab4a1..95504d8 100644
--- a/docs/content/docs/dev/python/table/udfs/python_udfs.md
+++ b/docs/content/docs/dev/python/table/udfs/python_udfs.md
@@ -552,3 +552,8 @@ class
ListViewConcatTableAggregateFunction(TableAggregateFunction):
def get_result_type(self):
return DataTypes.ROW([DataTypes.FIELD("a", DataTypes.STRING())])
```
+
+## Bundling UDFs
+
+To run Python UDFs (as well as Pandas UDFs) in any non-local mode, it is
strongly recommended to bundle your Python UDF definitions using the config
option [`python-files`]({{< ref "docs/dev/python/python_config"
>}}#python-files), if your Python UDFs live outside of the file where the
`main()` function is defined.
+Otherwise, you may run into `ModuleNotFoundError: No module named 'my_udf'` if
you define Python UDFs in a file called `my_udf.py`.