You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Fix another 0 count error in dropValue
This commit is contained in:
committed by
Leonid Fedorov
parent
e7cab8445c
commit
680633a350
@ -173,14 +173,23 @@ mcsv1_UDAF::ReturnCode covar_samp::dropValue(mcsv1Context* context, ColumnDatum*
|
||||
long double cxyPrev = data->cxy;
|
||||
--data->cnt;
|
||||
uint64_t cnt = data->cnt;
|
||||
long double dx = valx - avgxPrev;
|
||||
if (cnt == 0)
|
||||
{
|
||||
data->avgx = 0;
|
||||
data->avgy = 0;
|
||||
data->cxy = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
long double dx = valx - avgxPrev;
|
||||
|
||||
avgyPrev -= (valy - avgyPrev) / cnt;
|
||||
avgxPrev -= dx / cnt;
|
||||
cxyPrev -= dx * (valy - avgyPrev);
|
||||
avgyPrev -= (valy - avgyPrev) / cnt;
|
||||
avgxPrev -= dx / cnt;
|
||||
cxyPrev -= dx * (valy - avgyPrev);
|
||||
|
||||
data->avgx = avgxPrev;
|
||||
data->avgy = avgyPrev;
|
||||
data->cxy = cxyPrev;
|
||||
data->avgx = avgxPrev;
|
||||
data->avgy = avgyPrev;
|
||||
data->cxy = cxyPrev;
|
||||
}
|
||||
return mcsv1_UDAF::SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user