1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-326 Fix negative rand seeding

Needs to be using 32bit ints to fully behave like MariaDB
This commit is contained in:
Andrew Hutchings
2016-10-03 16:09:11 +01:00
parent 2279c03f4b
commit 256c87c6f9

View File

@ -65,7 +65,8 @@ double Func_rand::getDoubleVal(rowgroup::Row& row,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
{
int64_t seedParm = 0;
// NOTE: this function needs to use 32bit ints otherwise it will break for negative values
uint32_t seedParm = 0;
// rand with parameter. if the parm is constanct, then a column is attached for fetching
if (parm.size() == 1 || parm.size() == 2)
{
@ -74,8 +75,8 @@ double Func_rand::getDoubleVal(rowgroup::Row& row,
{
/* Copied from item_func.cpp */
seedParm = parm[0]->data()->getIntVal(row, isNull);
fSeed1 = (uint64_t)(seedParm*0x10001L+55555555L);
fSeed2 = (uint64_t)(seedParm*0x10000001L);
fSeed1 = (uint32_t)(seedParm*0x10001L+55555555L);
fSeed2 = (uint32_t)(seedParm*0x10000001L);
fSeedSet = true;
}
}