You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Merge pull request #1049 from pleblanc1976/mcol-3776
Mcol 3776 - shared but unsync'd timezone var
This commit is contained in:
committed by
Patrick LeBlanc
parent
0db52396f9
commit
d6ef3cad3d
@ -181,7 +181,7 @@ int64_t Func_add_time::getTimestampIntVal(rowgroup::Row& row,
|
||||
TimeStamp timestamp(val1);
|
||||
int64_t seconds = timestamp.second;
|
||||
MySQLTime m_time;
|
||||
gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
dt1.year = m_time.year;
|
||||
dt1.month = m_time.month;
|
||||
dt1.day = m_time.day;
|
||||
|
@ -344,7 +344,7 @@ CalpontSystemCatalog::ColType Func_between::operationType( FunctionParm& fp, Cal
|
||||
if (cc)
|
||||
{
|
||||
Result result = cc->result();
|
||||
result.intVal = dataconvert::DataConvert::timestampToInt(result.strVal, fTimeZone);
|
||||
result.intVal = dataconvert::DataConvert::timestampToInt(result.strVal, timeZone());
|
||||
cc->result(result);
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ int64_t Func_bitand::getIntVal(Row& row,
|
||||
TimeStamp timestamp(parm[i]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
MySQLTime m_time;
|
||||
gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
|
||||
values.push_back((m_time.month * 100000000000000) + (m_time.day * 1000000000000) + (m_time.hour * 10000000000) + (m_time.minute * 100000000) + (m_time.second * 1000000) + timestamp.msecond);
|
||||
}
|
||||
|
@ -195,8 +195,8 @@ int64_t Func_bitand::getIntVal(Row& row,
|
||||
uint64_t val1 = 0;
|
||||
uint64_t val2 = 0;
|
||||
|
||||
if (!getUIntValFromParm(row, parm[0], val1, isNull, fTimeZone) ||
|
||||
!getUIntValFromParm(row, parm[1], val2, isNull, fTimeZone))
|
||||
if (!getUIntValFromParm(row, parm[0], val1, isNull, timeZone()) ||
|
||||
!getUIntValFromParm(row, parm[1], val2, isNull, timeZone()))
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "bitand: datatype of " << execplan::colDataTypeToString(operationColType.colDataType);
|
||||
@ -231,8 +231,8 @@ int64_t Func_leftshift::getIntVal(Row& row,
|
||||
uint64_t val1 = 0;
|
||||
uint64_t val2 = 0;
|
||||
|
||||
if (!getUIntValFromParm(row, parm[0], val1, isNull, fTimeZone) ||
|
||||
!getUIntValFromParm(row, parm[1], val2, isNull, fTimeZone))
|
||||
if (!getUIntValFromParm(row, parm[0], val1, isNull, timeZone()) ||
|
||||
!getUIntValFromParm(row, parm[1], val2, isNull, timeZone()))
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "leftshift: datatype of " << execplan::colDataTypeToString(operationColType.colDataType);
|
||||
@ -267,8 +267,8 @@ int64_t Func_rightshift::getIntVal(Row& row,
|
||||
uint64_t val1 = 0;
|
||||
uint64_t val2 = 0;
|
||||
|
||||
if (!getUIntValFromParm(row, parm[0], val1, isNull, fTimeZone) ||
|
||||
!getUIntValFromParm(row, parm[1], val2, isNull, fTimeZone))
|
||||
if (!getUIntValFromParm(row, parm[0], val1, isNull, timeZone()) ||
|
||||
!getUIntValFromParm(row, parm[1], val2, isNull, timeZone()))
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "rightshift: datatype of " << execplan::colDataTypeToString(operationColType.colDataType);
|
||||
@ -303,8 +303,8 @@ int64_t Func_bitor::getIntVal(Row& row,
|
||||
uint64_t val1 = 0;
|
||||
uint64_t val2 = 0;
|
||||
|
||||
if (!getUIntValFromParm(row, parm[0], val1, isNull, fTimeZone) ||
|
||||
!getUIntValFromParm(row, parm[1], val2, isNull, fTimeZone))
|
||||
if (!getUIntValFromParm(row, parm[0], val1, isNull, timeZone()) ||
|
||||
!getUIntValFromParm(row, parm[1], val2, isNull, timeZone()))
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "bitor: datatype of " << execplan::colDataTypeToString(operationColType.colDataType);
|
||||
@ -347,8 +347,8 @@ int64_t Func_bitxor::getIntVal(Row& row,
|
||||
uint64_t val1 = 0;
|
||||
uint64_t val2 = 0;
|
||||
|
||||
if (!getUIntValFromParm(row, parm[0], val1, isNull, fTimeZone) ||
|
||||
!getUIntValFromParm(row, parm[1], val2, isNull, fTimeZone))
|
||||
if (!getUIntValFromParm(row, parm[0], val1, isNull, timeZone()) ||
|
||||
!getUIntValFromParm(row, parm[1], val2, isNull, timeZone()))
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "bitxor: datatype of " << execplan::colDataTypeToString(operationColType.colDataType);
|
||||
@ -382,7 +382,7 @@ int64_t Func_bit_count::getIntVal(Row& row,
|
||||
|
||||
uint64_t val = 0;
|
||||
|
||||
if (!getUIntValFromParm(row, parm[0], val, isNull, fTimeZone))
|
||||
if (!getUIntValFromParm(row, parm[0], val, isNull, timeZone()))
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "bit_count: datatype of " << execplan::colDataTypeToString(operationColType.colDataType);
|
||||
|
@ -218,7 +218,7 @@ int64_t Func_cast_signed::getIntVal(Row& row,
|
||||
int64_t time = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
TimeStamp dt(time);
|
||||
return dt.convertToMySQLint(fTimeZone);
|
||||
return dt.convertToMySQLint(timeZone());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -379,7 +379,7 @@ uint64_t Func_cast_unsigned::getUintVal(Row& row,
|
||||
int64_t time = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
|
||||
TimeStamp dt(time);
|
||||
return dt.convertToMySQLint(fTimeZone);
|
||||
return dt.convertToMySQLint(timeZone());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -509,7 +509,7 @@ string Func_cast_char::getStrVal(Row& row,
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
return dataconvert::DataConvert::timestampToString(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone).substr(0, length);
|
||||
return dataconvert::DataConvert::timestampToString(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone()).substr(0, length);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -676,7 +676,7 @@ int32_t Func_cast_date::getDateIntVal(rowgroup::Row& row,
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t val1 = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
string value = dataconvert::DataConvert::timestampToString(val1, fTimeZone);
|
||||
string value = dataconvert::DataConvert::timestampToString(val1, timeZone());
|
||||
value = value.substr(0, 10);
|
||||
return dataconvert::DataConvert::stringToDate(value);
|
||||
}
|
||||
@ -803,7 +803,7 @@ int64_t Func_cast_date::getDatetimeIntVal(rowgroup::Row& row,
|
||||
TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
MySQLTime m_time;
|
||||
gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
DateTime dt;
|
||||
dt.year = m_time.year;
|
||||
dt.month = m_time.month;
|
||||
@ -985,7 +985,7 @@ int64_t Func_cast_datetime::getDatetimeIntVal(rowgroup::Row& row,
|
||||
TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
MySQLTime m_time;
|
||||
gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
DateTime dt;
|
||||
dt.year = m_time.year;
|
||||
dt.month = m_time.month;
|
||||
@ -1099,7 +1099,7 @@ int64_t Func_cast_datetime::getTimeIntVal(rowgroup::Row& row,
|
||||
TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
MySQLTime m_time;
|
||||
gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
Time time;
|
||||
time.hour = m_time.hour;
|
||||
time.minute = m_time.minute;
|
||||
@ -1478,7 +1478,7 @@ IDB_Decimal Func_cast_decimal::getDecimalVal(Row& row,
|
||||
{
|
||||
int32_t s = 0;
|
||||
|
||||
string value = dataconvert::DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
string value = dataconvert::DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
|
||||
|
||||
//strip off micro seconds
|
||||
string date = value.substr(0, 14);
|
||||
@ -1599,7 +1599,7 @@ double Func_cast_double::getDoubleVal(Row& row,
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
string str =
|
||||
DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
|
||||
|
||||
// strip off micro seconds
|
||||
str = str.substr(0, 14);
|
||||
|
@ -164,7 +164,7 @@ int64_t Func_ceil::getIntVal(Row& row,
|
||||
TimeStamp dt(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
|
||||
if (!isNull)
|
||||
ret = dt.convertToMySQLint(fTimeZone);
|
||||
ret = dt.convertToMySQLint(timeZone());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -269,7 +269,7 @@ uint64_t Func_ceil::getUintVal(Row& row,
|
||||
TimeStamp dt(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
|
||||
if (!isNull)
|
||||
ret = dt.convertToMySQLint(fTimeZone);
|
||||
ret = dt.convertToMySQLint(timeZone());
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -103,7 +103,7 @@ int64_t Func_char_length::getIntVal(rowgroup::Row& row,
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
string date = dataconvert::DataConvert::timestampToString(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
string date = dataconvert::DataConvert::timestampToString(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
|
||||
return (int64_t)date.size();
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ int64_t Func_date::getIntVal(rowgroup::Row& row,
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
int64_t val1 = parm[0]->data()->getTimestampIntVal(row, isNull);
|
||||
value = dataconvert::DataConvert::timestampToString(val1, fTimeZone);
|
||||
value = dataconvert::DataConvert::timestampToString(val1, timeZone());
|
||||
value = value.substr(0, 10);
|
||||
break;
|
||||
}
|
||||
|
@ -782,7 +782,7 @@ int64_t Func_date_add::getIntVal(rowgroup::Row& row,
|
||||
TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
MySQLTime m_time;
|
||||
gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
DateTime dt;
|
||||
dt.year = m_time.year;
|
||||
dt.month = m_time.month;
|
||||
|
@ -275,7 +275,7 @@ string Func_date_format::getStrVal(rowgroup::Row& row,
|
||||
TimeStamp timestamp(val);
|
||||
int64_t seconds = timestamp.second;
|
||||
MySQLTime time;
|
||||
gmtSecToMySQLTime(seconds, time, fTimeZone);
|
||||
gmtSecToMySQLTime(seconds, time, timeZone());
|
||||
dt.year = time.year;
|
||||
dt.month = time.month;
|
||||
dt.day = time.day;
|
||||
@ -419,7 +419,7 @@ int64_t Func_date_format::getTimestampIntVal(rowgroup::Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
return dataconvert::DataConvert::timestampToInt(getStrVal(row, parm, isNull, ct), fTimeZone);
|
||||
return dataconvert::DataConvert::timestampToInt(getStrVal(row, parm, isNull, ct), timeZone());
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ int64_t Func_day::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
return m_time.day;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ int64_t Func_dayname::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(val);
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, timeZone());
|
||||
year = time.year;
|
||||
month = time.month;
|
||||
day = time.day;
|
||||
|
@ -77,7 +77,7 @@ int64_t Func_dayofweek::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(val);
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, timeZone());
|
||||
year = time.year;
|
||||
month = time.month;
|
||||
day = time.day;
|
||||
|
@ -76,7 +76,7 @@ int64_t Func_dayofyear::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
year = m_time.year;
|
||||
month = m_time.month;
|
||||
day = m_time.day;
|
||||
|
@ -252,7 +252,7 @@ int64_t Func_extract::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
dataconvert::DateTime dt;
|
||||
dt.year = m_time.year;
|
||||
dt.month = m_time.month;
|
||||
|
@ -161,7 +161,7 @@ int64_t Func_floor::getIntVal(Row& row,
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
string str =
|
||||
DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
|
||||
|
||||
// strip off micro seconds
|
||||
str = str.substr(0, 14);
|
||||
@ -278,7 +278,7 @@ uint64_t Func_floor::getUintVal(Row& row,
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
string str =
|
||||
DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
|
||||
|
||||
// strip off micro seconds
|
||||
str = str.substr(0, 14);
|
||||
|
@ -114,7 +114,7 @@ int64_t Func_hour::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
return m_time.hour;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ int64_t Func_if::getIntVal(Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
if (boolVal(parm[0], row, fTimeZone))
|
||||
if (boolVal(parm[0], row, timeZone()))
|
||||
{
|
||||
return parm[1]->data()->getIntVal(row, isNull);
|
||||
}
|
||||
@ -151,7 +151,7 @@ string Func_if::getStrVal(Row& row,
|
||||
CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
|
||||
if (boolVal(parm[0], row, fTimeZone))
|
||||
if (boolVal(parm[0], row, timeZone()))
|
||||
{
|
||||
return parm[1]->data()->getStrVal(row, isNull);
|
||||
}
|
||||
@ -167,7 +167,7 @@ IDB_Decimal Func_if::getDecimalVal(Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
if (boolVal(parm[0], row, fTimeZone))
|
||||
if (boolVal(parm[0], row, timeZone()))
|
||||
{
|
||||
return parm[1]->data()->getDecimalVal(row, isNull);
|
||||
}
|
||||
@ -183,7 +183,7 @@ double Func_if::getDoubleVal(Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
if (boolVal(parm[0], row, fTimeZone))
|
||||
if (boolVal(parm[0], row, timeZone()))
|
||||
{
|
||||
return parm[1]->data()->getDoubleVal(row, isNull);
|
||||
}
|
||||
@ -198,7 +198,7 @@ long double Func_if::getLongDoubleVal(Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
if (boolVal(parm[0], row, fTimeZone))
|
||||
if (boolVal(parm[0], row, timeZone()))
|
||||
{
|
||||
return parm[1]->data()->getLongDoubleVal(row, isNull);
|
||||
}
|
||||
@ -214,7 +214,7 @@ int32_t Func_if::getDateIntVal(Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
if (boolVal(parm[0], row, fTimeZone))
|
||||
if (boolVal(parm[0], row, timeZone()))
|
||||
{
|
||||
return parm[1]->data()->getDateIntVal(row, isNull);
|
||||
}
|
||||
@ -230,7 +230,7 @@ int64_t Func_if::getDatetimeIntVal(Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
if (boolVal(parm[0], row, fTimeZone))
|
||||
if (boolVal(parm[0], row, timeZone()))
|
||||
{
|
||||
return parm[1]->data()->getDatetimeIntVal(row, isNull);
|
||||
}
|
||||
@ -246,7 +246,7 @@ int64_t Func_if::getTimestampIntVal(Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
if (boolVal(parm[0], row, fTimeZone))
|
||||
if (boolVal(parm[0], row, timeZone()))
|
||||
{
|
||||
return parm[1]->data()->getTimestampIntVal(row, isNull);
|
||||
}
|
||||
@ -262,7 +262,7 @@ int64_t Func_if::getTimeIntVal(Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType&)
|
||||
{
|
||||
if (boolVal(parm[0], row, fTimeZone))
|
||||
if (boolVal(parm[0], row, timeZone()))
|
||||
{
|
||||
return parm[1]->data()->getTimeIntVal(row, isNull);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ int64_t Func_last_day::getIntVal(rowgroup::Row& row,
|
||||
TimeStamp timestamp(parm[0]->data()->getIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
MySQLTime m_time;
|
||||
gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
year = m_time.year;
|
||||
month = m_time.month;
|
||||
day = m_time.day;
|
||||
|
@ -1834,7 +1834,7 @@ string Func_format::getStrVal(Row& row,
|
||||
|
||||
case execplan::CalpontSystemCatalog::TIMESTAMP:
|
||||
{
|
||||
value = dataconvert::DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
value = dataconvert::DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -114,7 +114,7 @@ int64_t Func_minute::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
return m_time.minute;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ int64_t Func_month::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
return m_time.month;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ int64_t Func_monthname::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(val);
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, timeZone());
|
||||
return time.month;
|
||||
}
|
||||
|
||||
|
@ -978,7 +978,7 @@ execplan::IDB_Decimal Func_nullif::getDecimalVal(rowgroup::Row& row,
|
||||
string value;
|
||||
|
||||
if (parm[1]->data()->resultType().colDataType == execplan::CalpontSystemCatalog::TIMESTAMP)
|
||||
value = DataConvert::timestampToString1(parm[1]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
value = DataConvert::timestampToString1(parm[1]->data()->getTimestampIntVal(row, isNull), timeZone());
|
||||
else
|
||||
value = DataConvert::datetimeToString1(parm[1]->data()->getDatetimeIntVal(row, isNull));
|
||||
|
||||
|
@ -70,7 +70,7 @@ int64_t Func_quarter::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
month = m_time.month;
|
||||
break;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ bool Func_regexp::getBoolVal(rowgroup::Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
return getBool(row, pm, isNull, ct, fTimeZone) && !isNull;
|
||||
return getBool(row, pm, isNull, ct, timeZone()) && !isNull;
|
||||
}
|
||||
|
||||
|
||||
|
@ -490,7 +490,7 @@ IDB_Decimal Func_round::getDecimalVal(Row& row,
|
||||
|
||||
string value;
|
||||
if (op_ct.colDataType == execplan::CalpontSystemCatalog::TIMESTAMP)
|
||||
value = dataconvert::DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
value = dataconvert::DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
|
||||
else
|
||||
value = dataconvert::DataConvert::datetimeToString1(parm[0]->data()->getDatetimeIntVal(row, isNull));
|
||||
|
||||
|
@ -113,7 +113,7 @@ int64_t Func_second::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
return m_time.second;
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ string Func_str_to_date::getStrVal(rowgroup::Row& row,
|
||||
CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
dataconvert::DateTime dateTime;
|
||||
dateTime = getDateTime(row, parm, isNull, ct, fTimeZone);
|
||||
dateTime = getDateTime(row, parm, isNull, ct, timeZone());
|
||||
string convertedDate = dataconvert::DataConvert::datetimeToString(*((long long*) &dateTime));
|
||||
return convertedDate;
|
||||
}
|
||||
@ -198,7 +198,7 @@ int32_t Func_str_to_date::getDateIntVal(rowgroup::Row& row,
|
||||
CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
dataconvert::DateTime dateTime;
|
||||
dateTime = getDateTime(row, parm, isNull, ct, fTimeZone);
|
||||
dateTime = getDateTime(row, parm, isNull, ct, timeZone());
|
||||
int64_t time = *(reinterpret_cast<int64_t*>(&dateTime));
|
||||
return ((((int32_t)(time >> 32)) & 0xFFFFFFC0) | 0x3E);
|
||||
}
|
||||
@ -209,7 +209,7 @@ int64_t Func_str_to_date::getDatetimeIntVal(rowgroup::Row& row,
|
||||
CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
dataconvert::DateTime dateTime;
|
||||
dateTime = getDateTime(row, parm, isNull, ct, fTimeZone);
|
||||
dateTime = getDateTime(row, parm, isNull, ct, timeZone());
|
||||
int64_t time = *(reinterpret_cast<int64_t*>(&dateTime));
|
||||
return time;
|
||||
}
|
||||
@ -220,7 +220,7 @@ int64_t Func_str_to_date::getTimestampIntVal(rowgroup::Row& row,
|
||||
CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
dataconvert::DateTime dateTime;
|
||||
dateTime = getDateTime(row, parm, isNull, ct, fTimeZone);
|
||||
dateTime = getDateTime(row, parm, isNull, ct, timeZone());
|
||||
dataconvert::TimeStamp timestamp;
|
||||
dataconvert::MySQLTime m_time;
|
||||
m_time.year = dateTime.year;
|
||||
@ -230,7 +230,7 @@ int64_t Func_str_to_date::getTimestampIntVal(rowgroup::Row& row,
|
||||
m_time.minute = dateTime.minute;
|
||||
m_time.second = dateTime.second;
|
||||
bool isValid = true;
|
||||
int64_t seconds = mySQLTimeToGmtSec(m_time, fTimeZone, isValid);
|
||||
int64_t seconds = mySQLTimeToGmtSec(m_time, timeZone(), isValid);
|
||||
if (!isValid)
|
||||
{
|
||||
timestamp = -1;
|
||||
@ -252,7 +252,7 @@ int64_t Func_str_to_date::getTimeIntVal(rowgroup::Row& row,
|
||||
{
|
||||
dataconvert::DateTime dateTime;
|
||||
dataconvert::Time retTime;
|
||||
dateTime = getDateTime(row, parm, isNull, ct, fTimeZone);
|
||||
dateTime = getDateTime(row, parm, isNull, ct, timeZone());
|
||||
retTime.day = 0;
|
||||
retTime.is_neg = false;
|
||||
retTime.hour = dateTime.hour;
|
||||
@ -269,7 +269,7 @@ int64_t Func_str_to_date::getIntVal(rowgroup::Row& row,
|
||||
CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
dataconvert::DateTime dateTime;
|
||||
dateTime = getDateTime(row, parm, isNull, ct, fTimeZone);
|
||||
dateTime = getDateTime(row, parm, isNull, ct, timeZone());
|
||||
int64_t time = *(reinterpret_cast<int64_t*>(&dateTime));
|
||||
return time;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ string Func_time::getStrVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
dataconvert::Time time;
|
||||
time.hour = m_time.hour;
|
||||
time.minute = m_time.minute;
|
||||
|
@ -77,7 +77,7 @@ string Func_time_format::getStrVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
hour = m_time.hour;
|
||||
min = m_time.minute;
|
||||
sec = m_time.second;
|
||||
|
@ -76,7 +76,7 @@ int64_t Func_time_to_sec::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(val);
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, timeZone());
|
||||
hour = time.hour;
|
||||
min = time.minute;
|
||||
sec = time.second;
|
||||
|
@ -152,7 +152,7 @@ string Func_timediff::getStrVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(temp);
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, timeZone());
|
||||
dataconvert::DateTime dt;
|
||||
dt.year = time.year;
|
||||
dt.month = time.month;
|
||||
@ -239,7 +239,7 @@ string Func_timediff::getStrVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(temp);
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, time, timeZone());
|
||||
dataconvert::DateTime dt;
|
||||
dt.year = time.year;
|
||||
dt.month = time.month;
|
||||
@ -332,7 +332,7 @@ int64_t Func_timediff::getTimestampIntVal(rowgroup::Row& row,
|
||||
bool& isNull,
|
||||
CalpontSystemCatalog::ColType& ct)
|
||||
{
|
||||
return dataconvert::DataConvert::timestampToInt(getStrVal(row, parm, isNull, ct), fTimeZone);
|
||||
return dataconvert::DataConvert::timestampToInt(getStrVal(row, parm, isNull, ct), timeZone());
|
||||
}
|
||||
|
||||
int64_t Func_timediff::getTimeIntVal(rowgroup::Row& row,
|
||||
|
@ -57,7 +57,7 @@ int64_t Func_timestampdiff::getIntVal(rowgroup::Row& row,
|
||||
TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
MySQLTime m_time;
|
||||
gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
dt1.year = m_time.year;
|
||||
dt1.month = m_time.month;
|
||||
dt1.day = m_time.day;
|
||||
@ -84,7 +84,7 @@ int64_t Func_timestampdiff::getIntVal(rowgroup::Row& row,
|
||||
TimeStamp timestamp(parm[1]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
MySQLTime m_time;
|
||||
gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
dt2.year = m_time.year;
|
||||
dt2.month = m_time.month;
|
||||
dt2.day = m_time.day;
|
||||
|
@ -90,7 +90,7 @@ int64_t Func_to_days::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
year = m_time.year;
|
||||
month = m_time.month;
|
||||
day = m_time.day;
|
||||
|
@ -497,7 +497,7 @@ IDB_Decimal Func_truncate::getDecimalVal(Row& row,
|
||||
int64_t x = 0;
|
||||
|
||||
string value =
|
||||
DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), fTimeZone);
|
||||
DataConvert::timestampToString1(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
|
||||
|
||||
s = parm[1]->data()->getIntVal(row, isNull);
|
||||
|
||||
|
@ -80,7 +80,7 @@ int64_t Func_week::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
year = m_time.year;
|
||||
month = m_time.month;
|
||||
day = m_time.day;
|
||||
|
@ -76,7 +76,7 @@ int64_t Func_weekday::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getTimestampIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
year = m_time.year;
|
||||
month = m_time.month;
|
||||
day = m_time.day;
|
||||
|
@ -66,7 +66,7 @@ int64_t Func_year::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
return m_time.year;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ int64_t Func_yearweek::getIntVal(rowgroup::Row& row,
|
||||
dataconvert::TimeStamp timestamp(parm[0]->data()->getIntVal(row, isNull));
|
||||
int64_t seconds = timestamp.second;
|
||||
dataconvert::MySQLTime m_time;
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, fTimeZone);
|
||||
dataconvert::gmtSecToMySQLTime(seconds, m_time, timeZone());
|
||||
year = m_time.year;
|
||||
month = m_time.month;
|
||||
day = m_time.day;
|
||||
|
@ -112,7 +112,7 @@ uint64_t Func::stringToDatetime(const string str)
|
||||
|
||||
uint64_t Func::stringToTimestamp(const string str)
|
||||
{
|
||||
int64_t ret = DataConvert::stringToTimestamp(str, fTimeZone);
|
||||
int64_t ret = DataConvert::stringToTimestamp(str, timeZone());
|
||||
|
||||
if (ret == -1)
|
||||
{
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
#include "parsetree.h"
|
||||
#include "exceptclasses.h"
|
||||
@ -73,10 +74,12 @@ public:
|
||||
|
||||
const std::string timeZone() const
|
||||
{
|
||||
std::unique_lock<std::mutex> l(tzMutex);
|
||||
return fTimeZone;
|
||||
}
|
||||
void timeZone(const std::string timeZone)
|
||||
{
|
||||
std::unique_lock<std::mutex> l(tzMutex);
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
|
||||
@ -201,7 +204,6 @@ protected:
|
||||
virtual int64_t addTime(dataconvert::Time& dt1, dataconvert::Time& dt2);
|
||||
|
||||
std::string fFuncName;
|
||||
std::string fTimeZone;
|
||||
|
||||
private:
|
||||
//defaults okay
|
||||
@ -213,6 +215,9 @@ private:
|
||||
float fFloatNullVal;
|
||||
double fDoubleNullVal;
|
||||
long double fLongDoubleNullVal;
|
||||
|
||||
std::string fTimeZone;
|
||||
mutable std::mutex tzMutex;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user