1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-4412 Introduce TypeHandler::getEmptyValueForType to return const ptr for an empty value

WE changes for SQL DML and DDL operations

Changes for bulk operations

Changes for scanning operations

Cleanup
This commit is contained in:
Roman Nozdrin
2021-01-15 16:02:10 +00:00
parent 16b52860e8
commit 5fce19df0a
27 changed files with 741 additions and 580 deletions

View File

@ -10,8 +10,7 @@ set(common_LIB_SRCS
MonitorProcMem.cpp
nullvaluemanip.cpp
threadnaming.cpp
utils_utf8.cpp
emptyvaluemanip.cpp)
utils_utf8.cpp)
add_library(common SHARED ${common_LIB_SRCS})

View File

@ -1,110 +0,0 @@
/* Copyright (C) 2020 MariaDB Corporation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "emptyvaluemanip.h"
namespace utils
{
void getEmptyRowValue(const execplan::CalpontSystemCatalog::ColDataType colDataType,
const int width, uint8_t* emptyVal)
{
switch (colDataType)
{
case execplan::CalpontSystemCatalog::TINYINT:
*(uint8_t*)emptyVal = joblist::TINYINTEMPTYROW;
break;
case execplan::CalpontSystemCatalog::SMALLINT:
*(uint16_t*)emptyVal = joblist::SMALLINTEMPTYROW;
break;
case execplan::CalpontSystemCatalog::MEDINT:
case execplan::CalpontSystemCatalog::INT:
*(uint32_t*)emptyVal = joblist::INTEMPTYROW;
break;
case execplan::CalpontSystemCatalog::BIGINT:
*(uint64_t*)emptyVal = joblist::BIGINTEMPTYROW;
break;
case execplan::CalpontSystemCatalog::UTINYINT:
*(uint8_t*)emptyVal = joblist::UTINYINTEMPTYROW;
break;
case execplan::CalpontSystemCatalog::USMALLINT:
*(uint16_t*)emptyVal = joblist::USMALLINTEMPTYROW;
break;
case execplan::CalpontSystemCatalog::UMEDINT:
case execplan::CalpontSystemCatalog::UINT:
*(uint32_t*)emptyVal = joblist::UINTEMPTYROW;
break;
case execplan::CalpontSystemCatalog::UBIGINT:
*(uint64_t*)emptyVal = joblist::UBIGINTEMPTYROW;
break;
case execplan::CalpontSystemCatalog::FLOAT:
case execplan::CalpontSystemCatalog::UFLOAT:
*(uint32_t*)emptyVal = joblist::FLOATEMPTYROW;
break;
case execplan::CalpontSystemCatalog::DOUBLE:
case execplan::CalpontSystemCatalog::UDOUBLE:
*(uint64_t*)emptyVal = joblist::DOUBLEEMPTYROW;
break;
case execplan::CalpontSystemCatalog::DECIMAL:
case execplan::CalpontSystemCatalog::UDECIMAL:
if (width <= 1)
*(uint8_t*)emptyVal = joblist::TINYINTEMPTYROW;
else if (width <= 2)
*(uint16_t*)emptyVal = joblist::SMALLINTEMPTYROW;
else if (width <= 4)
*(uint32_t*)emptyVal = joblist::INTEMPTYROW;
else if (width <= 8)
*(uint64_t*)emptyVal = joblist::BIGINTEMPTYROW;
else
datatypes::Decimal::setWideDecimalEmptyValue(*(reinterpret_cast<int128_t*>(emptyVal)));
break;
case execplan::CalpontSystemCatalog::CHAR:
case execplan::CalpontSystemCatalog::VARCHAR:
case execplan::CalpontSystemCatalog::DATE:
case execplan::CalpontSystemCatalog::DATETIME:
case execplan::CalpontSystemCatalog::TIMESTAMP:
case execplan::CalpontSystemCatalog::TIME:
case execplan::CalpontSystemCatalog::VARBINARY:
case execplan::CalpontSystemCatalog::BLOB:
case execplan::CalpontSystemCatalog::TEXT:
default:
*(uint8_t*)emptyVal = joblist::CHAR1EMPTYROW;
int offset = (colDataType == execplan::CalpontSystemCatalog::VARCHAR) ? -1 : 0;
if (width == (2 + offset))
*(uint16_t*)emptyVal = joblist::CHAR2EMPTYROW;
else if (width >= (3 + offset) && width <= (4 + offset))
*(uint32_t*)emptyVal = joblist::CHAR4EMPTYROW;
else if (width >= (5 + offset))
*(uint64_t*)emptyVal = joblist::CHAR8EMPTYROW;
break;
}
}
} // namespace utils

View File

@ -1,31 +0,0 @@
/* Copyright (C) 2020 MariaDB Corporation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef EMPTY_VALUE_MANIP_H
#define EMPTY_VALUE_MANIP_H
#include "calpontsystemcatalog.h"
namespace utils
{
void getEmptyRowValue(const execplan::CalpontSystemCatalog::ColDataType colDataType,
const int width, uint8_t* emptyVal);
} // namespace utils
#endif // EMPTY_VALUE_MANIP_H