CORR and COVAR_SAMP compliant with SQL:2011
Learn about the changes introduced to ensure that the CORR and COVAR_SAMP built-in aggregate functions (UDAFs) are in compliance with the SQL:2011 standards.
Before upgrade to CDP
The CORR and COVAR_SAMP aggregate functions were not in compliance with SQL:2011 standards.
CORR returned 'NaN' for
N*SUM(x*x) = SUM(x)*SUM(x) and
SUM(y)*SUM(y). However, the function is expected to return NULL per the standards.
Similarly, COVAR_SAMP returns '0' when the function is applied to a set with a single element. The function is expected to return NULL.
After upgrade to CDP
HIVE-16178 fixes the compliance issues and ensures that these functions comply with SQL:2011 standards.