All Products
Search
Document Center

MaxCompute:Resource

Last Updated:Jan 31, 2024

Resources refer to various auxiliary files or programs that need to be used to complete data processing tasks. In most cases, resources are used to run jobs such as MapReduce jobs or jobs that use user-defined function (UDFs). The resource management feature of MaxCompute allows you to upload, register, and manage resources.

Concept

Resource is a concept specific to MaxCompute. If you want to run tasks by using MaxCompute UDFs or MapReduce, you must upload files as MaxCompute resources.

  • SQL UDF: After you write a UDF, you must compress the code of the UDF into a JAR package and upload the package to MaxCompute as a resource. When you execute the UDF, MaxCompute automatically downloads the JAR package and obtains the code in the package to execute the UDF. JAR files are a type of MaxCompute resource. When you upload a JAR file, a resource is created in MaxCompute.

  • MapReduce: After you write a MapReduce program, you must compress the program into a JAR package and upload the package to MaxCompute as a resource. When you run a MapReduce job, MapReduce automatically downloads the JAR package and obtains the code in the package to run the MapReduce job.

You can upload text files and MaxCompute tables to MaxCompute as resources. Then, you can access or use the resources when you execute UDFs or run MapReduce jobs. MaxCompute provides APIs that you can call to access and use resources. For more information, see Resource samples and Java UDFs.

Note

Some limits are imposed on how MaxCompute UDFs and MapReduce access resources. For more information, see Limits.

Resource types

You can upload an object whose size is no more than 2,048 MB to MaxCompute as a resource. MaxCompute supports the following types of resources:

  • File: files in the .zip, .so, or .jar format.

  • Table: tables in MaxCompute.

    Note

    Only BIGINT, DOUBLE, STRING, DATETIME, and BOOLEAN fields are supported in tables that are referenced by MapReduce.

  • JAR: compiled JAR packages.

  • Archive: compressed files that are identified by the resource name extension. The following file types are supported: .zip, .tgz, .tar.gz, .tar, and .jar.

  • Python: the Python code that you write. You can use Python code to register Python UDFs.

References