Fixes #2 and Closes #2 , For single dim/metric the query should be transformed automatically into TopN whereas for more than one cases they should be fired as GroupBy.Requires changes to compiler .