You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
Merge branch 'develop-1.1' into 1.2-merge-up-20190111
This commit is contained in:
@ -650,6 +650,11 @@ int main(int argc, char** argv)
|
|||||||
rc = execBulkRollbackReq( msgQueClts, pmList,
|
rc = execBulkRollbackReq( msgQueClts, pmList,
|
||||||
&brm, tInfo, tblName.toString(), rollbackOnly, errMsg );
|
&brm, tInfo, tblName.toString(), rollbackOnly, errMsg );
|
||||||
|
|
||||||
|
BRM::TxnID txn;
|
||||||
|
txn.id = tInfo.ownerTxnID;
|
||||||
|
txn.valid = true;
|
||||||
|
brm.rolledback(txn);
|
||||||
|
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
{
|
{
|
||||||
logFinalStatus( tblName.toString(), lockID, errMsg );
|
logFinalStatus( tblName.toString(), lockID, errMsg );
|
||||||
|
@ -325,6 +325,28 @@ template<> void WindowFunctionType::setValue<string>(uint64_t i, string& t)
|
|||||||
fRow.setStringField(t, i);
|
fRow.setStringField(t, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MCOL-1676 Need a separate specialization for string now.
|
||||||
|
template<>
|
||||||
|
void WindowFunctionType::setValue<string>(int ct, int64_t b, int64_t e, int64_t c, string* v)
|
||||||
|
{
|
||||||
|
if (c != WF__BOUND_ALL)
|
||||||
|
b = e = c;
|
||||||
|
|
||||||
|
uint64_t i = fFieldIndex[0];
|
||||||
|
|
||||||
|
if (v == NULL)
|
||||||
|
v = (string*) getNullValueByType(ct, i);
|
||||||
|
|
||||||
|
for (int64_t j = b; j <= e; j++)
|
||||||
|
{
|
||||||
|
if (j % 1000 == 0 && fStep->cancelled())
|
||||||
|
break;
|
||||||
|
|
||||||
|
fRow.setData(getPointer((*fRowData)[j]));
|
||||||
|
setValue(i, *v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void WindowFunctionType::setValue(int ct, int64_t b, int64_t e, int64_t c, T* v)
|
void WindowFunctionType::setValue(int ct, int64_t b, int64_t e, int64_t c, T* v)
|
||||||
{
|
{
|
||||||
@ -342,8 +364,54 @@ void WindowFunctionType::setValue(int ct, int64_t b, int64_t e, int64_t c, T* v)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
fRow.setData(getPointer((*fRowData)[j]));
|
fRow.setData(getPointer((*fRowData)[j]));
|
||||||
setValue(i, *v);
|
// MCOL-1676 Set the data based on out column type (ct)
|
||||||
}
|
switch (ct)
|
||||||
|
{
|
||||||
|
case CalpontSystemCatalog::TINYINT:
|
||||||
|
case CalpontSystemCatalog::SMALLINT:
|
||||||
|
case CalpontSystemCatalog::MEDINT:
|
||||||
|
case CalpontSystemCatalog::INT:
|
||||||
|
case CalpontSystemCatalog::BIGINT:
|
||||||
|
case CalpontSystemCatalog::DECIMAL:
|
||||||
|
{
|
||||||
|
int64_t iv = *v;
|
||||||
|
setValue(i, iv);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CalpontSystemCatalog::UTINYINT:
|
||||||
|
case CalpontSystemCatalog::USMALLINT:
|
||||||
|
case CalpontSystemCatalog::UMEDINT:
|
||||||
|
case CalpontSystemCatalog::UINT:
|
||||||
|
case CalpontSystemCatalog::UBIGINT:
|
||||||
|
case CalpontSystemCatalog::UDECIMAL:
|
||||||
|
{
|
||||||
|
uint64_t uv = *v;
|
||||||
|
setValue(i, uv);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CalpontSystemCatalog::DOUBLE:
|
||||||
|
case CalpontSystemCatalog::UDOUBLE:
|
||||||
|
{
|
||||||
|
double dv = *v;
|
||||||
|
setValue(i, dv);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CalpontSystemCatalog::FLOAT:
|
||||||
|
case CalpontSystemCatalog::UFLOAT:
|
||||||
|
{
|
||||||
|
float fv = *v;
|
||||||
|
setValue(i, fv);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
setValue(i, *v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -476,8 +544,6 @@ template void WindowFunctionType::setValue<int64_t>(int, int64_t, int64_t, int64
|
|||||||
template void WindowFunctionType::setValue<uint64_t>(int, int64_t, int64_t, int64_t, uint64_t*);
|
template void WindowFunctionType::setValue<uint64_t>(int, int64_t, int64_t, int64_t, uint64_t*);
|
||||||
template void WindowFunctionType::setValue<float>(int, int64_t, int64_t, int64_t, float*);
|
template void WindowFunctionType::setValue<float>(int, int64_t, int64_t, int64_t, float*);
|
||||||
template void WindowFunctionType::setValue<double>(int, int64_t, int64_t, int64_t, double*);
|
template void WindowFunctionType::setValue<double>(int, int64_t, int64_t, int64_t, double*);
|
||||||
template void WindowFunctionType::setValue<string>(int, int64_t, int64_t, int64_t, string*);
|
|
||||||
|
|
||||||
|
|
||||||
void* WindowFunctionType::getNullValueByType(int ct, int pos)
|
void* WindowFunctionType::getNullValueByType(int ct, int pos)
|
||||||
{
|
{
|
||||||
|
@ -2742,6 +2742,7 @@ uint8_t WE_DMLCommandProc::processUpdate(messageqcpp::ByteStream& bs,
|
|||||||
boost::scoped_array<int> preBlkNums(new int[columnsUpdated.size()]);
|
boost::scoped_array<int> preBlkNums(new int[columnsUpdated.size()]);
|
||||||
boost::scoped_array<OID> oids(new OID[columnsUpdated.size()]);
|
boost::scoped_array<OID> oids(new OID[columnsUpdated.size()]);
|
||||||
|
|
||||||
|
BRMWrapper::setUseVb(true);
|
||||||
for (unsigned int j = 0; j < columnsUpdated.size(); j++)
|
for (unsigned int j = 0; j < columnsUpdated.size(); j++)
|
||||||
{
|
{
|
||||||
//timer.start("lookupsyscat");
|
//timer.start("lookupsyscat");
|
||||||
|
@ -178,97 +178,38 @@ const std::string Convertor::int2Str(int val)
|
|||||||
* converted long long for specified "field"
|
* converted long long for specified "field"
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
/* static */
|
/* static */
|
||||||
|
|
||||||
long long Convertor::convertDecimalString(
|
long long Convertor::convertDecimalString(
|
||||||
const char* field,
|
const char* field,
|
||||||
int fieldLength,
|
int fieldLength,
|
||||||
int scale )
|
int scale)
|
||||||
{
|
{
|
||||||
long long llVal = 0;
|
long double dval = strtold(field, NULL);
|
||||||
|
long long ret = 0;
|
||||||
|
|
||||||
int nDigitsBeforeDecPt = 0;
|
|
||||||
int nDigitsAfterDecPt = 0;
|
// move scale digits to the left of the decimal point
|
||||||
long long roundUp = 0; //@bug 3405 round off decimal column values
|
for (int i = 0; i < scale; i++)
|
||||||
|
dval *= 10;
|
||||||
|
|
||||||
// Determine the number of digits before and after the decimal point
|
|
||||||
char* posDecPt = (char*)memchr(field, '.', fieldLength);
|
// range check against int64
|
||||||
|
if (dval > LLONG_MAX || dval < LLONG_MIN)
|
||||||
|
errno = ERANGE;
|
||||||
|
|
||||||
if (posDecPt)
|
|
||||||
{
|
|
||||||
nDigitsBeforeDecPt = posDecPt - field;
|
|
||||||
nDigitsAfterDecPt = fieldLength - nDigitsBeforeDecPt - 1;
|
|
||||||
|
|
||||||
//@bug 3405 round off decimal column values
|
|
||||||
// We look at the scale+1 digit to see if we need to round up.
|
|
||||||
if (nDigitsAfterDecPt > scale)
|
|
||||||
{
|
|
||||||
char roundOffDigit = *(posDecPt + 1 + scale);
|
|
||||||
|
|
||||||
if ( (roundOffDigit > '4') &&
|
|
||||||
(roundOffDigit <= '9') ) // round up
|
|
||||||
{
|
|
||||||
roundUp = 1;
|
|
||||||
|
|
||||||
// We can't just use the sign of llVal to determine whether to
|
|
||||||
// add +1 or -1, because if we read in -0.005 with scale 2, we
|
|
||||||
// end up parsing "-0.00", which yields 0; meaning we lose the
|
|
||||||
// sign. So better (though maybe slower) to look for any lead-
|
|
||||||
// ing negative sign in the input string.
|
|
||||||
for (int k = 0; k < fieldLength; k++)
|
|
||||||
{
|
|
||||||
if (!isspace(field[k]))
|
|
||||||
{
|
|
||||||
if (field[k] == '-')
|
|
||||||
roundUp = -1;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
nDigitsBeforeDecPt = fieldLength;
|
|
||||||
nDigitsAfterDecPt = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Strip out the decimal point by stringing together
|
errno = 0;
|
||||||
// the digits before and after the decimal point.
|
|
||||||
char* data = (char*)alloca(nDigitsBeforeDecPt + scale + 1);
|
ret = dval;
|
||||||
memcpy(data, field, nDigitsBeforeDecPt);
|
|
||||||
|
// get the fractional part of what's left & round ret up or down.
|
||||||
if (nDigitsAfterDecPt)
|
dval -= ret;
|
||||||
{
|
if (dval >= 0.5 && ret < LLONG_MAX)
|
||||||
if (scale > nDigitsAfterDecPt)
|
++ret;
|
||||||
memcpy(data + nDigitsBeforeDecPt,
|
else if (dval <= -0.5 && ret > LLONG_MIN)
|
||||||
field + nDigitsBeforeDecPt + 1,
|
--ret;
|
||||||
nDigitsAfterDecPt);
|
return ret;
|
||||||
else // (scale <= nDigitsAfterDecPt)
|
|
||||||
memcpy(data + nDigitsBeforeDecPt,
|
|
||||||
field + nDigitsBeforeDecPt + 1,
|
|
||||||
scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add on any necessary zero padding at the end
|
|
||||||
if (scale > nDigitsAfterDecPt)
|
|
||||||
{
|
|
||||||
memset(data + nDigitsBeforeDecPt + nDigitsAfterDecPt,
|
|
||||||
'0',
|
|
||||||
scale - nDigitsAfterDecPt);
|
|
||||||
}
|
|
||||||
|
|
||||||
data[nDigitsBeforeDecPt + scale] = '\0';
|
|
||||||
|
|
||||||
// Convert our constructed decimal string back to a long long
|
|
||||||
//@bug 1814 Force strtoll to use base 10
|
|
||||||
errno = 0;
|
|
||||||
llVal = strtoll(data, 0, 10);
|
|
||||||
|
|
||||||
//@bug 3405 round off decimal values
|
|
||||||
if ((roundUp) && (errno == 0))
|
|
||||||
llVal += roundUp;
|
|
||||||
|
|
||||||
return llVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
Reference in New Issue
Block a user