Hive 2.x
-- 这句sql在hive中是无法执行的。 explain select id,id from people union select id,id from people
报错:
查看近似sql的查询计划。
Hive在使用union时,自动做了group by explain select city from test.student union select name from test.citys; 结合: explain select city from test.student group by city; explain select city,city from test.student group by city; explain select city,city from test.student group by city,city;
Hive在扫描不同/相同表时,采用的都是相同的临时变量名作为Map的输出。无法区分不同表的id.
Reduce时直接用Map输出的临时变量进行处理。
猜测:
Spark-Emr版本
explain select id,id from people union select id,id from people
spark在生成执行计划的时候,尽管是相同表的相同的id,但会添加上不同的数字标注。



