In our spark-2.1 cluster, when users sumbit queries like
select a, grouping(b), sum(c) from table group by a, b with cube
It works well. However, when the query is
select a, grouping(B), sum(c) from table group by a, b with cube
We will get the exception:
org.apache.spark.sql.AnalysisException: Column of grouping (B#11) can't be found in grouping columns a#10,b#11
The root cause is the replaceGroupingFunc's incorrect logic in ResolveGroupingAnalytics
rule. It indexes the column without resolver.