Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Reviewed
Description
A simple multi-group by statement is not optimized. A simple statement like:
FROM SRC
INSERT OVERWRITE TABLE DEST1 SELECT SRC.key, count(distinct SUBSTR(SRC.value,4)) GROUP BY SRC.key
INSERT OVERWRITE TABLE DEST2 SELECT SRC.key, count(distinct SUBSTR(SRC.value,4)) GROUP BY SRC.key;
results in making 2 copies of the data (SRC). Instead, the data can be first partially aggregated on the distinct value and then aggregated.
The first step can be common to all group bys.