Fix for hive corr UDAF 

Applied patch from hive JIRA https://issues.apache.org/jira/browse/HIVE-3455
Added test for patch.