hive避免进行MapReduce过程的几种情形

question:

hive一般情况下,会触发MapReduce任务进行查询,那么什么情况下可以不必使用MapReduce进行查询呢?


answer:

本地模式下,hive可以避免进行MapReduce(查询速度相对而言更快)。

例如:

1、select * from emp(表名);

2、只过滤字段(列)的select语句:

对于where语句中过滤条件只是区分字段(列)这种情况,无论是否使用limit语句限制输出记录条数,也是无需MapReduce过程的

select *  from emp where country=“CH” and state = “BJ” limit 100;

3、如果属性hive.exec.mode.local.auto 的值设置为true的话,hive 还是会尝试使用本地模式执行其他的操作:

set  hive.exec.mode.local.auto = true;

最好将set hive.exec.mode.local.auto = true;这个设置增加到$HOME/.hiverc 配置文件中。

其余情况,hive 将使用MapReduce来执行查询任务。

你可能感兴趣的:(大数据)