Create a Flink SQL public node

Updated at:

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

  1. Log on to the Data Resource Platform console.

  2. In the upper-left corner of the page, click the 菜单 icon and choose Synergy.

  3. On the top menu bar, click the 选择工作组 icon, select the target workspace, and click Asset Processing.

    Note

    If you are already on the Asset Processing page, skip clicking Asset Processing.

  4. In the left-side navigation pane, click the image icon and choose Public Nodes.

  5. Click the image icon. On the Public Nodes page, click Create Node.

  6. In the Create Node dialog box, select the Flink SQL node type and click OK.

  7. On the node editing page, configure the node.

    1. On the Node properties tab on the right side of the page, specify a custom node identifier, node name, and description.

    2. In the editor, enter the SQL statement and click the 保存 icon.

    3. (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.

    4. In the Confirm node information dialog box, verify that the node identifier, node name, and node directory are correct, and then click Confirm.

    5. Click the Run configuration tab on the right side of the page to configure the development computing engine.

    6. 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.

      1. Click the 解析 icon in the editor. The Run configuration tab displays the automatically parsed inputs, outputs, and node variables.

      2. Turn on the image.png switch next to Node input to view the node input.

      3. Turn on the image.png switch next to Node output to view the node output.

      4. Enter the node variable values.

    7. Configure Flink runtime parameters.

    8. On the node editing page, click the 保存 icon in the upper-left corner.

Method 2: Upload an algorithm package

  1. Log on to the Data Resource Platform console.

  2. In the upper-left corner of the page, click the 菜单 icon and choose Synergy.

  3. On the top menu bar, click the 选择工作组 icon, select the target workspace, and click Asset Processing.

    Note

    If you are already on the Asset Processing page, skip clicking Asset Processing.

  4. In the left-side navigation pane, click the image icon and choose Public Nodes.

  5. Click the 进入 icon. On the Public Nodes page, click Create Node.

  6. In the Create Node dialog box, select the Flink SQL node type and click OK.

  7. On the node editing page, configure the node.

    1. 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.

    2. In the editor, enter the corresponding script content and click the 保存 icon.

    3. In the Confirm node information dialog box, verify that the node identifier, node name, and node directory are correct, and then click Confirm.

    4. (Conditionally required) If your code includes inputs, outputs, or node variables, add them manually.

      1. If the node file and script require input, turn on the switch image.png next to Node Input, and then click Add Node Input. Specify a custom input identifier and select the input data structure.

      2. If the node script requires an output variable, turn on the switch image.png next to Node Output, and then click Add Node Output. Specify a custom output identifier and select the output data structure.

      3. 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.

    5. Configure Flink runtime parameters.

    6. After you configure the parameters, click the 保存 icon to create the node.