Hive cli 设置

在hive client中输入即可

set hive.cli.print.header=true;  // 打印列名 
set; // 开启行转列功能, 前提必须开启打印列名功能
set; // 设置每行显示的列数

Hive快捷查询:不启用MapReduce启用Fetch Task

如果想查询某个表的某一列,Hive默认会启用MapReduce Job来完成这个任务,启用MapReduce Job是会消耗系统开销的,对于简单的不需要聚合的类似SELECT col1,col2,col3 from table LIMIT n语句,不需要起MapReduce,直接通过Fetch Task获取数据.


set hive.fetch.task.conversion=more;


bin/hive --hiveconf hive.fetch.task.conversion=more



Some select queries can be converted to single FETCH task
minimizing latency.Currently the query should be single
sourced not having any subquery and should not have
any aggregations or distincts (which incurrs RS),
lateral views and joins.
1. minimal : SELECT STAR, FILTER on partition columns, LIMIT only
2. more : SELECT, FILTER, LIMIT only (+TABLESAMPLE, virtual columns)