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

MCOL-392 Apply astyle

Make this branch apply our style guidelines
This commit is contained in:
Andrew Hutchings
2018-05-01 09:52:26 +01:00
parent 4ef4286022
commit c40903de9b
31 changed files with 176 additions and 123 deletions

View File

@ -320,9 +320,9 @@ int64_t Func_add_time::getDatetimeIntVal(rowgroup::Row& row,
}
int64_t Func_add_time::getTimeIntVal(rowgroup::Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& ct)
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& ct)
{
int64_t val1 = parm[0]->data()->getTimeIntVal(row, isNull);

View File

@ -165,6 +165,7 @@ int64_t Func_bitand::getIntVal(Row& row,
min = 0,
sec = 0,
msec = 0;
// Handle negative correctly
if ((time >> 40) & 0x800)
{
@ -172,8 +173,10 @@ int64_t Func_bitand::getIntVal(Row& row,
}
hour |= ((time >> 40) & 0xfff);
if ((hour >= 0) && (time >> 63))
hour*= -1;
hour *= -1;
min = (uint32_t)((time >> 32) & 0xff);
sec = (uint32_t)((time >> 24) & 0xff);
msec = (uint32_t)(time & 0xffffff);

View File

@ -546,9 +546,9 @@ int64_t Func_simple_case::getDatetimeIntVal(rowgroup::Row& row,
int64_t Func_simple_case::getTimeIntVal(rowgroup::Row& row,
FunctionParm& parm,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
FunctionParm& parm,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
{
uint64_t i = simple_case_cmp(row, parm, isNull, op_ct);

View File

@ -140,9 +140,9 @@ int64_t Func_coalesce::getDatetimeIntVal(rowgroup::Row& row,
}
int64_t Func_coalesce::getTimeIntVal(rowgroup::Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& ct)
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& ct)
{
int64_t val = 0;

View File

@ -135,26 +135,28 @@ long long dateGet( uint64_t time, IntervalColumn::interval_type unit, bool dateT
long long timeGet( uint64_t time, IntervalColumn::interval_type unit )
{
int32_t hour = 0,
min = 0,
sec = 0,
msec = 0,
day = 0;
min = 0,
sec = 0,
msec = 0,
day = 0;
min = (int32_t)((time >> 32) & 0xff);
sec = (int32_t)((time >> 24) & 0xff);
msec = (int32_t)((time & 0xfffff));
min = (int32_t)((time >> 32) & 0xff);
sec = (int32_t)((time >> 24) & 0xff);
msec = (int32_t)((time & 0xfffff));
// If negative, mask so it doesn't turn positive
int64_t mask = 0;
if ((time >> 40) & 0x800)
mask = 0xfffffffffffff000;
hour = mask | ((time >> 40) & 0xfff);
// If negative, mask so it doesn't turn positive
int64_t mask = 0;
if ((hour >= 0) && (time >> 63))
hour*= -1;
if ((time >> 40) & 0x800)
mask = 0xfffffffffffff000;
// Always positive!
day = abs(hour / 24);
hour = mask | ((time >> 40) & 0xfff);
if ((hour >= 0) && (time >> 63))
hour *= -1;
// Always positive!
day = abs(hour / 24);
switch ( unit )
{
@ -275,6 +277,7 @@ int64_t Func_extract::getIntVal(rowgroup::Row& row,
}
long long value;
if (isTime)
value = timeGet( time, unit );
else

View File

@ -207,9 +207,9 @@ int64_t Func_greatest::getDatetimeIntVal(rowgroup::Row& row,
}
int64_t Func_greatest::getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& ct)
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& ct)
{
// Strip off unused day
int64_t greatestStr = fp[0]->data()->getTimeIntVal(row, isNull);

View File

@ -130,6 +130,7 @@ int64_t Func_hour::getIntVal(rowgroup::Row& row,
// If negative, mask so it doesn't turn positive
bool isNeg = false;
int64_t mask = 0;
if ((val >> 40) & 0x800)
mask = 0xfffffffffffff000;
@ -137,9 +138,11 @@ int64_t Func_hour::getIntVal(rowgroup::Row& row,
{
isNeg = true;
}
val = mask | ((val >> 40) & 0xfff);
if (isNeg)
val*= -1;
val *= -1;
}
else
{

View File

@ -221,9 +221,9 @@ int64_t Func_if::getDatetimeIntVal(Row& row,
}
int64_t Func_if::getTimeIntVal(Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType&)
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType&)
{
if (boolVal(parm[0], row))
{

View File

@ -169,9 +169,9 @@ int64_t Func_ifnull::getDatetimeIntVal(Row& row,
}
int64_t Func_ifnull::getTimeIntVal(Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType&)
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType&)
{
if (isNull)
return 0;

View File

@ -223,9 +223,9 @@ int64_t Func_inet_aton::getDatetimeIntVal(rowgroup::Row& row,
}
int64_t Func_inet_aton::getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
{
int64_t iValue = joblist::TIMENULL;

View File

@ -257,9 +257,9 @@ int64_t Func_inet_ntoa::getDatetimeIntVal(rowgroup::Row& row,
}
int64_t Func_inet_ntoa::getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
{
// std::cout << "In Func_inet_ntoa::getTimeVal" << std::endl;

View File

@ -183,9 +183,9 @@ int64_t Func_least::getDatetimeIntVal(rowgroup::Row& row,
}
int64_t Func_least::getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
{
// Strip off unused day
int64_t leastStr = fp[0]->data()->getTimeIntVal(row, isNull);

View File

@ -129,8 +129,8 @@ int64_t Func_nullif::getIntVal(rowgroup::Row& row,
if ((parm[0]->data()->resultType().colDataType ==
execplan::CalpontSystemCatalog::DATE) ||
(parm[0]->data()->resultType().colDataType ==
execplan::CalpontSystemCatalog::DATETIME))
(parm[0]->data()->resultType().colDataType ==
execplan::CalpontSystemCatalog::DATETIME))
{
// NULLIF arg0 is DATE, arg1 is DATETIME,
@ -164,8 +164,8 @@ int64_t Func_nullif::getIntVal(rowgroup::Row& row,
if ((parm[0]->data()->resultType().colDataType ==
execplan::CalpontSystemCatalog::DATETIME) ||
(parm[0]->data()->resultType().colDataType ==
execplan::CalpontSystemCatalog::TIME))
(parm[0]->data()->resultType().colDataType ==
execplan::CalpontSystemCatalog::TIME))
{
// NULLIF arg0 is DATETIME, arg1 is TIME,
// Upgrade arg1 to time
@ -495,9 +495,9 @@ int64_t Func_nullif::getDatetimeIntVal(rowgroup::Row& row,
}
int64_t Func_nullif::getTimeIntVal(rowgroup::Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& ct)
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& ct)
{
int64_t exp1 = parm[0]->data()->getTimeIntVal(row, isNull);
int64_t exp2 = 0;

View File

@ -101,9 +101,9 @@ int64_t Func_sysdate::getDatetimeIntVal(rowgroup::Row& row,
}
int64_t Func_sysdate::getTimeIntVal(rowgroup::Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& operationColType)
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& operationColType)
{
return getIntVal(row, parm, isNull, operationColType);
}

View File

@ -111,6 +111,7 @@ string Func_time::getStrVal(rowgroup::Row& row,
val = parm[0]->data()->getTimeIntVal(row, isNull);
break;
}
case execplan::CalpontSystemCatalog::DATETIME:
{
val = parm[0]->data()->getTimeIntVal(row, isNull);

View File

@ -50,8 +50,8 @@ int64_t Func_time_to_sec::getIntVal(rowgroup::Row& row,
{
// assume 256 is enough. assume not allowing incomplete date
int32_t hour = 0,
min = 0,
sec = 0;
min = 0,
sec = 0;
bool bIsNegative = false; // Only set to true if CHAR or VARCHAR with a '-'
int64_t val = 0;
@ -72,16 +72,19 @@ int64_t Func_time_to_sec::getIntVal(rowgroup::Row& row,
case CalpontSystemCatalog::TIME:
val = parm[0]->data()->getTimeIntVal(row, isNull);
// If negative, mask so it doesn't turn positive
if ((val >> 40) & 0x800)
mask = 0xfffffffffffff000;
bIsNegative = val >> 63;
hour = (int32_t)(mask | ((val >> 40) & 0xfff));
if ((hour >= 0) && bIsNegative)
hour*= -1;
hour *= -1;
else
bIsNegative = false;
min = (int32_t)((val >> 32) & 0xff);
sec = (int32_t)((val >> 24) & 0xff);
break;
@ -162,6 +165,7 @@ int64_t Func_time_to_sec::getIntVal(rowgroup::Row& row,
}
int64_t rtn;
if (hour < 0)
{
rtn = (int64_t)(hour * 60 * 60) - (min * 60) - sec;

View File

@ -216,9 +216,9 @@ int64_t Func_timediff::getDatetimeIntVal(rowgroup::Row& row,
}
int64_t Func_timediff::getTimeIntVal(rowgroup::Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& ct)
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& ct)
{
return dataconvert::DataConvert::timeToInt(getStrVal(row, parm, isNull, ct));
}

View File

@ -117,9 +117,9 @@ public:
}
virtual int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
{
return intToTime(getIntVal(row, fp, isNull, op_ct));
}

View File

@ -105,10 +105,10 @@ public:
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
};
@ -158,9 +158,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
};
@ -206,9 +206,10 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);};
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
};
/** @brief Func_ifnull class
@ -252,9 +253,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
bool getBoolVal(rowgroup::Row& row,
FunctionParm& fp,
@ -309,9 +310,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
};
@ -357,9 +358,10 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);};
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
};
/** @brief Func_coalesce class
@ -403,9 +405,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
};
@ -435,9 +437,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getIntVal(rowgroup::Row& row,
FunctionParm& fp,

View File

@ -99,9 +99,9 @@ public:
}
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
{
isNull = true;
return 0;

View File

@ -138,9 +138,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getIntVal(rowgroup::Row& row,
FunctionParm& fp,
@ -254,9 +254,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
};
@ -324,9 +324,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
};
@ -361,9 +361,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
};
@ -393,9 +393,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getIntVal(rowgroup::Row& row,
FunctionParm& fp,
@ -439,9 +439,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
};
/** @brief Func_str_to_date class

View File

@ -655,9 +655,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
private:

View File

@ -90,9 +90,9 @@ public:
}
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct)
{
std::string str = getStrVal(row, fp, isNull, op_ct);
return (isNull ? 0 : stringToTime(str));
@ -685,9 +685,9 @@ public:
execplan::CalpontSystemCatalog::ColType& op_ct);
int64_t getTimeIntVal(rowgroup::Row& row,
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
FunctionParm& fp,
bool& isNull,
execplan::CalpontSystemCatalog::ColType& op_ct);
private:
void convertNtoa(int64_t ipNum, std::string& ipString);
};