1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-1793 Refactor to handle another edge case. Also fix CORR and reset

This commit is contained in:
David Hall
2018-11-28 15:49:34 -06:00
parent bbe642b1bc
commit ed43876695
3 changed files with 14 additions and 25 deletions

View File

@ -144,7 +144,7 @@ mcsv1_UDAF::ReturnCode corr::evaluate(mcsv1Context* context, static_any::any& va
{
struct corr_data* data = (struct corr_data*)context->getUserData()->data;
double N = data->cnt;
if (N > 0)
if (N > 1)
{
double sumx = data->sumx;
double sumy = data->sumy;
@ -161,8 +161,7 @@ mcsv1_UDAF::ReturnCode corr::evaluate(mcsv1Context* context, static_any::any& va
double var_popy = (sumy2 - (sumy * sumy / N)) / N;
if (var_popy == 0)
{
// When var_popy is 0, 1 is the result
valOut = 1.0;
// When var_popy is 0, NULL is the result
return mcsv1_UDAF::SUCCESS;
}
double std_popx = sqrt(var_popx);