我正在对多个表进行多个 INSERT OVERWRITE 查询,以便仅扫描数据集 1 次,最终我得到所有这些表的内容相同!返回结果的 GROUP BY 查询似乎覆盖了所有临时表。
这是行为不端的查询:
FROM nikon
INSERT OVERWRITE TABLE e1
SELECT qs_cs_s_aid AS Emplacements, COUNT(*) AS Impressions
WHERE qs_cs_s_cat='PRINT' GROUP BY qs_cs_s_aid
INSERT OVERWRITE TABLE e2
SELECT qs_cs_s_aid AS Emplacements, COUNT(*) AS Vues
WHERE qs_cs_s_cat='VIEW' GROUP BY qs_cs_s_aid
;
它只启动一项 MR 作业,结果如下。为什么表“e1”包含表“e2”的结果?!表 'e1' 应该是空的(请参阅下面的个别 SELECT)
hive> SELECT * from e1;
OK
NULL 2
1627575 25
1627576 70
1690950 22
1690952 42
1696705 199
1696706 66
1696730 229
1696759 85
1696893 218
Time taken: 0.229 seconds
hive> SELECT * from e2;
OK
NULL 2
1627575 25
1627576 70
1690950 22
1690952 42
1696705 199
1696706 66
1696730 229
1696759 85
1696893 218
Time taken: 0.11 seconds
这是单个查询的结果(只有第二个查询返回结果集):
hive> SELECT qs_cs_s_aid AS Emplacements, COUNT(*) AS Impressions FROM nikon
WHERE qs_cs_s_cat='PRINT' GROUP BY qs_cs_s_aid;
(...)
OK
<- There are no results, this is normal
Time taken: 41.471 seconds
hive> SELECT qs_cs_s_aid AS Emplacements, COUNT(*) AS Vues FROM nikon
WHERE qs_cs_s_cat='VIEW' GROUP BY qs_cs_s_aid;
(...)
OK
NULL 2
1627575 25
1627576 70
1690950 22
1690952 42
1696705 199
1696706 66
1696730 229
1696759 85
1696893 218
Time taken: 39.607 seconds