蜂巢侧视图爆发内部机制

时间:2017-05-14 07:03:28

标签: hadoop hive mapreduce

我在单个表的一个查询中使用了横向视图多次爆发(大约9次)(大小约为12GB)。这产生了大量的地图侧数据(100Pb +)。我无法理解它是如何从12GB生成这么多数据的。

有人可以解释横向爆炸是如何起作用的(内部)吗?

提前致谢

1 个答案:

答案 0 :(得分:2)

演示

create table mytable (a1 array<int>,a2 array<int>,a3 array<int>);
insert into mytable select array(1,2),array(3,4,5),array(6,7,8,9);
select  *

from    mytable
        lateral view explode (a1) e1 as a1_val
        lateral view explode (a2) e2 as a2_val
        lateral view explode (a3) e3 as a3_val
;        
+-------+---------+-----------+--------+--------+--------+
|  a1   |   a2    |    a3     | a1_val | a2_val | a3_val |
+-------+---------+-----------+--------+--------+--------+
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      3 |      6 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      3 |      7 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      3 |      8 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      3 |      9 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      4 |      6 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      4 |      7 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      4 |      8 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      4 |      9 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      5 |      6 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      5 |      7 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      5 |      8 |
| [1,2] | [3,4,5] | [6,7,8,9] |      1 |      5 |      9 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      3 |      6 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      3 |      7 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      3 |      8 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      3 |      9 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      4 |      6 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      4 |      7 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      4 |      8 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      4 |      9 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      5 |      6 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      5 |      7 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      5 |      8 |
| [1,2] | [3,4,5] | [6,7,8,9] |      2 |      5 |      9 |
+-------+---------+-----------+--------+--------+--------+