1 创建测试用表
// 创建大表 create table bigtable(id bigint, t bigint, uid string, keyword string, url_rank int, click_num int, click_url string) row format delimited fields terminated by '\t'; // 创建小表 create table smalltable(id bigint, t bigint, uid string, keyword string, url_rank int, click_num int, click_url string) row format delimited fields terminated by '\t'; // 创建 JOIN 后表 create table jointable(id bigint, t bigint, uid string, keyword string, url_rank int, click_num int, click_url string) row format delimited fields terminated by '\t';
hive (default)> load data local inpath '/opt/module/data/bigtable' into table bigtable; hive (default)> load data local inpath '/opt/module/data/smalltable' into table smalltable;
2 基本语法
EXPLAIN [EXTENDED | DEPENDENCY | AUTHORIZATION] query-sql
3 案例实操
hive (default)> explain select * from bigtable; hive (default)> explain select click_url, count(*) ct from bigtable group by click_url;
hive (default)> explain extended select * from bigtable; hive (default)> explain extended select click_url, count(*) ct from bigtable group by click_url;