Create a Flink SQL public node
Flink SQL nodes are streaming nodes that run on Flink cloud computing resources. They can process data from sources such as RDS for MySQL, Table Store, Hive, Kafka, HBase, Phoenix, AnalyticDB for MySQL, and DataHub. This topic describes how to create a Flink SQL public node.
Background
Flink SQL is a commercial version based on Apache Flink (Flink). It is suitable for Flink nodes deployed in YARN mode.
Flink SQL public nodes are designed to simplify computing models and lower the barrier to using Flink. You can use standard SQL to develop these public nodes.
Procedure
Method 1: Write an SQL statement
Log on to the Data Resource Platform console.
In the upper-left corner of the page, click the
icon and choose Synergy.On the top menu bar, click the
icon, select the target workspace, and click Asset Processing.NoteIf you are already on the Asset Processing page, skip clicking Asset Processing.
In the left-side navigation pane, click the
icon and choose Public Nodes.Click the
icon. On the Public Nodes page, click Create Node.In the Create Node dialog box, select the Flink SQL node type and click OK.
On the node editing page, configure the node.
On the Node properties tab on the right side of the page, specify a custom node identifier, node name, and description.
In the editor, enter the SQL statement and click the
icon.(Optional) To use a user-defined function in your SQL statement, click the Reference function tab, find the required function in the list, and then enter it in the editor. If the function list is empty, you must create a function first. For more information, see Create a user-defined function.
In the Confirm node information dialog box, verify that the node identifier, node name, and node directory are correct, and then click Confirm.
Click the Run configuration tab on the right side of the page to configure the development computing engine.
If your code uses input tables, output tables, or node variables, add them manually or click the
icon in the editor for automatic parsing.The following steps demonstrate automatic parsing.
Click the
icon in the editor. The Run configuration tab displays the automatically parsed inputs, outputs, and node variables.Turn on the
switch next to Node input to view the node input.Turn on the
switch next to Node output to view the node output.Enter the node variable values.
Configure Flink runtime parameters.
On the node editing page, click the
icon in the upper-left corner.
Method 2: Upload an algorithm package
Log on to the Data Resource Platform console.
In the upper-left corner of the page, click the
icon and choose Synergy.On the top menu bar, click the
icon, select the target workspace, and click Asset Processing.NoteIf you are already on the Asset Processing page, skip clicking Asset Processing.
In the left-side navigation pane, click the
icon and choose Public Nodes.Click the
icon. On the Public Nodes page, click Create Node.In the Create Node dialog box, select the Flink SQL node type and click OK.
On the node editing page, configure the node.
On the Node properties tab on the right side of the page, specify a custom node identifier, node name, and description, and then upload an algorithm package.
Parameter
Description
Node name
The name of the node.
Node identifier
A user-defined identifier for the node. It must be unique within the workspace.
Public node version
When you first create a node, the default is the development version (Beta). After the first release, the version number increments. You can publish different versions after modifying the corresponding algorithm.
Node directory
The directory where the node is located.
Node description
A description of the node to help you understand and find it.
Node attachment
Upload a node resource file in JAR package format.
In the editor, enter the corresponding script content and click the
icon.In the Confirm node information dialog box, verify that the node identifier, node name, and node directory are correct, and then click Confirm.
(Conditionally required) If your code includes inputs, outputs, or node variables, add them manually.
If the node file and script require input, turn on the switch
next to Node Input, and then click Add Node Input. Specify a custom input identifier and select the input data structure.If the node script requires an output variable, turn on the switch
next to Node Output, and then click Add Node Output. Specify a custom output identifier and select the output data structure.To set global control parameters for the node, click Add Parameter to add and assign a node variable. For more information about global variables, see Add a global variable for a workspace.
Parameter
Description
Node input
Input identifier
Enter an identifier for the variable. The system provides a default value, which you can customize based on the script content. For example: Input.
Data structure
The data format of the input table. This is defined by the data model. Select the logical table name of the input data from the drop-down list. This represents the structure of the data table in the compute resources.
When you select a data table, ensure that the input model matches the output data model of the upstream node.
An asterisk (*) denotes an arbitrary data structure. This is useful for tables without a predefined data model.
Node output
Output identifier
The identifier for the output variable. You can customize it based on the Script Content. For example: Output.
Data structure
The data format of the output table. This is defined by the data model. Select a data format from the drop-down list. This represents the structure of the output data table within the compute resources.
Ensure the node's output model matches the input model of the downstream node.
If you select an asterisk (*), the data structure is considered arbitrary. This is useful for tables without a predefined data model.
Node variable
Variable name
A custom name for the node variable.
Variable value
The variable's value, which must be a string.
Variable description
A description of the variable.
Configure Flink runtime parameters.
After you configure the parameters, click the
icon to create the node.