Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-24153

Unable to use SET command in Flink SQL Shell file submit mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.13.1
    • 1.13.3
    • Table SQL / Client
    • None

    Description

      Let's say you created a Flink SQL job in a file called sample.sql

       

      -- Properties that change the fundamental execution behavior of a table program.
      SET 'execution.runtime-mode' = 'streaming';
      SET 'sql-client.execution.result-mode' = 'tableau';
      SET 'sql-client.execution.max-table-result.rows' = '10000';
      SET 'parallelism.default' = '1';
      
      -- Source table
      CREATE TEMPORARY TABLE salesitems (
          seller_id VARCHAR,
          product VARCHAR,
          quantity INT,
          product_price DOUBLE,
          sale_ts BIGINT,
          proctime AS PROCTIME()
      ) WITH (
          'connector' = 'kafka',
          'topic' = 'salesitems',
          'properties.bootstrap.servers' = '10.129.35.58:29092',
          'properties.group.id' = 'sliding-windows',
          'scan.startup.mode' = 'latest-offset',
          'format' = 'json'
      );
      
      SELECT
        seller_id,
        HOP_START(proctime, INTERVAL '10' SECONDS, INTERVAL '30' SECONDS) AS window_start,
        HOP_END(proctime, INTERVAL '10' SECONDS, INTERVAL '30' SECONDS) AS window_end,
        SUM(quantity * product_price) AS window_sales
      FROM salesitems
      GROUP BY
        HOP(proctime, INTERVAL '10' SECONDS, INTERVAL '30' SECONDS),
        seller_id;
      

      Now, if you submit the job as -

      ${FLINK_HOME}/bin/sql-client.sh embedded \
      --jar ${FLINK_HOME}/lib/flink-sql-connector-kafka_2.11-1.13.1.jar \
      -f sample.sql

      The error you get is -

      [INFO] Executing SQL from file.
      Flink SQL> -- Properties that change the fundamental execution behavior of a table program.
      SET 'execution.runtime-mode' = 'streaming';
      [ERROR] Could not execute SQL statement. Reason:
      org.apache.flink.sql.parser.impl.ParseException: Encountered "\'execution.runtime-mode\'" at line 2, column 5.
      Was expecting one of:
      <BRACKET_QUOTED_IDENTIFIER> ...
      <QUOTED_IDENTIFIER> ...
      <BACK_QUOTED_IDENTIFIER> ...
      <HYPHENATED_IDENTIFIER> ...
      <IDENTIFIER> ...
      <UNICODE_QUOTED_IDENTIFIER> ...
      

       

      Attachments

        Activity

          People

            twalthr Timo Walther
            Nj-kol Nilanjan Sarkar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: