ListFunctions

Updated at:

Queries a paginated list of user-defined functions (UDFs) in data development, or filters UDFs based on specified conditions.

Operation description

Use the DataWorks endpoint in the region where the target workspace resides. You can call ListProjects in the same region to obtain the ProjectId from PagingInfo.Projects[].Id, and then pass Name, Owner, or Type as needed to query data development functions in the workspace. If you encounter a Forbidden.Access error, verify the endpoint region, workspace ID, and access permissions of the calling identity.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:*

list

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

ProjectId

integer

Yes

The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the workspace management page to obtain the ID.

This parameter specifies the DataWorks workspace used to invoke this API operation.

12345

Owner

string

No

The ID of the UDF owner used as a filter condition.

110755000425XXXX

Type

string

No

The type of the function used as a filter condition.

Valid values:

  • Math: mathematical operation functions

  • Aggregate: aggregate functions

  • String: string processing functions

  • Date: date functions

  • Analytic: window functions

  • Other: other functions

Math

Name

string

No

The name of the UDF used as a filter condition. Fuzzy search is supported.

test

PageNumber

integer

No

The page number. Default value: 1. Minimum value: 1.

1

PageSize

integer

No

The number of entries per page. Default value: 10. Maximum value: 100.

10

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID. You can use this ID to troubleshoot errors.

89FB2BF0-EB00-5D03-9C34-05931001XXXX

PagingInfo

object

The pagination information.

TotalCount

integer

The total number of entries that meet the filter conditions.

294

PageNumber

integer

The page number of the returned data.

1

PageSize

integer

The number of entries returned per page.

10

Functions

array<object>

The list of functions.

array<object>

The information about a function in the list.

Name

string

The name of the UDF.

Function name

CreateTime

integer

The timestamp when the UDF was created.

1655953028000

ProjectId

integer

The ID of the project to which the UDF belongs.

307XXX

Owner

string

The owner of the UDF.

110755000425XXXX

Type

string

The type of the UDF.

Valid values:

  • Math: mathematical operation functions

  • Aggregate: aggregate functions

  • String: string processing functions

  • Date: date functions

  • Analytic: window functions

  • Other: other functions

Math

ModifyTime

integer

The time when the UDF was updated.

The value is a 13-digit timestamp, such as 1655953028000.

1655953028000

ClassName

string

The fully qualified class name of the UDF.

com.demo.Main

ArmResource

string

The list of ARM cluster resource files.

xxx.jar,yyy.jar

FileResource

string

The implementation code of the function and the list of resource files.

xxx.jar,yyy.jar

Description

string

The overall description of the function.

Description

CommandDescription

string

The description of the command.

testUdf(xx,yy)

ParameterDescription

string

The description of the parameters.

xx: parameter information XXX yy: parameter information YYY

ReturnValueDescription

string

The description of the return value.

The return value is a string.

ExampleDescription

string

The description of the example.

Example description >>> select tsetUdf(xx,yy); abc

EmbeddedCodeType

string

The type of the embedded code.

Valid values:

  • Python2

  • Python3

  • Java8

  • Java11

  • Java17

Python2

EmbeddedResourceType

string

The type of the embedded resource.

Valid values:

  • File: regular resource file

  • Embedded: embedded resource

File

EmbeddedCode

string

The content of the embedded function code.

print('hello,world!')

DatabaseName

string

The name of the database. This parameter is used only when the function type is EMR Function.

EMR_lake

DataSource

object

The data source information of the UDF.

Name

string

The name of the data source.

odps_first

Type

string

The type of the data source.

odps

Script

object

The script information of the UDF.

Path

string

The path of the script.

XXX/OpenAPI/function/function_name

Runtime

object

The runtime.

Command

string

The command.

ODPS_FUNCTION

Id

string

The ID of the script.

Important Before SDK version 8.0.0, this field is of the Long type. In SDK version 8.0.0 and later, this field is of the String type. This change does not affect the normal use of the SDK, and the parameter is still returned based on the type defined in the SDK. However, if you upgrade the SDK across version 8.0.0, the type change may cause project compilation failures. In this case, you must manually correct the data type.

652567824470354XXXX

RuntimeResource

object

The information about the runtime resource group.

ResourceGroupId

string

The ID of the runtime resource group.

S_resgrop_xxx

Id

string

The unique identifier of the UDF.

Important Before SDK version 8.0.0, this field is of the Long type. In SDK version 8.0.0 and later, this field is of the String type. This change does not affect the normal use of the SDK, and the parameter is still returned based on the type defined in the SDK. However, if you upgrade the SDK across version 8.0.0, the type change may cause project compilation failures. In this case, you must manually correct the data type.

580667964888595XXXX

Examples

Success response

JSON format

{
  "RequestId": "89FB2BF0-EB00-5D03-9C34-05931001XXXX",
  "PagingInfo": {
    "TotalCount": 294,
    "PageNumber": 1,
    "PageSize": 10,
    "Functions": [
      {
        "Name": "Function name",
        "CreateTime": 1655953028000,
        "ProjectId": 0,
        "Owner": "110755000425XXXX",
        "Type": "Math",
        "ModifyTime": 1655953028000,
        "ClassName": "com.demo.Main",
        "ArmResource": "xxx.jar,yyy.jar",
        "FileResource": "xxx.jar,yyy.jar",
        "Description": "Description",
        "CommandDescription": "testUdf(xx,yy)",
        "ParameterDescription": "xx: parameter information XXX\nyy: parameter information YYY",
        "ReturnValueDescription": "The return value is a string.",
        "ExampleDescription": "Example description >>> select tsetUdf(xx,yy);\nabc",
        "EmbeddedCodeType": "Python2",
        "EmbeddedResourceType": "File",
        "EmbeddedCode": "print('hello,world!')",
        "DatabaseName": "EMR_lake",
        "DataSource": {
          "Name": "odps_first",
          "Type": "odps"
        },
        "Script": {
          "Path": "XXX/OpenAPI/function/function_name",
          "Runtime": {
            "Command": "ODPS_FUNCTION"
          },
          "Id": "652567824470354XXXX"
        },
        "RuntimeResource": {
          "ResourceGroupId": "S_resgrop_xxx"
        },
        "Id": "580667964888595XXXX"
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.