Refresh Command Impala는 Metastore를 통해 Hive Table에 접근할 수 있다. refresh 명령을 통해 Hive의 Metastore를 Impala의 로드하여 사용.
Example
‘orders’ Table
‘orders’ Table create table orders( order_id string, cust_id string, order_date timestamp) row format delimited fields terminated by 't'; load data local inpath '/home/training/impala_data/orders/*' into table orders;
‘order_details’ Table
‘order_details’ Table create table order_details(order_id int, prod_id int) row format delimited fields terminated by 't'; load data local inpath '/home/training/impala_data/order_details/*' into table order_details;
‘products’ Table
‘products’ Table create table products(prod_id string, brand string, name string, price int, cost int, shipping_wt int) row format delimited fields terminated by 't'; load data local inpath '/home/training/impala_data/products/*' into table products;
Question? 2013년 5월의 수익(price-cost)을 구하시오. SELECT AVG(price - cost) AS profit FROM products p JOIN order_details d ON (d. prod_id = p. prod_id) JOIN orders o ON (d. order_id = o. order_id) WHERE YEAR(order_date) = 2013 AND MONTH(order_date) = 05;
Explain Query SELECT AVG(price - cost) AS profit FROM products p JOIN order_details d ON (d. prod_id = p. prod_id) JOIN orders o ON (d. order_id = o. order_id) WHERE YEAR(order_date) = 2013 AND MONTH(order_date) = 05;