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/05/22 14:06:51 UTC

[flink] branch release-1.11 updated: [FLINK-17876][python][docs] Add documentation on how to use Python UDF in SQL DDL

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

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


The following commit(s) were added to refs/heads/release-1.11 by this push:
     new aa536e1  [FLINK-17876][python][docs] Add documentation on how to use Python UDF in SQL DDL
aa536e1 is described below

commit aa536e172b074c2ebe2ccaba5ba5afd6ef76d940
Author: acqua.csq <ac...@alibaba-inc.com>
AuthorDate: Fri May 22 19:43:26 2020 +0800

    [FLINK-17876][python][docs] Add documentation on how to use Python UDF in SQL DDL
    
    This closes #12295.
---
 docs/dev/table/sql/alter.md     | 12 ++++++++----
 docs/dev/table/sql/alter.zh.md  | 12 ++++++++----
 docs/dev/table/sql/create.md    | 12 ++++++++----
 docs/dev/table/sql/create.zh.md | 12 ++++++++----
 4 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/docs/dev/table/sql/alter.md b/docs/dev/table/sql/alter.md
index 4cba082..82ae467 100644
--- a/docs/dev/table/sql/alter.md
+++ b/docs/dev/table/sql/alter.md
@@ -142,10 +142,14 @@ Set one or more properties in the specified database. If a particular property i
 {% highlight sql%}
 ALTER [TEMPORARY|TEMPORARY SYSTEM] FUNCTION 
   [IF EXISTS] [catalog_name.][db_name.]function_name 
