Running the Hello world example

You use the minimum set of required parameters, and get a result that is not interesting. From this example, you learn what to expect in the output when you use the minimum set of required parameters.

In the input directory workload-insights/demo/queries, a file named queryA.sql contains a single query.

  1. Go to the workload-insights directory
    The Workload Insights (wi) script is located in this directory.
  2. Run the script using the -i option to specify file queryA.sql as the input to the recommender.
    ./wi -i queries/queryA.sql -u jdbc:hive2://localhost:10000                 
    Output looks something like this:
    2021-06-10 15:17:37,461 INFO c.c.i.a.m.t.JdbcWorkloadReader Computing plan for queryA from JDBC connection
    ...
    Recommended views:
    -- materialized_view_1:
    CREATE MATERIALIZED VIEW `materialized_view_1` AS
    SELECT `store_returns`.`sr_item_sk`, SUM(`store_returns`.`sr_net_loss`) AS `$f1`
    FROM `default`.`reason`, `default`.`store_returns`
    WHERE `store_returns`.`sr_reason_sk` = `reason`.`r_reason_sk` AND 'Found a better price in a store' = `reason`.`r_reason_desc`
    GROUP BY `store_returns`.`sr_item_sk`;
    -----------------------------------------------------
    Query details:
    -- queryA:SELECT `t0`.`sr_item_sk`, SUM(`t0`.`sr_net_loss`) AS `$f1` FROM (SELECT `sr_item_sk`, `sr_reason_sk`, `sr_net_loss` FROM `default`.`store_returns` WHERE `sr_reason_sk` IS NOT NULL) AS `t0` INNER JOIN (SELECT `r_reason_sk` FROM `default`.`reason` WHERE `r_reason_desc` = 'Found a better price in a store' AND `r_reason_sk` IS NOT NULL) AS `t2` ON `t0`.`sr_reason_sk` = `t2`.`r_reason_sk` GROUP BY `t0`.`sr_item_sk`
    	-- RECOMMENDATION : materialized_view_1
    ----------------------------------------------------- 

    The result is identical to the input query. The output contains a list of recommendations followed by the queries in the workload. By default, for each query, the materialized views matching the query appear.