Configuring Impala Virtual Warehouses to create Impala tables in Kudu in Cloudera Data Warehouse Private Cloud

Cloudera Data Warehouse allows you to create Impala tables in Kudu. You can configure an Impala Virtual Warehouse to connect to Kudu and create Impala tables in Kudu using Hue. Or, you can create tables on the fly by specifying the Kudu master host in the TBLPROPERTIES statement while running the query from the Hue query editor.

Obtain the hostname of the Kudu master home by going to Cloudera Manager > Clusters > Kudu service > Instances from the CDP Management Console.

Creating Imapla tables in Kudu on the fly

To create Impala tables in Kudu without updating a Virtual Warehouse’s Impala coordinator configuration, you must specify the Kudu master host in the TBLPROPERTIES statement as follows while running the query from Hue:
TBLPROPERTIES ('kudu.master_addresses'='[***host.example.com***]')

Configuring the Virtual Warehouse to create Impala tables in Kudu

By reconfiguring an existing Impala Virtual Warehouse as follows, any tables you create will be created in Kudu.

  1. Log in to the Cloudera Data Warehouse service as a DWAdmin.
  2. Go to an Impala Virtual Warehouse and click > Edit > CONFIGURATIONS > Impala coordinator and select flagfile from the drop-down list.
  3. Click and enter the following key and value:
    Key Value
    kudu_master_hosts [***HOSTNAME-OF-KUDU-MASTER***]
  4. Click APPLY.
  5. Restart the Virtual Warehouse.
  6. Open Hue from the same Virtual Warehouse.
  7. Enter the following lines in the query editor and click the run button:
    # Create a new table
    # Use the kudu.num_tablet_replicas if the Kudu cluster is too small
    CREATE TABLE my_first_table
    (
      id BIGINT,
      name STRING,
      PRIMARY KEY(id)
    )
    PARTITION BY HASH PARTITIONS 16
    STORED AS KUDU
    TBLPROPERTIES ('kudu.num_tablet_replicas' = '1');
    
    # Insert into Kudu table
    INSERT INTO my_first_table VALUES (99, "sarah");
    
    # Verify if the data was inserted
    SELECT * FROM my_first_table;
    The above commands create an Impala table in Kudu and insert a sample record. The following is a screenshot showing the SQL commands and their output in Hue:

    This screenshot shows the query results of the create table command in Hue.