Currently, DataWorks allows you to develop user-defined functions (UDFs) in Python and Java. This topic describes how to register a UDF.

Note Before registering a UDF, you must upload the related resource.

Register a UDF

  1. Log on to the DataWorks console. In the left-side navigation pane, click Workspaces. On the Workspaces page, find the target workspace and click Data Analytics in the Actions column.
  2. Create a workflow. For more information, see Create a workflow.
  3. Write Java code in the offline Java environment, compress the code to a JAR package, and upload the package as a JAR resource to DataWorks. For more information, see Resource.
  4. Create a UDF.
    1. Find the target workflow, right-click MaxCompute, and choose Create > Function.
    2. In the Create Function dialog box that appears, enter the function name, select the target folder, and click Commit.
      Note If multiple MaxCompute computing engines are bound to the current workspace, you must select one from the Engine Instance MaxCompute drop-down list.
    3. On the Register Function page that appears, set the parameters as required and click the Commit icon in the toolbar.
      The Class Name parameter specifies the name of the class for implementing the UDF. The Resources parameter specifies the resources of the UDF. Separate multiple resource names with commas (,).
      Note You can view the UDFs that you have committed or deployed on the MaxCompute Functions page. For more information, see MaxCompute functions.
  5. Commit the node.

    After the node properties are configured, click the Save icon in the upper-left corner. Then, commit or commit and unlock the node to the development environment.

  6. Deploy the node.

    For more information, see Deploy a node.