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

MCOL-3760 Related. Fix bug3145 regression broken on rand()

This commit is contained in:
Jose Rojas
2020-03-10 03:01:05 +00:00
committed by jmrojas2332
parent 9db6e84ea2
commit 13716677d7
2 changed files with 12 additions and 4 deletions

View File

@ -53,7 +53,15 @@ double Func_rand::getRand()
fSeed1 += 23; fSeed1 += 23;
fSeed2 = (fSeed1 + fSeed2 + 33) % maxValue; fSeed2 = (fSeed1 + fSeed2 + 33) % maxValue;
fSeeds[fSeedIndex] = std::make_pair(fSeed1, fSeed2); if (fSeeds.size() > fSeedIndex)
{
fSeeds[fSeedIndex] = std::make_pair(fSeed1, fSeed2);
}
else
{
fSeeds.push_back(std::make_pair(fSeed1, fSeed2));
}
return (((double) fSeed1) / (double)maxValue); return (((double) fSeed1) / (double)maxValue);
} }

View File

@ -38,7 +38,7 @@ namespace funcexp
class Func_rand : public Func class Func_rand : public Func
{ {
public: public:
Func_rand() : Func("rand"), fSeed1(0), fSeed2(0), fSeedSet(false), fMultipleSeedsSet(false), fFirstRow(nullptr), fSeeds(){} Func_rand() : Func("rand"), fSeed1(0), fSeed2(0), fSeedSet(false), fMultipleSeedsSet(false), fFirstRow(NULL), fSeeds(){}
virtual ~Func_rand() {} virtual ~Func_rand() {}
double getRand(); double getRand();
@ -46,8 +46,8 @@ public:
{ {
fSeedSet = seedSet; fSeedSet = seedSet;
fMultipleSeedsSet = seedSet; fMultipleSeedsSet = seedSet;
fFirstRow = nullptr; fFirstRow = NULL;
fSeeds = {}; fSeeds.clear();
} }
execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType); execplan::CalpontSystemCatalog::ColType operationType(FunctionParm& fp, execplan::CalpontSystemCatalog::ColType& resultType);