我有多个文件,使用配置单元union all通过单个文件组合它们,现在union all查询连接超过10个配置单元表,并且非常慢。每个单独的union all查询也有一个或多个联接条件。
我期望的最终结果也需要按主键分组,例如:
table 1
key1|val1|val2|..
table 2
key1|val10|val11|..
insert overwrite <temptable>
select key, output_string from
(select key, concat (col1,col2,..) from table 1 where <join conditions>
union all
select key, concat(col10,col11,..) from table 2 where <join conditions>
..
)
cluster by key;union all将合并以上两个表,我使用逐个键来产生所需的结果。hive的性能非常慢,还有其他选择吗?
发布于 2016-04-16 10:45:19
请注意此选项:
hive.optimize.union.remove
Default Value: false
Added In: Hive 0.10.0 with HIVE-3276是否移除联合并将联合和文件接收器之间的运算符推到联合之上。这避免了联合对输出进行额外的扫描。
这对于联合查询非常有用,当hive.optimize.skewjoin.compiletime设置为true时尤其有用,因为插入了一个额外的联合。
如果hive.merge.mapfiles或hive.merge.mapredfiles设置为true,则会触发合并。
如果用户将hive.merge.mapfiles设置为true,将hive.merge.mapredfiles设置为false,那么其想法是reducers的数量很少,因此文件的数量也很小。
然而,通过这种优化,我们可能会大大增加文件的数量。因此,我们积极地进行合并。
https://stackoverflow.com/questions/36654331
复制相似问题