Running a job with generated data

Run a job that reads rows from the Datagen connector, which generates random data, and writes them to the Blackhole connector, which discards them. The job needs no external system.

  1. In the Streaming SQL Console, click Projects in the left navigation pane, and click the name of your project.
    The project opens, with the Explorer panel on the left. To open the Streaming SQL Console, see Accessing Cloudera SQL Stream Builder.
  2. In the Explorer, open the menu of Jobs, and click New Job.
    The Create New Job window opens.
  3. Enter a Job Name, or click Generate Job Name.
  4. Click Create.
    The job opens in a new tab, with an empty SQL editor.
  5. Enter the following statements in the SQL editor:
    CREATE TABLE orders_gen (
      order_id INT,
      amount DOUBLE,
      order_time AS LOCALTIMESTAMP
    ) WITH (
      'connector' = 'datagen',
      'rows-per-second' = '5',
      'fields.order_id.kind' = 'sequence',
      'fields.order_id.start' = '1',
      'fields.order_id.end' = '100000',
      'fields.amount.min' = '1',
      'fields.amount.max' = '500'
    );
    
    CREATE TABLE large_orders (
      order_id INT,
      amount DOUBLE,
      order_time TIMESTAMP(3)
    ) WITH (
      'connector' = 'blackhole'
    );
    
    INSERT INTO large_orders
    SELECT order_id, amount, order_time
    FROM orders_gen
    WHERE amount > 100;
  6. Click the Execute job icon.
    The progress of each statement is displayed on the Logs tab. When the job starts, its status icon in the Explorer turns green, and its status is Running.
  7. When you finish, click Stop job.
    The job stops, and its status changes in the Explorer.