Step 2: Add algorithm statements
You can process data by entering algorithm statements or uploading scripts. This topic describes how to enter algorithm statements or upload resource files.
Procedure
Based on the selected node type, you can choose one of the following methods to add algorithm statements.
Method 1: Enter algorithm statements
On the node editing page, enter the algorithm statements. This example uses MaxCompute SQL.
To use a user-defined function (UDF) in SQL, click the Reference Function tab. Find the required UDF in the list, and then return to the editing page to add it. If the function list is empty, you must create a function first. For more information, see Create a user-defined function.
NoteYou can reference user-defined functions only for the following resource types: MaxCompute, Hive, AnalyticDB for PostgreSQL, Flink_Vvp, Spark, and Flink.
Click the
icon.NoteIf you close the page without saving your changes, the code is cached locally. When you open the node editing page again, a prompt appears:
If you click Ignore, the system clears the locally cached code.
If you click View, the system opens the Compare Differences dialog box to show the differences:
If you want to use the cached code, click Use Unsaved Code. The system updates the Current Code (server-side code) with the changes from the Unsaved Code (locally cached code).
To merge the differences, manually copy and paste the changes from Current Code (server-side code) on the left to Unsaved Code (local code) on the right.
Method 2: Upload a node file and enter the corresponding script
This method is supported only for the following node types: Spark Batch, Spark SQL, Elastic Job, MaxCompute MR, Elastic Service, Blink, Blink DataStream, Flink DataStream, Flink Vvp Stream, Flink Vvp SQL, Flink Vvr Stream, Flink Vvr SQL, Flink SQL, and Spark Stream. This topic uses a MaxCompute MR node as an example.
On the Node Properties tab on the right side of the node editing page, upload the resource file.
NoteIf you select the Spark Batch node type, enter the class name.
On the editing page, write a Shell script for the resource file and specify the relevant parameters. For more information, see Basic properties.
NoteWhen you write the Shell script, include the file extension when you reference the resource file.
Click the
icon.NoteIf you close the page without saving your changes, the code is cached locally. When you open the node editing page again, a prompt appears:
If you click Ignore, the system clears the locally cached code.
If you click View, the system opens the Compare Differences dialog box to show the differences:
If you want to use the cached code, click Use Unsaved Code. The system updates the Current Code (server-side code) with the changes from the Unsaved Code (locally cached code).
To merge the differences, manually copy and paste the changes from Current Code (server-side code) on the left to Unsaved Code (local code) on the right.