Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Duplicate
-
None
-
None
-
None
Description
Consider the following table: t(a : String, b : String) and the query
select a, concat(b, '1'), count(*) from t group by a, concat(b, '1') with cube
The projections in the Expand operator are not setup correctly. The expand logic in Analyzer:expand is comparing grouping expressions against child.output. So concat(b, '1') is never mapped to a null Literal.
A simple fix is to add a Rule to introduce a Projection below the Cube/Rollup/GrpSet operator that additionally projects the groupingExpressions that are missing in the child.
Marking this as Critical, because you get wrong results.