This topic describes how to create, reference, and download JAR and Python resources.
Prerequisites
Background information
If the existing built-in functions do not meet your requirements, DataWorks allows
you to create user-defined functions (UDFs) and customize processing logic. You can
upload the required JAR packages to your workspace so that you can reference them
when you create UDFs.
Note
- You can view built-in functions on the Built-In Functions tab. For more information, see Functions.
- You can view the UDFs that you have committed or deployed in DataWorks on the MaxCompute Functions tab. For more information, see MaxCompute functions.
You can upload different types of resources including text files, MaxCompute tables, Python code, and compressed packages in the .zip, .tgz, .tar.gz, .tar, and .jar formats to MaxCompute. You can read or use these resources when you run UDFs or MapReduce.
MaxCompute provides API operations for you to read and use resources. The following
types of resources are supported:
- Python: the Python code you have written. You can use Python code to register Python UDFs.
- JAR: the compiled Java JAR packages.
- Archive: the compressed files that can be identified by the file name extension. Supported file types include .zip, .tgz, .tar.gz, .tar, and .jar.
- File: the files in the .zip, .so, or .jar format.
JAR resources and file resources have the following differences:
- You can write Java code in an offline Java environment, compress the code to a JAR package, and then upload the package as a JAR resource to DataWorks.
- You can create and edit a small-sized file resource in the DataWorks console.
- To upload a resource file that is larger than 500 KB in size from your local device,
you can select Large File (over 500 KB) when you create a file resource.
Note Each resource file to be uploaded cannot exceed 30 MB. You can use the MaxCompute client to upload a resource file that is larger than 30 MB in size. Then, commit it to DataWorks on the MaxCompute Resources tab. For more information, see MaxCompute resources.
Create a JAR resource
Create a Python resource and register a UDF
Reference and download resources
- For more information about how to reference resources in a function, see Functions operations.
- For more information about how to reference resources in a node, see Create an ODPS MR node.
To download a resource, double-click Resource, select the required resource, and then click Download. For more information about how to download a resource by using the MaxCompute client, see Resource operations.