Contribute UDF

This manual mainly introduces how external users can contribute their own UDF functions to the Doris community.

Prerequisites

  1. UDF function is universal

    The versatility here mainly refers to: UDF functions are widely used in certain business scenarios. Such UDF functions are valuable and can be used directly by other users in the community.

    If you are not sure whether the UDF function you wrote is universal, you can send an email to dev@doris.apache.org or directly create an ISSUE to initiate the discussion.

  2. UDF has completed testing and is running normally in the user’s production environment

Ready to work

  1. UDF source code
  2. User Manual of UDF

Source code

Create a folder for UDF functions under contrib/udf/src/, and store the source code and CMAKE files here. The source code to be contributed should include: .h, .cpp, CMakeFile.txt. Taking udf_samples as an example here, first create a new folder under the contrib/udf/src/ path and store the source code.

  1. ├──contrib
  2. └── udf
  3. ├── CMakeLists.txt
  4. └── src
  5. └── udf_samples
  6. ├── CMakeLists.txt
  7. ├── uda_sample.cpp
  8. ├── uda_sample.h
  9. ├── udf_sample.cpp
  10. └── udf_sample.h
  1. CMakeLists.txt

    After the user’s CMakeLists.txt is placed here, a small amount of changes are required. Just remove include udf and udf lib. The reason for the removal is that it has been declared in the CMake file at the contrib/udf level.

manual

The user manual needs to include: UDF function definition description, applicable scenarios, function syntax, how to compile UDF, how to use UDF in Doris, and use examples.

  1. The user manual must contain both Chinese and English versions and be stored under docs/zh-CN/extending-doris/contrib/udf and docs/en/extending-doris/contrib/udf respectively.

    1. ├── docs
    2. └── zh-CN
    3. └──extending-doris
    4. └──udf
    5. └──contrib
    6. ├── udf-simple-manual.md
    1. ├── docs
    2. └── en
    3. └──extending-doris
    4. └──udf
    5. └──contrib
    6. ├── udf-simple-manual.md
  2. Add the two manual files to the sidebar in Chinese and English.

    1. vi docs/.vuepress/sidebar/zh-CN.js
    2. {
    3. title: "用户贡献的 UDF",
    4. directoryPath: "contrib/",
    5. children:
    6. [
    7. "udf-simple-manual",
    8. ],
    9. },
    1. vi docs/.vuepress/sidebar/en.js
    2. {
    3. title: "Users contribute UDF",
    4. directoryPath: "contrib/",
    5. children:
    6. [
    7. "udf-simple-manual",
    8. ],
    9. },

Contribute UDF to the community

When you meet the conditions and prepare the code, you can contribute UDF to the Doris community after the document. Simply submit the request (PR) on GithubContribute UDF - 图1 (opens new window). See the specific submission method: Pull Request (PR)Contribute UDF - 图2 (opens new window).

Finally, when the PR assessment is passed and merged. Congratulations, your UDF becomes a third-party UDF supported by Doris. You can check it out in the extended functions section of Doris official websiteContribute UDF - 图3 (opens new window)~.