SPARK-4459 added failing unit test
SPARK-4459 changed type parameter for groupBy from K to U.