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

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -16,10 +16,10 @@
MA 02110-1301, USA. */
/****************************************************************************
* $Id: func_char_length.cpp 3923 2013-06-19 21:43:06Z bwilkinson $
*
*
****************************************************************************/
* $Id: func_char_length.cpp 3923 2013-06-19 21:43:06Z bwilkinson $
*
*
****************************************************************************/
#include <cstdlib>
#include <string>
@ -38,89 +38,87 @@ using namespace execplan;
#include "idberrorinfo.h"
#include "errorids.h"
using namespace logging;
namespace funcexp
{
CalpontSystemCatalog::ColType Func_char_length::operationType( FunctionParm& fp, CalpontSystemCatalog::ColType& resultType )
CalpontSystemCatalog::ColType Func_char_length::operationType(FunctionParm& fp,
CalpontSystemCatalog::ColType& resultType)
{
return fp[0]->data()->resultType();
return fp[0]->data()->resultType();
}
int64_t Func_char_length::getIntVal(rowgroup::Row& row,
FunctionParm& parm,
bool& isNull,
int64_t Func_char_length::getIntVal(rowgroup::Row& row, FunctionParm& parm, bool& isNull,
CalpontSystemCatalog::ColType& op_ct)
{
CalpontSystemCatalog::ColDataType type = parm[0]->data()->resultType().colDataType;
CalpontSystemCatalog::ColDataType type = parm[0]->data()->resultType().colDataType;
switch (type)
switch (type)
{
case execplan::CalpontSystemCatalog::BIGINT:
case execplan::CalpontSystemCatalog::INT:
case execplan::CalpontSystemCatalog::MEDINT:
case execplan::CalpontSystemCatalog::TINYINT:
case execplan::CalpontSystemCatalog::SMALLINT:
case execplan::CalpontSystemCatalog::UBIGINT:
case execplan::CalpontSystemCatalog::UINT:
case execplan::CalpontSystemCatalog::UMEDINT:
case execplan::CalpontSystemCatalog::UTINYINT:
case execplan::CalpontSystemCatalog::USMALLINT:
case execplan::CalpontSystemCatalog::DOUBLE:
case execplan::CalpontSystemCatalog::UDOUBLE:
case execplan::CalpontSystemCatalog::FLOAT:
case execplan::CalpontSystemCatalog::UFLOAT:
case execplan::CalpontSystemCatalog::VARCHAR: // including CHAR
case execplan::CalpontSystemCatalog::CHAR:
case execplan::CalpontSystemCatalog::TEXT:
case execplan::CalpontSystemCatalog::DECIMAL:
case execplan::CalpontSystemCatalog::UDECIMAL:
{
case execplan::CalpontSystemCatalog::BIGINT:
case execplan::CalpontSystemCatalog::INT:
case execplan::CalpontSystemCatalog::MEDINT:
case execplan::CalpontSystemCatalog::TINYINT:
case execplan::CalpontSystemCatalog::SMALLINT:
case execplan::CalpontSystemCatalog::UBIGINT:
case execplan::CalpontSystemCatalog::UINT:
case execplan::CalpontSystemCatalog::UMEDINT:
case execplan::CalpontSystemCatalog::UTINYINT:
case execplan::CalpontSystemCatalog::USMALLINT:
case execplan::CalpontSystemCatalog::DOUBLE:
case execplan::CalpontSystemCatalog::UDOUBLE:
case execplan::CalpontSystemCatalog::FLOAT:
case execplan::CalpontSystemCatalog::UFLOAT:
case execplan::CalpontSystemCatalog::VARCHAR: // including CHAR
case execplan::CalpontSystemCatalog::CHAR:
case execplan::CalpontSystemCatalog::TEXT:
case execplan::CalpontSystemCatalog::DECIMAL:
case execplan::CalpontSystemCatalog::UDECIMAL:
{
const string& tstr = parm[0]->data()->getStrVal(row, isNull);
if (isNull)
return 0;
const char* b = tstr.c_str();
const char* e = tstr.c_str() + tstr.length();
return (int64_t)parm[0]->data()->resultType().getCharset()->numchars(b, e);
}
case execplan::CalpontSystemCatalog::DATE:
{
string date = dataconvert::DataConvert::dateToString(parm[0]->data()->getDateIntVal(row, isNull));
return (int64_t)date.size();
}
case execplan::CalpontSystemCatalog::DATETIME:
{
string date = dataconvert::DataConvert::datetimeToString(parm[0]->data()->getDatetimeIntVal(row, isNull));
return (int64_t)date.size();
}
case execplan::CalpontSystemCatalog::TIMESTAMP:
{
string date = dataconvert::DataConvert::timestampToString(parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
return (int64_t)date.size();
}
case execplan::CalpontSystemCatalog::TIME:
{
string date = dataconvert::DataConvert::timeToString(parm[0]->data()->getTimeIntVal(row, isNull));
return (int64_t)date.size();
}
default:
{
std::ostringstream oss;
oss << "char_length: datatype of " << execplan::colDataTypeToString(type);
throw logging::IDBExcept(oss.str(), ERR_DATATYPE_NOT_SUPPORT);
}
const string& tstr = parm[0]->data()->getStrVal(row, isNull);
if (isNull)
return 0;
const char* b = tstr.c_str();
const char* e = tstr.c_str() + tstr.length();
return (int64_t)parm[0]->data()->resultType().getCharset()->numchars(b, e);
}
return 0;
case execplan::CalpontSystemCatalog::DATE:
{
string date = dataconvert::DataConvert::dateToString(parm[0]->data()->getDateIntVal(row, isNull));
return (int64_t)date.size();
}
case execplan::CalpontSystemCatalog::DATETIME:
{
string date =
dataconvert::DataConvert::datetimeToString(parm[0]->data()->getDatetimeIntVal(row, isNull));
return (int64_t)date.size();
}
case execplan::CalpontSystemCatalog::TIMESTAMP:
{
string date = dataconvert::DataConvert::timestampToString(
parm[0]->data()->getTimestampIntVal(row, isNull), timeZone());
return (int64_t)date.size();
}
case execplan::CalpontSystemCatalog::TIME:
{
string date = dataconvert::DataConvert::timeToString(parm[0]->data()->getTimeIntVal(row, isNull));
return (int64_t)date.size();
}
default:
{
std::ostringstream oss;
oss << "char_length: datatype of " << execplan::colDataTypeToString(type);
throw logging::IDBExcept(oss.str(), ERR_DATATYPE_NOT_SUPPORT);
}
}
return 0;
}
} // namespace funcexp
} // namespace funcexp
// vim:ts=4 sw=4: