Applied patch https://issues.apache.org/jira/browse/HIVE-2332

Fix ArrayOutOfBoundsException in hive caused by the case where expressions in the GROUP BY appear in the DISTINCT clause.