mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-06-01 22:41:43 +03:00
Merge pull request #601 from mariadb-corporation/MCOL-1826
MCOL-1826 Fix race in FLOAT/DOUBLE to string
This commit is contained in:
commit
2bc98e9707
@ -55,10 +55,13 @@ string Func_concat::getStrVal(Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
CalpontSystemCatalog::ColType&)
|
CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
string ret = stringValue(parm[0], row, isNull);
|
string ret;
|
||||||
|
string tmp;
|
||||||
|
stringValue(parm[0], row, isNull, ret);
|
||||||
|
|
||||||
for ( unsigned int id = 1 ; id < parm.size() ; id++) {
|
for ( unsigned int id = 1 ; id < parm.size() ; id++) {
|
||||||
ret.append( stringValue(parm[id], row, isNull) );
|
stringValue(parm[id], row, isNull, tmp);
|
||||||
|
ret.append(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -49,7 +49,8 @@ string Func_concat_ws::getStrVal(Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
CalpontSystemCatalog::ColType&)
|
CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
string delim = stringValue(parm[0], row, isNull);
|
string delim;
|
||||||
|
stringValue(parm[0], row, isNull, delim);
|
||||||
if (isNull)
|
if (isNull)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
@ -62,7 +63,8 @@ string Func_concat_ws::getStrVal(Row& row,
|
|||||||
|
|
||||||
for ( unsigned int id = 1 ; id < parm.size() ; id++)
|
for ( unsigned int id = 1 ; id < parm.size() ; id++)
|
||||||
{
|
{
|
||||||
string tstr = stringValue(parm[id], row, isNull);
|
string tstr;
|
||||||
|
stringValue(parm[id], row, isNull, tstr);
|
||||||
if (isNull)
|
if (isNull)
|
||||||
{
|
{
|
||||||
isNull = false;
|
isNull = false;
|
||||||
@ -88,9 +90,11 @@ string Func_concat_ws::getStrVal(Row& row,
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
string str;
|
string str;
|
||||||
|
string tmp;
|
||||||
for ( uint32_t i = 1 ; i < parm.size() ; i++)
|
for ( uint32_t i = 1 ; i < parm.size() ; i++)
|
||||||
{
|
{
|
||||||
str += string(stringValue(parm[i], row, isNull).c_str());
|
string(stringValue(parm[i], row, isNull).c_str(), tmp);
|
||||||
|
str += tmp;
|
||||||
|
|
||||||
if (isNull)
|
if (isNull)
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,9 @@ string Func_elt::getStrVal(rowgroup::Row& row,
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return stringValue(parm[number], row, isNull);
|
std::string ret;
|
||||||
|
stringValue(parm[number], row, isNull, ret);
|
||||||
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,12 +86,14 @@ std::string Func_insert::getStrVal(rowgroup::Row& row,
|
|||||||
FunctionParm& fp,
|
FunctionParm& fp,
|
||||||
bool& isNull,
|
bool& isNull,
|
||||||
execplan::CalpontSystemCatalog::ColType&)
|
execplan::CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
const string& tstr = stringValue(fp[0], row, isNull);
|
string tstr;
|
||||||
|
stringValue(fp[0], row, isNull, tstr);
|
||||||
if (isNull)
|
if (isNull)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const string& tnewstr = stringValue(fp[3], row, isNull);
|
string tnewstr;
|
||||||
|
stringValue(fp[3], row, isNull, tnewstr);
|
||||||
if (isNull)
|
if (isNull)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
@ -61,7 +61,9 @@ std::string Func_repeat::getStrVal(rowgroup::Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
execplan::CalpontSystemCatalog::ColType& op_ct)
|
execplan::CalpontSystemCatalog::ColType& op_ct)
|
||||||
{
|
{
|
||||||
string str = stringValue(fp[0], row, isNull);
|
string str;
|
||||||
|
|
||||||
|
stringValue(fp[0], row, isNull, str);
|
||||||
|
|
||||||
if (str.empty() || str == "")
|
if (str.empty() || str == "")
|
||||||
return "";
|
return "";
|
||||||
|
@ -65,7 +65,8 @@ std::string Func_reverse::getStrVal(rowgroup::Row& row,
|
|||||||
bool& isNull,
|
bool& isNull,
|
||||||
execplan::CalpontSystemCatalog::ColType&)
|
execplan::CalpontSystemCatalog::ColType&)
|
||||||
{
|
{
|
||||||
string str = stringValue(fp[0], row, isNull);
|
string str;
|
||||||
|
stringValue(fp[0], row, isNull, str);
|
||||||
|
|
||||||
// We used to reverse in the string buffer, but that doesn't
|
// We used to reverse in the string buffer, but that doesn't
|
||||||
// work for all compilers as some re-use the buffer on simple
|
// work for all compilers as some re-use the buffer on simple
|
||||||
|
@ -85,7 +85,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const std::string& stringValue(execplan::SPTP& fp, rowgroup::Row& row, bool& isNull)
|
const void stringValue(execplan::SPTP& fp, rowgroup::Row& row, bool& isNull, std::string& fFloatStr)
|
||||||
{
|
{
|
||||||
// Bug3788, use the shorter of fixed or scientific notation for floating point values.
|
// Bug3788, use the shorter of fixed or scientific notation for floating point values.
|
||||||
// [ the default format in treenode.h is fixed-point notation ]
|
// [ the default format in treenode.h is fixed-point notation ]
|
||||||
@ -103,7 +103,8 @@ protected:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return fp->data()->getStrVal(row, isNull);
|
fFloatStr = fp->data()->getStrVal(row, isNull);
|
||||||
|
return;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
exponent = (int)floor(log10( fabs(floatVal)));
|
exponent = (int)floor(log10( fabs(floatVal)));
|
||||||
@ -121,10 +122,7 @@ protected:
|
|||||||
fFloatStr += buf;
|
fFloatStr += buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fFloatStr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string fFloatStr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user