-  AS identifier [LANGUAGE JAVA|SCALA|
+  AS identifier [LANGUAGE JAVA|SCALA|PYTHON]
 {% endhighlight %}
 
-Alter a catalog function with the new identifier which is full classpath for JAVA/SCALA and optional language tag. If a function doesn't exist in the catalog, an exception is thrown.
+Alter a catalog function with the new identifier and optional language tag. If a function doesn't exist in the catalog, an exception is thrown.
+
+If the language tag is JAVA/SCALA, the identifier is the full classpath of the UDF. For the implementation of Java/Scala UDF, please refer to [User-defined Functions]({{ site.baseurl }}/dev/table/functions/udfs.html) for more details.
+
+If the language tag is PYTHON, the identifier is the fully qualified name of the UDF, e.g. `pyflink.table.tests.test_udf.add`. For the implementation of Python UDF, please refer to [Python UDFs]({{ site.baseurl }}/dev/table/python/python_udfs.html) for more details.
 
 **TEMPORARY**
 
@@ -159,7 +163,7 @@ Alter temporary system function that has no namespace and overrides built-in fun
 
 If the function doesn't exist, nothing happens.
 
-**LANGUAGE JAVA\|SCALA**
+**LANGUAGE JAVA\|SCALA\|PYTHON**
 
-Language tag to instruct flink runtime how to execute the function. Currently only JAVA and SCALA are supported, the default language for a function is JAVA.
+Language tag to instruct flink runtime how to execute the function. Currently only JAVA, SCALA and PYTHON are supported, the default language for a function is JAVA.
 
diff --git a/docs/dev/table/sql/alter.zh.md b/docs/dev/table/sql/alter.zh.md
index def2862..16e4cda 100644
--- a/docs/dev/table/sql/alter.zh.md
+++ b/docs/dev/table/sql/alter.zh.md
@@ -142,10 +142,14 @@ ALTER DATABASE [catalog_name.]db_name SET (key1=val1, key2=val2, ...)
 {% highlight sql%}
 ALTER [TEMPORARY|TEMPORARY SYSTEM] FUNCTION
   [IF EXISTS] [catalog_name.][db_name.]function_name
-  AS identifier [LANGUAGE JAVA|SCALA|
+  AS identifier [LANGUAGE JAVA|SCALA|PYTHON]
 {% endhighlight %}
 
-修改一个有 catalog 和数据库命名空间的 catalog function ,其需要指定 JAVA / SCALA 或其他 language tag 完整的 classpath。若函数不存在,删除会抛出异常。
+修改一个有 catalog 和数据库命名空间的 catalog function ,需要指定一个新的 identifier ,可指定 language tag 。若函数不存在,删除会抛出异常。
+
+如果 language tag 是 JAVA 或者 SCALA ,则 identifier 是 UDF 实现类的全限定名。关于 JAVA/SCALA UDF 的实现,请参考 [自定义函数]({{ site.baseurl }}/zh/dev/table/functions/udfs.html)。
+
+如果 language tag 是 PYTHON , 则 identifier 是 UDF 对象的全限定名,例如 `pyflink.table.tests.test_udf.add`。关于 PYTHON UDF 的实现,请参考 [Python UDFs]({{ site.baseurl }}/zh/dev/table/python/python_udfs.html)。
 
 **TEMPORARY**
 
@@ -159,6 +163,6 @@ ALTER [TEMPORARY|TEMPORARY SYSTEM] FUNCTION
 
 若函数不存在,则不进行任何操作。
 
-**LANGUAGE JAVA\|SCALA**
+**LANGUAGE JAVA\|SCALA\|PYTHON**
 
-Language tag 用于指定 Flink runtime 如何执行这个函数。目前,只支持 JAVA 和 SCALA,且函数的默认语言为 JAVA。
\ No newline at end of file
+Language tag 用于指定 Flink runtime 如何执行这个函数。目前,只支持 JAVA,SCALA 和 PYTHON,且函数的默认语言为 JAVA。
diff --git a/docs/dev/table/sql/create.md b/docs/dev/table/sql/create.md
index e44e2bc..458f67e 100644
--- a/docs/dev/table/sql/create.md
+++ b/docs/dev/table/sql/create.md
@@ -253,10 +253,14 @@ The key and value of expression `key1=val1` should both be string literal.
 {% highlight sql%}
 CREATE [TEMPORARY|TEMPORARY SYSTEM] FUNCTION 
   [IF NOT EXISTS] [catalog_name.][db_name.]function_name 
-  AS identifier [LANGUAGE JAVA|SCALA]
+  AS identifier [LANGUAGE JAVA|SCALA|PYTHON]
 {% endhighlight %}
 
-Create a catalog function that has catalog and database namespaces with the identifier which is full classpath for JAVA/SCALA and optional language tag. If a function with the same name already exists in the catalog, an exception is thrown.
+Create a catalog function that has catalog and database namespaces with the identifier and optional language tag. If a function with the same name already exists in the catalog, an exception is thrown.
+
+If the language tag is JAVA/SCALA, the identifier is the full classpath of the UDF. For the implementation of Java/Scala UDF, please refer to [User-defined Functions]({{ site.baseurl }}/dev/table/functions/udfs.html) for more details.
+
+If the language tag is PYTHON, the identifier is the fully qualified name of the UDF, e.g. `pyflink.table.tests.test_udf.add`. For the implementation of Python UDF, please refer to [Python UDFs]({{ site.baseurl }}/dev/table/python/python_udfs.html) for more details.
 
 **TEMPORARY**
 
@@ -270,6 +274,6 @@ Create temporary system function that has no namespace and overrides built-in fu
 
 If the function already exists, nothing happens.
 
-**LANGUAGE JAVA\|SCALA**
+**LANGUAGE JAVA\|SCALA\|PYTHON**
 
-Language tag to instruct Flink runtime how to execute the function. Currently only JAVA and SCALA are supported, the default language for a function is JAVA.
+Language tag to instruct Flink runtime how to execute the function. Currently only JAVA, SCALA and PYTHON are supported, the default language for a function is JAVA. 
diff --git a/docs/dev/table/sql/create.zh.md b/docs/dev/table/sql/create.zh.md
index 5c6099a..eb01abe 100644
--- a/docs/dev/table/sql/create.zh.md
+++ b/docs/dev/table/sql/create.zh.md
@@ -253,10 +253,14 @@ CREATE DATABASE [IF NOT EXISTS] [catalog_name.]db_name
 {% highlight sql%}
 CREATE [TEMPORARY|TEMPORARY SYSTEM] FUNCTION
   [IF NOT EXISTS] [[catalog_name.]db_name.]function_name
-  AS identifier [LANGUAGE JAVA|SCALA]
+  AS identifier [LANGUAGE JAVA|SCALA|PYTHON]
 {% endhighlight %}
 
-创建一个有 catalog 和数据库命名空间的 catalog function ,其需要指定 JAVA / SCALA 或其他 language tag 完整的 classpath。 若 catalog 中,已经有同名的函数注册了,则无法注册。
+创建一个有 catalog 和数据库命名空间的 catalog function ,需要指定一个 identifier ,可指定 language tag 。 若 catalog 中,已经有同名的函数注册了,则无法注册。
+
+如果 language tag 是 JAVA 或者 SCALA ,则 identifier 是 UDF 实现类的全限定名。关于 JAVA/SCALA UDF 的实现,请参考 [自定义函数]({{ site.baseurl }}/zh/dev/table/functions/udfs.html)。
+
+如果 language tag 是 PYTHON ,则 identifier 是 UDF 对象的全限定名,例如 `pyflink.table.tests.test_udf.add`。关于 PYTHON UDF 的实现,请参考 [Python UDFs]({{ site.baseurl }}/zh/dev/table/python/python_udfs.html)。
 
 **TEMPORARY**
 
@@ -270,7 +274,7 @@ CREATE [TEMPORARY|TEMPORARY SYSTEM] FUNCTION
 
 若该函数已经存在,则不会进行任何操作。
 
-**LANGUAGE JAVA\|SCALA**
+**LANGUAGE JAVA\|SCALA\|PYTHON**
 
-Language tag 用于指定 Flink runtime 如何执行这个函数。目前,只支持 JAVA 和 SCALA,且函数的默认语言为 JAVA。
+Language tag 用于指定 Flink runtime 如何执行这个函数。目前,只支持 JAVA, SCALA 和 PYTHON,且函数的默认语言为 JAVA。