你能解释何时以及为什么在配置单元中调用mapreduce [英] Can you explain when and why mapreduce is invoked in hive

查看:87
本文介绍了你能解释何时以及为什么在配置单元中调用mapreduce的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. select * from Table_name limit 5;


  2. 从表名限制5中选择col1_name,col2_name;


当我运行第一个查询时,将不会调用MapReduce,而调用其他MapReduce。请解释原因。

解决方案

为了理解原因,首先我们需要知道map和reduce阶段的含义:


  1. 地图:基本上是一个按排序顺序过滤和组织数据的过滤器。对于例如它将从第二个查询中的行中过滤col1_name,col2_name。但是,在第一个查询中,您正在读取每一列,不需要过滤。因此,没有Map阶段


  2. Reduce :Reduce只是行中的汇总操作数据。例如,一个彩色的总和!在这两个查询中,您都不需要任何汇总数据。因此,第一个查询没有map-reduce,第二个查询只有mappers,但没有缩小。因此,没有reducer。


    1. select * from Table_name limit 5;

    2. select col1_name,col2_name from table_name limit 5;

    When i run the first query there will be no MapReduce invoked, while for other the MapReduce is invoked. Could you please explain the reason.

    解决方案

    To understand the reason, first we need to know what map and reduce phases mean:-

    1. Map: Basically a filter which filters and organizes data in sorted order. For e.g. It will filter col1_name, col2_name from a row in the second query. However in 1st query you are reading every column, no filtering is required. Hence no Map phase

    2. Reduce: Reduce is just summary operation data across the rows. for e.g. sum of a coloumn! In both the queries you don't need any summary data. Hence no reducer.

    so, 1st query as no map-reduce, 2nd query has only mappers but no reduces.

    这篇关于你能解释何时以及为什么在配置单元中调用mapreduce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