This topic describes how to create a Realtime Compute for Apache Flink job and the features provided on the Development page, such as syntax check, Flink SQL code assistance, and management of Flink SQL code versions.

Background information

Note

Procedure

  1. Log on to the Realtime Compute development platform.
  2. In the top navigation bar, click Development.
  3. On the Development page, click Create File at the top.
  4. In the Create File dialog box, set relevant parameters. The following table describes these parameters.
    Parameter Description
    File Name The name of the file that contains the Fink SQL code.
    Note The file name must be unique in the current project.
    File Type
    • For Realtime Compute for Apache Flink in shared mode, the valid value is FLINK_STREAM/SQL.
    • For Realtime Compute for Apache Flink in exclusive mode, valid values are FLINK_STREAM/DATASTREAM and FLINK_STREAM/SQL.
    Storage Path The folder of the file that contains the Fink SQL code. You can click the Create a folder icon on the right side of an existing folder to create a subfolder.
  5. Click OK. On the page that appears, you can edit the Flink SQL code.
    Note
    • On the right side of the Development page, you can click Code Structure to check the Flink SQL code structure.
    • We recommend that you click Storage to manage upstream and downstream storage resources. For more information, see Overview.

Syntax check

  1. Log on to the Realtime Compute development platform.
  2. In the top navigation bar, click Development.
  3. In the left-side navigation pane of the Development page, click the target job.
  4. On the top of the Development page for the target job, click Syntax Check.
    Note
    • When you save a Flink SQL job, the system automatically checks the syntax.
    • Syntax Check only takes effect for Flink SQL statements with complete logic.

Parameters

  1. Log on to the Realtime Compute development platform.
  2. In the top navigation bar, click Development.
  3. In the left-side navigation pane of the Development page, click the target job.
  4. On the right side of the Development page for the target job, click Parameters.
  5. Configure the parameters required for the job.
    For more information about job parameters, see Job parameters.

Flink SQL code assistance

  • Syntax check

    After you modify the Flink SQL code, the system automatically saves it and checks its syntax. If a syntax error is detected, the system displays the cause of the error and the row and column where the error is located on the Development page.

  • Intelligent code completion

    When you enter Flink SQL statements on the Development page, the system automatically completes keywords, built-in functions, tables, or fields.

  • Syntax highlighting

    The system highlights keywords in Flink SQL statements and displays different structures in different colors.

Management of Flink SQL code versions

Realtime Compute for Apache Flink allows you to manage Flink SQL code versions. A new code version is generated each time you publish a job. You can use code versions to track versions, modify the code, and roll the code back to an earlier version.

  1. Log on to the Realtime Compute development platform.
  2. In the top navigation bar, click Development.
  3. In the left-side navigation pane of the Development page, click the target job.
  4. On the right side of the Development page, click Versions.
  5. In the Versions pane, find the target version, move the pointer over More in the Actions column.
  6. Select one of the following options from the drop-down list:
    • Compare: checks the difference between the current version and an earlier version.
    • Rollback: rolls the code back to an earlier version.
    • Delete: deletes a code version. By default, you can reserve a maximum of 20 Flink SQL code versions in Realtime Compute for Apache Flink. If the number of code versions is less than 20, you can publish a job. If the number of code versions is 20, the system does not allow you to publish a job and prompts you to delete earlier versions.
      Note You can publish a job only if the number of versions is less than 20.
    • Locked: locks the current version.
      Note You cannot submit a new version before you unlock the current version.