Running a simple SQL job

You can use this Getting Started use case to get familiar with the most simple form of running a SQL Stream job.

The Getting Started contains the basic steps of running a SQL Stream job. When executing the job, you do not need to select a sink as the results are displayed in the browser. The SQL Stream Builder provisions a job on your cluster to run the SQL queries. You can select the Logs tab to review the status of the SQL job. As data is returned, it shows up in the Results tab.
As the Getting Started is using the Stateful Tutorial as an example, you need to set up a Kafka topic as transaction.log.1 in Streams Messaging Manager, and submit the Kafka Data Generator job to generate data to the source topic. For more information, see the Stateful Tutorial.
  1. Go to your cluster in Cloudera Manager.
  2. Click on SQL Stream Builder from the list of Services.
  3. Click on SQLStreamBuilder Console.
  4. Click on Data Providers from the main menu.
  5. Register a Kafka Provider.
  6. Click on Console from the main menu.
  7. Click on Tables tab.
  8. Add a Kafka table.
    1. Name the Table to transactions
    2. Select the registered Kafka cluster.
    3. Select transaction.log.1 as the Kafka topic.
    4. Select JSON as Data Format.
    5. Click Detect Schema.
      SSB detects the schema and displays it to the Schema Definition field.
    6. Click Save Changes.
  9. Click on Compose tab.
  10. Provide a name for the SQL job in the SQL Job Name text box.
  11. Add the following SQL statement to the SQL window:
    SELECT * FROM transactions
  12. Click on Execute.
    You can see the generated output in the Results tab.
  13. Click on Stop to stop the previous query.
  14. Add the following SQL statement to the SQL window:
    SELECT itemId, quantity
    FROM (
       SELECT itemId, quantity,
         ROW_NUMBER() OVER (
           ORDER BY '', quantity) AS rownum
       FROM transactions)
    WHERE rownum <= 4