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

luzhijing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 888b22b38a4 [doc](java-udf)update udf static load in custom_lib (#687)
888b22b38a4 is described below

commit 888b22b38a4d9d83e467aa971e346977cbbc9a40
Author: slothever <18522955+w...@users.noreply.github.com>
AuthorDate: Wed May 29 20:53:44 2024 +0800

    [doc](java-udf)update udf static load in custom_lib (#687)
    
    update doc for https://github.com/apache/doris/pull/34990
---
 docs/query/udf/java-user-defined-function.md       | 34 +++++++++++++++-------
 .../query/udf/java-user-defined-function.md        | 34 +++++++++++++++-------
 .../query/udf/java-user-defined-function.md        | 34 +++++++++++++++-------
 .../query/udf/java-user-defined-function.md        | 34 +++++++++++++++-------
 4 files changed, 92 insertions(+), 44 deletions(-)

diff --git a/docs/query/udf/java-user-defined-function.md 
b/docs/query/udf/java-user-defined-function.md
index 7108769b85c..acf6fa7b009 100644
--- a/docs/query/udf/java-user-defined-function.md
+++ b/docs/query/udf/java-user-defined-function.md
@@ -385,17 +385,6 @@ Assume the files have been split into DictLibrary and 
FunctionUdf.
     jar -cf ./DictLibrary.jar ./DictLibrary.class
     ```
 
-2. Then compile the FunctionUdf file, directly referencing the resource 
package from the previous step, resulting in the FunctionUdf.jar package:
-
-    ```shell
-    javac -cp ./DictLibrary.jar ./FunctionUdf.java
-    jar -cvf ./FunctionUdf.jar ./FunctionUdf.class
-    ```
-
-3. After the above two steps, you will get two jar packages. To allow the 
resource jar package to be referenced by all concurrent instances, place it in 
the BE deployment path `be/lib/java_extensions/java-udf`. After restarting BE, 
it will be loaded with the JVM startup.
-
-4. Finally, use the `create function` statement to create a UDF function, with 
the file path pointing to the FunctionUdf.jar package. This way, the resource 
package will be loaded and released with the BE startup and shutdown. The 
FunctionUdf.jar will be loaded and released with the SQL execution cycle.
-
     ```java
     public class DictLibrary {
         private static HashMap<String, String> res = new HashMap<>();
@@ -428,6 +417,29 @@ Assume the files have been split into DictLibrary and 
FunctionUdf.
     }
     ```
 
+2. Then compile the FunctionUdf file, directly referencing the resource 
package from the previous step, resulting in the FunctionUdf.jar package:
+
+    ```shell
+    javac -cp ./DictLibrary.jar ./FunctionUdf.java
+    jar -cvf ./FunctionUdf.jar ./FunctionUdf.class
+    ```
+
+3. After the above two steps, you will get two jar packages. To allow the 
resource jar package to be referenced by all concurrent instances, place it in 
the deployment path `fe/custom_lib` 和 `be/custom_lib`. After the restarting, it 
will be loaded with the JVM startup.
+
+4. Finally, use the `create function` statement to create a UDF function
+
+   ```sql
+   CREATE FUNCTION java_udf_dict(string) RETURNS string PROPERTIES (
+    "symbol"="org.apache.doris.udf.FunctionUdf",
+    "always_nullable"="true",
+    "type"="JAVA_UDF"
+   );
+   ```
+
+In this loading mode, both FunctionUdf.jar and DictLibrary.jar are in the 
custom_lib path of FE and BE. This way, the packages will be loaded and 
released with the service startup and shutdown.
+
+You can also customize the path to FunctionUdf.jar using file:///, but only 
under custom_lib.
+
 ## Usage Notes
 
 1. Complex data types (HLL, Bitmap) are not supported.
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query/udf/java-user-defined-function.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query/udf/java-user-defined-function.md
index 63bc8f1756e..c04f4d5a906 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query/udf/java-user-defined-function.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query/udf/java-user-defined-function.md
@@ -386,17 +386,6 @@ public class UDTFStringTest {
     jar -cf ./DictLibrary.jar ./DictLibrary.class
     ```
 
-2. 然后编译 FunctionUdf 文件,可以直接引用上一步的到的资源包, 这样可以得到 udf 的 FunctionUdf.jar包。
-
-    ```shell
-    javac -cp ./DictLibrary.jar  ./FunctionUdf.java
-    jar  -cvf ./FunctionUdf.jar  ./FunctionUdf.class
-    ```
-
-3. 经过上面两步之后,会得到两个 jar 包,由于想让资源 jar 包被所有的并发引用,所以需要将它放到 BE 的部署路径 
`be/lib/java_extensions/java-udf `下面,BE重启之后就可以随着 JVM 的启动加载进来。
-
-4. 最后利用 `create function` 语句创建一个 UDF 函数,其中 file 的路径指向 FunctionUdf.jar 包, 
这样资源包会随着 BE 启动而加载,停止而释放。FunctionUdf.jar 的加载与释放则是跟随 SQL 的执行周期。
-
     ```java
     public class DictLibrary {
         private static HashMap<String, String> res = new HashMap<>();
@@ -429,6 +418,29 @@ public class UDTFStringTest {
     }
     ```
 
+2. 然后编译 FunctionUdf 文件,可以直接引用上一步的到的资源包, 这样可以得到 udf 的 FunctionUdf.jar包。
+
+    ```shell
+    javac -cp ./DictLibrary.jar  ./FunctionUdf.java
+    jar  -cvf ./FunctionUdf.jar  ./FunctionUdf.class
+    ```
+
+3. 经过上面两步之后,会得到两个 jar 包,由于想让资源 jar 包被所有的并发引用,所以需要将它放到指定路径 `fe/custom_lib` 和 
`be/custom_lib` 下面,服务重启之后就可以随着 JVM 的启动加载进来。
+
+4. 最后利用 `create function` 语句创建一个 UDF 函数
+   
+   ```sql
+   CREATE FUNCTION java_udf_dict(string) RETURNS string PROPERTIES (
+    "symbol"="org.apache.doris.udf.FunctionUdf",
+    "always_nullable"="true",
+    "type"="JAVA_UDF"
+   );
+   ```
+
+使用该加载方式时,FunctionUdf.jar和DictLibrary.jar都在FE和BE的custom_lib路径下,因此都会随着服务启动而加载,停止而释放,不再需要指定file
 的路径。
+
+也可以使用 file:/// 方式自定义FunctionUdf.jar的路径,但是DictLibrary.jar 只能放在custom_lib下。
+
 ## 使用须知
 
 1. 不支持复杂数据类型(HLL,Bitmap)。
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query/udf/java-user-defined-function.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query/udf/java-user-defined-function.md
index 63bc8f1756e..97da4da5fa7 100644
--- 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query/udf/java-user-defined-function.md
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query/udf/java-user-defined-function.md
@@ -386,17 +386,6 @@ public class UDTFStringTest {
     jar -cf ./DictLibrary.jar ./DictLibrary.class
     ```
 
-2. 然后编译 FunctionUdf 文件,可以直接引用上一步的到的资源包, 这样可以得到 udf 的 FunctionUdf.jar包。
-
-    ```shell
-    javac -cp ./DictLibrary.jar  ./FunctionUdf.java
-    jar  -cvf ./FunctionUdf.jar  ./FunctionUdf.class
-    ```
-
-3. 经过上面两步之后,会得到两个 jar 包,由于想让资源 jar 包被所有的并发引用,所以需要将它放到 BE 的部署路径 
`be/lib/java_extensions/java-udf `下面,BE重启之后就可以随着 JVM 的启动加载进来。
-
-4. 最后利用 `create function` 语句创建一个 UDF 函数,其中 file 的路径指向 FunctionUdf.jar 包, 
这样资源包会随着 BE 启动而加载,停止而释放。FunctionUdf.jar 的加载与释放则是跟随 SQL 的执行周期。
-
     ```java
     public class DictLibrary {
         private static HashMap<String, String> res = new HashMap<>();
@@ -429,6 +418,29 @@ public class UDTFStringTest {
     }
     ```
 
+2. 然后编译 FunctionUdf 文件,可以直接引用上一步的到的资源包, 这样可以得到 udf 的 FunctionUdf.jar包。
+
+    ```shell
+    javac -cp ./DictLibrary.jar  ./FunctionUdf.java
+    jar  -cvf ./FunctionUdf.jar  ./FunctionUdf.class
+    ```
+
+3. 经过上面两步之后,会得到两个 jar 包,由于想让资源 jar 包被所有的并发引用,所以需要将它放到指定路径 `fe/custom_lib` 和 
`be/custom_lib` 下面,服务重启之后就可以随着 JVM 的启动加载进来。
+
+4. 最后利用 `create function` 语句创建一个 UDF 函数
+
+   ```sql
+   CREATE FUNCTION java_udf_dict(string) RETURNS string PROPERTIES (
+    "symbol"="org.apache.doris.udf.FunctionUdf",
+    "always_nullable"="true",
+    "type"="JAVA_UDF"
+   );
+   ```
+
+使用该加载方式时,FunctionUdf.jar和DictLibrary.jar都在FE和BE的custom_lib路径下,因此都会随着服务启动而加载,停止而释放,不再需要指定file
 的路径。
+
+也可以使用 file:/// 方式自定义FunctionUdf.jar的路径,但是DictLibrary.jar 只能放在custom_lib下。
+
 ## 使用须知
 
 1. 不支持复杂数据类型(HLL,Bitmap)。
diff --git a/versioned_docs/version-2.1/query/udf/java-user-defined-function.md 
b/versioned_docs/version-2.1/query/udf/java-user-defined-function.md
index 7ac6effbe05..967ac667079 100644
--- a/versioned_docs/version-2.1/query/udf/java-user-defined-function.md
+++ b/versioned_docs/version-2.1/query/udf/java-user-defined-function.md
@@ -386,17 +386,6 @@ Assume the files have been split into DictLibrary and 
FunctionUdf.
     jar -cf ./DictLibrary.jar ./DictLibrary.class
     ```
 
-2. Then compile the FunctionUdf file, directly referencing the resource 
package from the previous step, resulting in the FunctionUdf.jar package:
-
-    ```shell
-    javac -cp ./DictLibrary.jar ./FunctionUdf.java
-    jar -cvf ./FunctionUdf.jar ./FunctionUdf.class
-    ```
-
-3. After the above two steps, you will get two jar packages. To allow the 
resource jar package to be referenced by all concurrent instances, place it in 
the BE deployment path `be/lib/java_extensions/java-udf`. After restarting BE, 
it will be loaded with the JVM startup.
-
-4. Finally, use the `create function` statement to create a UDF function, with 
the file path pointing to the FunctionUdf.jar package. This way, the resource 
package will be loaded and released with the BE startup and shutdown. The 
FunctionUdf.jar will be loaded and released with the SQL execution cycle.
-
     ```java
     public class DictLibrary {
         private static HashMap<String, String> res = new HashMap<>();
@@ -429,6 +418,29 @@ Assume the files have been split into DictLibrary and 
FunctionUdf.
     }
     ```
 
+2. Then compile the FunctionUdf file, directly referencing the resource 
package from the previous step, resulting in the FunctionUdf.jar package:
+
+    ```shell
+    javac -cp ./DictLibrary.jar ./FunctionUdf.java
+    jar -cvf ./FunctionUdf.jar ./FunctionUdf.class
+    ```
+
+3. After the above two steps, you will get two jar packages. To allow the 
resource jar package to be referenced by all concurrent instances, place it in 
the deployment path `fe/custom_lib` 和 `be/custom_lib`. After the restarting, it 
will be loaded with the JVM startup.
+
+4. Finally, use the `create function` statement to create a UDF function
+
+   ```sql
+   CREATE FUNCTION java_udf_dict(string) RETURNS string PROPERTIES (
+    "symbol"="org.apache.doris.udf.FunctionUdf",
+    "always_nullable"="true",
+    "type"="JAVA_UDF"
+   );
+   ```
+
+In this loading mode, both FunctionUdf.jar and DictLibrary.jar are in the 
custom_lib path of FE and BE. This way, the packages will be loaded and 
released with the service startup and shutdown. 
+
+You can also customize the path to FunctionUdf.jar using file:///, but only 
under custom_lib.
+
 ## Usage Notes
 
 1. Complex data types (HLL, Bitmap) are not supported.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to