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
MCOL-641 Refactor empty value implementation in writeengine.
This commit is contained in:
committed by
Roman Nozdrin
parent
97ee1609b2
commit
824615a55b
@ -1608,7 +1608,9 @@ uint32_t doUpdateDelete(THD* thd, gp_walk_info& gwi, const std::vector<COND*>& c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Exit early if there is nothing to update
|
// Exit early if there is nothing to update
|
||||||
if (colAssignmentListPtr->empty())
|
if (colAssignmentListPtr->empty() &&
|
||||||
|
(((thd->lex)->sql_command == SQLCOM_UPDATE) ||
|
||||||
|
((thd->lex)->sql_command == SQLCOM_UPDATE_MULTI)))
|
||||||
{
|
{
|
||||||
ci->affectedRows = 0;
|
ci->affectedRows = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1537,11 +1537,6 @@ inline void p_Col_ridArray(NewColRequestHeader* in,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// WIP MCOL-641
|
|
||||||
using uint128_t = unsigned __int128;
|
|
||||||
using int128_t = __int128;
|
|
||||||
|
|
||||||
// for BINARY
|
// for BINARY
|
||||||
template<int W>
|
template<int W>
|
||||||
inline void p_Col_bin_ridArray(NewColRequestHeader* in,
|
inline void p_Col_bin_ridArray(NewColRequestHeader* in,
|
||||||
|
@ -48,6 +48,8 @@ using namespace rowgroup;
|
|||||||
#include "messageids.h"
|
#include "messageids.h"
|
||||||
using namespace logging;
|
using namespace logging;
|
||||||
|
|
||||||
|
#include "emptyvaluemanip.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define llabs labs
|
#define llabs labs
|
||||||
#endif
|
#endif
|
||||||
@ -193,28 +195,34 @@ void ColumnCommand::loadData()
|
|||||||
{
|
{
|
||||||
if (bPtr && colType.colWidth == 1)
|
if (bPtr && colType.colWidth == 1)
|
||||||
{
|
{
|
||||||
ByteStream::byte b = getEmptyRowValue(colType.colDataType, colType.colWidth);
|
ByteStream::byte b;
|
||||||
|
utils::getEmptyRowValue(colType.colDataType, colType.colWidth, (uint8_t*)&b);
|
||||||
bPtr[idx] = b;
|
bPtr[idx] = b;
|
||||||
}
|
}
|
||||||
//@Bug 1812. Added two bytes column handling
|
//@Bug 1812. Added two bytes column handling
|
||||||
else if (dPtr && colType.colWidth == 2)
|
else if (dPtr && colType.colWidth == 2)
|
||||||
{
|
{
|
||||||
ByteStream::doublebyte d = getEmptyRowValue(colType.colDataType, colType.colWidth);
|
ByteStream::doublebyte d;
|
||||||
|
utils::getEmptyRowValue(colType.colDataType, colType.colWidth, (uint8_t*)&d);
|
||||||
dPtr[idx] = d;
|
dPtr[idx] = d;
|
||||||
}
|
}
|
||||||
else if (qPtr && colType.colWidth == 4)
|
else if (qPtr && colType.colWidth == 4)
|
||||||
{
|
{
|
||||||
ByteStream::quadbyte q = getEmptyRowValue(colType.colDataType, colType.colWidth);
|
ByteStream::quadbyte q;
|
||||||
|
utils::getEmptyRowValue(colType.colDataType, colType.colWidth, (uint8_t*)&q);
|
||||||
qPtr[idx] = q;
|
qPtr[idx] = q;
|
||||||
}
|
}
|
||||||
else if (oPtr && colType.colWidth == 8)
|
else if (oPtr && colType.colWidth == 8)
|
||||||
{
|
{
|
||||||
ByteStream::octbyte o = getEmptyRowValue(colType.colDataType, colType.colWidth);
|
ByteStream::octbyte o;
|
||||||
|
utils::getEmptyRowValue(colType.colDataType, colType.colWidth, (uint8_t*)&o);
|
||||||
oPtr[idx] = o;
|
oPtr[idx] = o;
|
||||||
}
|
}
|
||||||
else if (colType.colWidth == 16)
|
else if (colType.colWidth == 16)
|
||||||
{
|
{
|
||||||
getEmptyRowValue(colType.colDataType, colType.colWidth, &hPtr[idx]);
|
ByteStream::hexbyte h;
|
||||||
|
utils::getEmptyRowValue(colType.colDataType, colType.colWidth, (uint8_t*)&h);
|
||||||
|
hPtr[idx] = h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -959,114 +967,6 @@ void ColumnCommand::enableFilters()
|
|||||||
prep(primMsg->OutputType, makeAbsRids);
|
prep(primMsg->OutputType, makeAbsRids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
* DESCRIPTION:
|
|
||||||
* Get the value that represents empty row
|
|
||||||
* PARAMETERS:
|
|
||||||
* dataType - data type
|
|
||||||
* width - data width in byte
|
|
||||||
* RETURN:
|
|
||||||
* emptyVal - the value of empty row
|
|
||||||
***********************************************************/
|
|
||||||
const uint64_t ColumnCommand::getEmptyRowValue( const CSCDataType dataType, const int width ) const
|
|
||||||
{
|
|
||||||
uint64_t emptyVal = 0;
|
|
||||||
int offset;
|
|
||||||
|
|
||||||
offset = ( dataType == execplan::CalpontSystemCatalog::VARCHAR ) ? -1 : 0;
|
|
||||||
|
|
||||||
switch ( dataType )
|
|
||||||
{
|
|
||||||
case execplan::CalpontSystemCatalog::TINYINT :
|
|
||||||
emptyVal = joblist::TINYINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::SMALLINT:
|
|
||||||
emptyVal = joblist::SMALLINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::MEDINT :
|
|
||||||
case execplan::CalpontSystemCatalog::INT :
|
|
||||||
emptyVal = joblist::INTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::BIGINT :
|
|
||||||
emptyVal = joblist::BIGINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::UTINYINT :
|
|
||||||
emptyVal = joblist::UTINYINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::USMALLINT:
|
|
||||||
emptyVal = joblist::USMALLINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::UMEDINT :
|
|
||||||
case execplan::CalpontSystemCatalog::UINT :
|
|
||||||
emptyVal = joblist::UINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::UBIGINT :
|
|
||||||
emptyVal = joblist::UBIGINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::FLOAT :
|
|
||||||
case execplan::CalpontSystemCatalog::UFLOAT :
|
|
||||||
emptyVal = joblist::FLOATEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::DOUBLE :
|
|
||||||
case execplan::CalpontSystemCatalog::UDOUBLE :
|
|
||||||
emptyVal = joblist::DOUBLEEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case execplan::CalpontSystemCatalog::DECIMAL :
|
|
||||||
case execplan::CalpontSystemCatalog::UDECIMAL :
|
|
||||||
if ( width <= 1 )
|
|
||||||
emptyVal = joblist::TINYINTEMPTYROW;
|
|
||||||
else if (width <= 2)
|
|
||||||
emptyVal = joblist::SMALLINTEMPTYROW;
|
|
||||||
else if ( width <= 4 )
|
|
||||||
emptyVal = joblist::INTEMPTYROW;
|
|
||||||
else
|
|
||||||
emptyVal = joblist::BIGINTEMPTYROW;
|
|
||||||
|
|
||||||
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:
|
|
||||||
emptyVal = joblist::CHAR1EMPTYROW;
|
|
||||||
|
|
||||||
if ( width == (2 + offset) )
|
|
||||||
emptyVal = joblist::CHAR2EMPTYROW;
|
|
||||||
else if ( width >= (3 + offset) && width <= ( 4 + offset ) )
|
|
||||||
emptyVal = joblist::CHAR4EMPTYROW;
|
|
||||||
else if ( width >= (5 + offset) )
|
|
||||||
emptyVal = joblist::CHAR8EMPTYROW;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return emptyVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ColumnCommand::getEmptyRowValue(const CSCDataType dataType,
|
|
||||||
const int width, messageqcpp::ByteStream::hexbyte* space) const
|
|
||||||
{
|
|
||||||
int128_t *val = reinterpret_cast<int128_t*>(space);
|
|
||||||
utils::setWideDecimalEMptyValue(*val);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ColumnCommand::getLBIDList(uint32_t loopCount, vector<int64_t>* lbids)
|
void ColumnCommand::getLBIDList(uint32_t loopCount, vector<int64_t>* lbids)
|
||||||
{
|
{
|
||||||
int64_t firstLBID = lbid, lastLBID = firstLBID + (loopCount * colType.colWidth) - 1, i;
|
int64_t firstLBID = lbid, lastLBID = firstLBID + (loopCount * colType.colWidth) - 1, i;
|
||||||
|
@ -84,9 +84,6 @@ public:
|
|||||||
makeAbsRids = m;
|
makeAbsRids = m;
|
||||||
}
|
}
|
||||||
bool willPrefetch();
|
bool willPrefetch();
|
||||||
const uint64_t getEmptyRowValue( const CSCDataType dataType, const int width ) const;
|
|
||||||
void getEmptyRowValue(const CSCDataType dataType,
|
|
||||||
const int width, messageqcpp::ByteStream::hexbyte* space) const;
|
|
||||||
const int64_t getLastLbid();
|
const int64_t getLastLbid();
|
||||||
void getLBIDList(uint32_t loopCount, std::vector<int64_t>* lbids);
|
void getLBIDList(uint32_t loopCount, std::vector<int64_t>* lbids);
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ void PassThruCommand::projectIntoRowGroup(RowGroup& rg, uint32_t col)
|
|||||||
<< *(((int64_t*) bpp->values[i]) +1)
|
<< *(((int64_t*) bpp->values[i]) +1)
|
||||||
<< endl;
|
<< endl;
|
||||||
// values[i] is 8 bytes so it contains the pointer to bpp->outputMsg set by ColumnCommand::process_OT_BOTH()
|
// values[i] is 8 bytes so it contains the pointer to bpp->outputMsg set by ColumnCommand::process_OT_BOTH()
|
||||||
r.setBinaryField_offset((uint8_t*)bpp->values[i], 16, offset);
|
r.setBinaryField_offset((uint128_t*)bpp->values[i], 16, offset);
|
||||||
|
|
||||||
r.nextRow(rowSize);
|
r.nextRow(rowSize);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@ set(common_LIB_SRCS
|
|||||||
MonitorProcMem.cpp
|
MonitorProcMem.cpp
|
||||||
nullvaluemanip.cpp
|
nullvaluemanip.cpp
|
||||||
threadnaming.cpp
|
threadnaming.cpp
|
||||||
utils_utf8.cpp)
|
utils_utf8.cpp
|
||||||
|
emptyvaluemanip.cpp)
|
||||||
|
|
||||||
add_library(common SHARED ${common_LIB_SRCS})
|
add_library(common SHARED ${common_LIB_SRCS})
|
||||||
|
|
||||||
|
115
utils/common/emptyvaluemanip.cpp
Normal file
115
utils/common/emptyvaluemanip.cpp
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/* 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 "widedecimalutils.h"
|
||||||
|
#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
|
||||||
|
setWideDecimalEmptyValue(*(reinterpret_cast<int128_t*>(emptyVal)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
//case CalpontSystemCatalog::BINARY:
|
||||||
|
// emptyVal = joblist::BINARYEMPTYROW;
|
||||||
|
// 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
|
31
utils/common/emptyvaluemanip.h
Normal file
31
utils/common/emptyvaluemanip.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/* 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
|
@ -18,6 +18,8 @@
|
|||||||
#ifndef WIDE_DECIMAL_UTILS_H
|
#ifndef WIDE_DECIMAL_UTILS_H
|
||||||
#define WIDE_DECIMAL_UTILS_H
|
#define WIDE_DECIMAL_UTILS_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
using int128_t = __int128;
|
using int128_t = __int128;
|
||||||
using uint128_t = unsigned __int128;
|
using uint128_t = unsigned __int128;
|
||||||
|
|
||||||
@ -48,7 +50,7 @@ namespace utils
|
|||||||
ptr[1] = BINARYNULLVALUEHIGH;
|
ptr[1] = BINARYNULLVALUEHIGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setWideDecimalEMptyValue(int128_t& val)
|
inline void setWideDecimalEmptyValue(int128_t& val)
|
||||||
{
|
{
|
||||||
uint64_t* ptr = reinterpret_cast<uint64_t*>(&val);
|
uint64_t* ptr = reinterpret_cast<uint64_t*>(&val);
|
||||||
ptr[0] = BINARYEMPTYVALUELOW;
|
ptr[0] = BINARYEMPTYVALUELOW;
|
||||||
@ -62,7 +64,7 @@ namespace utils
|
|||||||
ptr[1] = BINARYNULLVALUEHIGH;
|
ptr[1] = BINARYNULLVALUEHIGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setWideDecimalEMptyValue(int128_t* val)
|
inline void setWideDecimalEmptyValue(int128_t* val)
|
||||||
{
|
{
|
||||||
uint64_t* ptr = reinterpret_cast<uint64_t*>(val);
|
uint64_t* ptr = reinterpret_cast<uint64_t*>(val);
|
||||||
ptr[0] = BINARYEMPTYVALUELOW;
|
ptr[0] = BINARYEMPTYVALUELOW;
|
||||||
|
@ -1920,6 +1920,12 @@ DataConvert::convertColumnData(const CalpontSystemCatalog::ColType& colType,
|
|||||||
long long eightbyte = joblist::BIGINTNULL;
|
long long eightbyte = joblist::BIGINTNULL;
|
||||||
value = eightbyte;
|
value = eightbyte;
|
||||||
}
|
}
|
||||||
|
else if (colType.colWidth == 16)
|
||||||
|
{
|
||||||
|
int128_t val;
|
||||||
|
utils::setWideDecimalNullValue(val);
|
||||||
|
value = val;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WriteEngine::Token nullToken;
|
WriteEngine::Token nullToken;
|
||||||
|
@ -563,9 +563,10 @@ int BulkLoad::preProcess( Job& job, int tableNo,
|
|||||||
job.jobTableList[tableNo].colList[i].weType = curColStruct.colType;
|
job.jobTableList[tableNo].colList[i].weType = curColStruct.colType;
|
||||||
// set width to correct column width
|
// set width to correct column width
|
||||||
job.jobTableList[tableNo].colList[i].width = curColStruct.colWidth;
|
job.jobTableList[tableNo].colList[i].width = curColStruct.colWidth;
|
||||||
job.jobTableList[tableNo].colList[i].emptyVal = getEmptyRowValue(
|
getEmptyRowValue(
|
||||||
job.jobTableList[tableNo].colList[i].dataType,
|
job.jobTableList[tableNo].colList[i].dataType,
|
||||||
job.jobTableList[tableNo].colList[i].width );
|
job.jobTableList[tableNo].colList[i].width,
|
||||||
|
(uint8_t*)&job.jobTableList[tableNo].colList[i].emptyVal);
|
||||||
|
|
||||||
// check HWM for column file
|
// check HWM for column file
|
||||||
rc = BRMWrapper::getInstance()->getDbRootHWMInfo( curJobCol.mapOid,
|
rc = BRMWrapper::getInstance()->getDbRootHWMInfo( curJobCol.mapOid,
|
||||||
|
@ -115,12 +115,13 @@ int ColumnBuffer::writeToFile(int startOffset, int writeSize, bool fillUpWEmptie
|
|||||||
{
|
{
|
||||||
BlockOp blockOp;
|
BlockOp blockOp;
|
||||||
newBuf = new unsigned char[BYTE_PER_BLOCK];
|
newBuf = new unsigned char[BYTE_PER_BLOCK];
|
||||||
uint64_t EmptyValue = blockOp.getEmptyRowValue(fColInfo->column.dataType,
|
uint8_t* emptyVal = (uint8_t*) alloca(fColInfo->column.width);
|
||||||
fColInfo->column.width);
|
blockOp.getEmptyRowValue(fColInfo->column.dataType,
|
||||||
|
fColInfo->column.width, emptyVal);
|
||||||
::memcpy(static_cast<void *>(newBuf),
|
::memcpy(static_cast<void *>(newBuf),
|
||||||
static_cast<const void *>(fBuffer + startOffset), writeSize);
|
static_cast<const void *>(fBuffer + startOffset), writeSize);
|
||||||
blockOp.setEmptyBuf(newBuf + writeSize, BYTE_PER_BLOCK - writeSize,
|
blockOp.setEmptyBuf(newBuf + writeSize, BYTE_PER_BLOCK - writeSize,
|
||||||
EmptyValue, fColInfo->column.width);
|
emptyVal, fColInfo->column.width);
|
||||||
}
|
}
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
Stats::startParseEvent(WE_STATS_WRITE_COL);
|
Stats::startParseEvent(WE_STATS_WRITE_COL);
|
||||||
|
@ -132,7 +132,7 @@ int ColumnBufferCompressed::resetToBeCompressedColBuf(
|
|||||||
|
|
||||||
BlockOp::setEmptyBuf( fToBeCompressedBuffer,
|
BlockOp::setEmptyBuf( fToBeCompressedBuffer,
|
||||||
IDBCompressInterface::UNCOMPRESSED_INBUF_LEN,
|
IDBCompressInterface::UNCOMPRESSED_INBUF_LEN,
|
||||||
fColInfo->column.emptyVal,
|
(uint8_t*)&fColInfo->column.emptyVal,
|
||||||
fColInfo->column.width );
|
fColInfo->column.width );
|
||||||
|
|
||||||
if (fLog->isDebug( DEBUG_2 ))
|
if (fLog->isDebug( DEBUG_2 ))
|
||||||
@ -317,7 +317,7 @@ int ColumnBufferCompressed::writeToFile(int startOffset, int writeSize,
|
|||||||
// Start over again loading a new to-be-compressed buffer
|
// Start over again loading a new to-be-compressed buffer
|
||||||
BlockOp::setEmptyBuf( fToBeCompressedBuffer,
|
BlockOp::setEmptyBuf( fToBeCompressedBuffer,
|
||||||
IDBCompressInterface::UNCOMPRESSED_INBUF_LEN,
|
IDBCompressInterface::UNCOMPRESSED_INBUF_LEN,
|
||||||
fColInfo->column.emptyVal,
|
(uint8_t*)&fColInfo->column.emptyVal,
|
||||||
fColInfo->column.width );
|
fColInfo->column.width );
|
||||||
|
|
||||||
fToBeCompressedCapacity =
|
fToBeCompressedCapacity =
|
||||||
@ -628,7 +628,7 @@ int ColumnBufferCompressed::initToBeCompressedBuffer(long long& startFileOffset)
|
|||||||
new unsigned char[IDBCompressInterface::UNCOMPRESSED_INBUF_LEN];
|
new unsigned char[IDBCompressInterface::UNCOMPRESSED_INBUF_LEN];
|
||||||
BlockOp::setEmptyBuf( fToBeCompressedBuffer,
|
BlockOp::setEmptyBuf( fToBeCompressedBuffer,
|
||||||
IDBCompressInterface::UNCOMPRESSED_INBUF_LEN,
|
IDBCompressInterface::UNCOMPRESSED_INBUF_LEN,
|
||||||
fColInfo->column.emptyVal,
|
(uint8_t*)&fColInfo->column.emptyVal,
|
||||||
fColInfo->column.width );
|
fColInfo->column.width );
|
||||||
bNewBuffer = true;
|
bNewBuffer = true;
|
||||||
}
|
}
|
||||||
@ -743,7 +743,7 @@ int ColumnBufferCompressed::initToBeCompressedBuffer(long long& startFileOffset)
|
|||||||
{
|
{
|
||||||
BlockOp::setEmptyBuf( fToBeCompressedBuffer,
|
BlockOp::setEmptyBuf( fToBeCompressedBuffer,
|
||||||
IDBCompressInterface::UNCOMPRESSED_INBUF_LEN,
|
IDBCompressInterface::UNCOMPRESSED_INBUF_LEN,
|
||||||
fColInfo->column.emptyVal,
|
(uint8_t*)&fColInfo->column.emptyVal,
|
||||||
fColInfo->column.width );
|
fColInfo->column.width );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -895,7 +895,7 @@ int ColumnInfo::extendColumnOldExtent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc = colOp->expandAbbrevColumnExtent( pFile, dbRootNext,
|
rc = colOp->expandAbbrevColumnExtent( pFile, dbRootNext,
|
||||||
column.emptyVal, column.width);
|
(uint8_t*)&column.emptyVal, column.width);
|
||||||
|
|
||||||
if (rc != NO_ERROR)
|
if (rc != NO_ERROR)
|
||||||
{
|
{
|
||||||
|
@ -540,7 +540,7 @@ int ColumnInfoCompressed::extendColumnOldExtent(
|
|||||||
int rc = colOp->fillCompColumnExtentEmptyChunks(
|
int rc = colOp->fillCompColumnExtentEmptyChunks(
|
||||||
curCol.dataFile.fid,
|
curCol.dataFile.fid,
|
||||||
curCol.colWidth,
|
curCol.colWidth,
|
||||||
column.emptyVal,
|
(uint8_t*)&column.emptyVal,
|
||||||
curCol.dataFile.fDbRoot,
|
curCol.dataFile.fDbRoot,
|
||||||
curCol.dataFile.fPartition,
|
curCol.dataFile.fPartition,
|
||||||
curCol.dataFile.fSegment,
|
curCol.dataFile.fSegment,
|
||||||
|
@ -370,8 +370,6 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// WIP
|
|
||||||
// make convertColumnData a template
|
|
||||||
datavalue = DataConvert::convertColumnData(colType, indata, pushWarning, insertPkg.get_TimeZone(), isNULL, false, false);
|
datavalue = DataConvert::convertColumnData(colType, indata, pushWarning, insertPkg.get_TimeZone(), isNULL, false, false);
|
||||||
}
|
}
|
||||||
catch (exception&)
|
catch (exception&)
|
||||||
@ -388,7 +386,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pushWarning)
|
if (pushWarning)
|
||||||
{
|
{
|
||||||
if (!isWarningSet)
|
if (!isWarningSet)
|
||||||
isWarningSet = true;
|
isWarningSet = true;
|
||||||
@ -546,7 +544,7 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
|
|||||||
WErrorCodes ec;
|
WErrorCodes ec;
|
||||||
err = ec.errorString(error);
|
err = ec.errorString(error);
|
||||||
}
|
}
|
||||||
else if ( error == ERR_BRM_VB_OVERFLOW )
|
else if (error == ERR_BRM_VB_OVERFLOW)
|
||||||
{
|
{
|
||||||
rc = dmlpackageprocessor::DMLPackageProcessor::VB_OVERFLOW_ERROR;
|
rc = dmlpackageprocessor::DMLPackageProcessor::VB_OVERFLOW_ERROR;
|
||||||
err = IDBErrorInfo::instance()->errorMsg(ERR_VERSIONBUFFER_OVERFLOW);
|
err = IDBErrorInfo::instance()->errorMsg(ERR_VERSIONBUFFER_OVERFLOW);
|
||||||
@ -561,9 +559,9 @@ uint8_t WE_DMLCommandProc::processSingleInsert(messageqcpp::ByteStream& bs, std:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::map<uint32_t, uint32_t> oids;
|
std::map<uint32_t, uint32_t> oids;
|
||||||
std::vector<BRM::OID_t> oidsToFlush;
|
std::vector<BRM::OID_t> oidsToFlush;
|
||||||
|
|
||||||
for ( unsigned i = 0; i < colStructs.size(); i++)
|
for (unsigned i = 0; i < colStructs.size(); i++)
|
||||||
{
|
{
|
||||||
oids[colStructs[i].dataOid] = colStructs[i].dataOid;
|
oids[colStructs[i].dataOid] = colStructs[i].dataOid;
|
||||||
oidsToFlush.push_back(colStructs[i].dataOid);
|
oidsToFlush.push_back(colStructs[i].dataOid);
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
using namespace execplan;
|
using namespace execplan;
|
||||||
|
|
||||||
|
#include "emptyvaluemanip.h"
|
||||||
|
|
||||||
namespace WriteEngine
|
namespace WriteEngine
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -83,110 +85,10 @@ bool BlockOp::calculateRowId(
|
|||||||
* emptyVal - the value of empty row
|
* emptyVal - the value of empty row
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
// TODO MCOL-641 Add support here
|
// TODO MCOL-641 Add support here
|
||||||
uint64_t BlockOp::getEmptyRowValue(
|
void BlockOp::getEmptyRowValue(
|
||||||
const CalpontSystemCatalog::ColDataType colDataType, const int width ) const
|
const CalpontSystemCatalog::ColDataType colDataType, const int width, uint8_t* emptyVal ) const
|
||||||
{
|
{
|
||||||
uint64_t emptyVal = 0;
|
utils::getEmptyRowValue(colDataType, width, emptyVal);
|
||||||
int offset = 0;
|
|
||||||
|
|
||||||
switch ( colDataType )
|
|
||||||
{
|
|
||||||
case CalpontSystemCatalog::TINYINT :
|
|
||||||
emptyVal = joblist::TINYINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::SMALLINT:
|
|
||||||
emptyVal = joblist::SMALLINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::MEDINT :
|
|
||||||
case CalpontSystemCatalog::INT :
|
|
||||||
emptyVal = joblist::INTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::BIGINT :
|
|
||||||
emptyVal = joblist::BIGINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::FLOAT :
|
|
||||||
case CalpontSystemCatalog::UFLOAT :
|
|
||||||
emptyVal = joblist::FLOATEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::DOUBLE :
|
|
||||||
case CalpontSystemCatalog::UDOUBLE :
|
|
||||||
emptyVal = joblist::DOUBLEEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::DECIMAL :
|
|
||||||
case CalpontSystemCatalog::UDECIMAL :
|
|
||||||
|
|
||||||
/* if( width <= 4 )
|
|
||||||
emptyVal = joblist::SMALLINTEMPTYROW;
|
|
||||||
else
|
|
||||||
if( width <= 9 )
|
|
||||||
emptyVal = 0x80000001;
|
|
||||||
else
|
|
||||||
if( width <= 18 )
|
|
||||||
emptyVal = 0x8000000000000001LL;
|
|
||||||
else
|
|
||||||
emptyVal = 0xFFFFFFFFFFFFFFFFLL;
|
|
||||||
*/
|
|
||||||
// @bug 194 use the correct logic in handling empty value for decimal
|
|
||||||
if (width <= 1)
|
|
||||||
emptyVal = joblist::TINYINTEMPTYROW;
|
|
||||||
else if ( width <= 2 )
|
|
||||||
emptyVal = joblist::SMALLINTEMPTYROW;
|
|
||||||
else if ( width <= 4 )
|
|
||||||
emptyVal = joblist::INTEMPTYROW;
|
|
||||||
else if ( width <= 8 )
|
|
||||||
emptyVal = joblist::BIGINTEMPTYROW;
|
|
||||||
else
|
|
||||||
emptyVal = joblist::BINARYEMPTYROW;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::UTINYINT :
|
|
||||||
emptyVal = joblist::UTINYINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::USMALLINT:
|
|
||||||
emptyVal = joblist::USMALLINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::UMEDINT :
|
|
||||||
case CalpontSystemCatalog::UINT :
|
|
||||||
emptyVal = joblist::UINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::UBIGINT :
|
|
||||||
emptyVal = joblist::UBIGINTEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::BINARY :
|
|
||||||
emptyVal = joblist::BINARYEMPTYROW;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CalpontSystemCatalog::CHAR :
|
|
||||||
case CalpontSystemCatalog::VARCHAR :
|
|
||||||
case CalpontSystemCatalog::DATE :
|
|
||||||
case CalpontSystemCatalog::DATETIME :
|
|
||||||
case CalpontSystemCatalog::TIMESTAMP :
|
|
||||||
default:
|
|
||||||
offset = ( colDataType == CalpontSystemCatalog::VARCHAR ) ? -1 : 0;
|
|
||||||
emptyVal = joblist::CHAR1EMPTYROW;
|
|
||||||
|
|
||||||
if ( width == (2 + offset) )
|
|
||||||
emptyVal = joblist::CHAR2EMPTYROW;
|
|
||||||
else if ( width >= (3 + offset) && width <= ( 4 + offset ) )
|
|
||||||
emptyVal = joblist::CHAR4EMPTYROW;
|
|
||||||
else if ( width >= (5 + offset) )
|
|
||||||
emptyVal = joblist::CHAR8EMPTYROW;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return emptyVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
@ -264,7 +166,7 @@ void BlockOp::resetBuf( unsigned char* buf, const int bufSize ) const
|
|||||||
***********************************************************/
|
***********************************************************/
|
||||||
/* static */
|
/* static */
|
||||||
void BlockOp::setEmptyBuf(
|
void BlockOp::setEmptyBuf(
|
||||||
unsigned char* buf, const int bufSize, uint64_t emptyVal, const int width )
|
unsigned char* buf, const int bufSize, uint8_t* emptyVal, const int width )
|
||||||
{
|
{
|
||||||
const int ARRAY_COUNT = 128;
|
const int ARRAY_COUNT = 128;
|
||||||
const int NBYTES_IN_ARRAY = width * ARRAY_COUNT;
|
const int NBYTES_IN_ARRAY = width * ARRAY_COUNT;
|
||||||
@ -275,10 +177,9 @@ void BlockOp::setEmptyBuf(
|
|||||||
// instead of individual values. This reduces the number of calls to
|
// instead of individual values. This reduces the number of calls to
|
||||||
// memcpy().
|
// memcpy().
|
||||||
|
|
||||||
int w = width > 8 ? 8: width;
|
for(uint8_t* pos = emptyValArray, * end = pos + NBYTES_IN_ARRAY; pos < end; pos += width) //FIXME for no loop
|
||||||
for(uint8_t* pos = emptyValArray, * end = pos + NBYTES_IN_ARRAY; pos < end; pos += w) //FIXME for no loop
|
|
||||||
{
|
{
|
||||||
memcpy(pos, &emptyVal, w);
|
memcpy(pos, emptyVal, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
int countFull128 = (bufSize / width) / ARRAY_COUNT;
|
int countFull128 = (bufSize / width) / ARRAY_COUNT;
|
||||||
|
@ -89,8 +89,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Get an empty row value
|
* @brief Get an empty row value
|
||||||
*/
|
*/
|
||||||
EXPORT uint64_t getEmptyRowValue(const execplan::CalpontSystemCatalog::ColDataType colDataType,
|
EXPORT void getEmptyRowValue(const execplan::CalpontSystemCatalog::ColDataType colDataType,
|
||||||
const int width ) const;
|
const int width,
|
||||||
|
uint8_t* emptyVal ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calculate row id
|
* @brief Calculate row id
|
||||||
@ -116,7 +117,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
EXPORT void static setEmptyBuf( unsigned char* buf,
|
EXPORT void static setEmptyBuf( unsigned char* buf,
|
||||||
const int bufSize,
|
const int bufSize,
|
||||||
uint64_t emptyVal, const int width );
|
uint8_t* emptyVal, const int width );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set a value in a buffer
|
* @brief Set a value in a buffer
|
||||||
|
@ -306,7 +306,8 @@ void BulkRollbackFile::reInitTruncColumnExtent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the remainder of the extent after the HWM block
|
// Initialize the remainder of the extent after the HWM block
|
||||||
uint64_t emptyVal = fDbFile.getEmptyRowValue( colType, colWidth );
|
uint8_t* emptyVal = (uint8_t*) alloca(colWidth);
|
||||||
|
fDbFile.getEmptyRowValue( colType, colWidth, emptyVal );
|
||||||
|
|
||||||
int rc = fDbFile.reInitPartialColumnExtent( pFile,
|
int rc = fDbFile.reInitPartialColumnExtent( pFile,
|
||||||
startOffset,
|
startOffset,
|
||||||
|
@ -374,7 +374,8 @@ void BulkRollbackFileCompressed::reInitTruncColumnExtent(
|
|||||||
|
|
||||||
if (nBlocksToInit > 0)
|
if (nBlocksToInit > 0)
|
||||||
{
|
{
|
||||||
uint64_t emptyVal = fDbFile.getEmptyRowValue( colType, colWidth );
|
uint8_t* emptyVal = (uint8_t*) alloca(colWidth);
|
||||||
|
fDbFile.getEmptyRowValue( colType, colWidth, emptyVal );
|
||||||
rc = fDbFile.reInitPartialColumnExtent( pFile,
|
rc = fDbFile.reInitPartialColumnExtent( pFile,
|
||||||
(chunkPtrs[chunkIndex].first + restoredChunkLen),
|
(chunkPtrs[chunkIndex].first + restoredChunkLen),
|
||||||
nBlocksToInit,
|
nBlocksToInit,
|
||||||
|
@ -821,7 +821,8 @@ int ChunkManager::fetchChunkFromFile(IDBDataFile* pFile, int64_t id, ChunkData*&
|
|||||||
void ChunkManager::initializeColumnChunk(char* buf, CompFileData* fileData)
|
void ChunkManager::initializeColumnChunk(char* buf, CompFileData* fileData)
|
||||||
{
|
{
|
||||||
int size = UNCOMPRESSED_CHUNK_SIZE;
|
int size = UNCOMPRESSED_CHUNK_SIZE;
|
||||||
uint64_t emptyVal = fFileOp->getEmptyRowValue(fileData->fColDataType, fileData->fColWidth);
|
uint8_t* emptyVal = (uint8_t*) alloca(fileData->fColWidth);
|
||||||
|
fFileOp->getEmptyRowValue(fileData->fColDataType, fileData->fColWidth, emptyVal);
|
||||||
fFileOp->setEmptyBuf((unsigned char*)buf, size, emptyVal, fileData->fColWidth);
|
fFileOp->setEmptyBuf((unsigned char*)buf, size, emptyVal, fileData->fColWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1342,7 +1343,7 @@ inline int ChunkManager::writeHeader_(CompFileData* fileData, int ptrSecSize)
|
|||||||
// For the specified segment file (pFile), read in an abbreviated/compressed
|
// For the specified segment file (pFile), read in an abbreviated/compressed
|
||||||
// chunk extent, uncompress, and expand to a full chunk for a full extent.
|
// chunk extent, uncompress, and expand to a full chunk for a full extent.
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
int ChunkManager::expandAbbrevColumnExtent(IDBDataFile* pFile, uint64_t emptyVal, int width)
|
int ChunkManager::expandAbbrevColumnExtent(IDBDataFile* pFile, uint8_t* emptyVal, int width)
|
||||||
{
|
{
|
||||||
map<IDBDataFile*, CompFileData*>::iterator i = fFilePtrMap.find(pFile);
|
map<IDBDataFile*, CompFileData*>::iterator i = fFilePtrMap.find(pFile);
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ public:
|
|||||||
void cleanUp(const std::map<FID, FID>& columOids);
|
void cleanUp(const std::map<FID, FID>& columOids);
|
||||||
|
|
||||||
// @brief Expand an initial column, not dictionary, extent to a full extent.
|
// @brief Expand an initial column, not dictionary, extent to a full extent.
|
||||||
int expandAbbrevColumnExtent(IDBDataFile* pFile, uint64_t emptyVal, int width);
|
int expandAbbrevColumnExtent(IDBDataFile* pFile, uint8_t* emptyVal, int width);
|
||||||
|
|
||||||
// @brief Update column extent
|
// @brief Update column extent
|
||||||
int updateColumnExtent(IDBDataFile* pFile, int addBlockCount);
|
int updateColumnExtent(IDBDataFile* pFile, int addBlockCount);
|
||||||
|
@ -639,8 +639,6 @@ void Convertor::convertColType(ColStruct* curStruct)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// WIP replace with BINARY
|
|
||||||
//*internalType = WriteEngine::WR_INT128;
|
|
||||||
*internalType = WriteEngine::WR_BINARY;
|
*internalType = WriteEngine::WR_BINARY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -710,14 +708,8 @@ void Convertor::convertColType(ColStruct* curStruct)
|
|||||||
|
|
||||||
// check whether width is in sync with the requirement
|
// check whether width is in sync with the requirement
|
||||||
*width = getCorrectRowWidth(dataType, *width);
|
*width = getCorrectRowWidth(dataType, *width);
|
||||||
|
|
||||||
// This is the patch for the decimal thing, override
|
|
||||||
// if (dataType == CalpontSystemCatalog::DECIMAL)
|
|
||||||
// {
|
|
||||||
// *internalType = *width <= 4 ?
|
|
||||||
// WriteEngine::WR_INT : WriteEngine::WR_LONGLONG;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* DESCRIPTION:
|
* DESCRIPTION:
|
||||||
|
@ -161,7 +161,7 @@ int FileOp::createDir( const char* dirName, mode_t mode ) const
|
|||||||
* ERR_FILE_CREATE if can not create the file
|
* ERR_FILE_CREATE if can not create the file
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
int FileOp::createFile( const char* fileName, int numOfBlock,
|
int FileOp::createFile( const char* fileName, int numOfBlock,
|
||||||
uint64_t emptyVal, int width,
|
uint8_t* emptyVal, int width,
|
||||||
uint16_t dbRoot )
|
uint16_t dbRoot )
|
||||||
{
|
{
|
||||||
IDBDataFile* pFile =
|
IDBDataFile* pFile =
|
||||||
@ -228,7 +228,7 @@ int FileOp::createFile(FID fid,
|
|||||||
uint16_t dbRoot,
|
uint16_t dbRoot,
|
||||||
uint32_t partition,
|
uint32_t partition,
|
||||||
execplan::CalpontSystemCatalog::ColDataType colDataType,
|
execplan::CalpontSystemCatalog::ColDataType colDataType,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width)
|
int width)
|
||||||
{
|
{
|
||||||
//std::cout << "Creating file oid: " << fid <<
|
//std::cout << "Creating file oid: " << fid <<
|
||||||
@ -569,7 +569,7 @@ bool FileOp::existsOIDDir( FID fid ) const
|
|||||||
***********************************************************/
|
***********************************************************/
|
||||||
int FileOp::extendFile(
|
int FileOp::extendFile(
|
||||||
OID oid,
|
OID oid,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width,
|
int width,
|
||||||
HWM hwm,
|
HWM hwm,
|
||||||
BRM::LBID_t startLbid,
|
BRM::LBID_t startLbid,
|
||||||
@ -875,7 +875,7 @@ int FileOp::extendFile(
|
|||||||
***********************************************************/
|
***********************************************************/
|
||||||
int FileOp::addExtentExactFile(
|
int FileOp::addExtentExactFile(
|
||||||
OID oid,
|
OID oid,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width,
|
int width,
|
||||||
int& allocSize,
|
int& allocSize,
|
||||||
uint16_t dbRoot,
|
uint16_t dbRoot,
|
||||||
@ -1045,7 +1045,7 @@ int FileOp::initColumnExtent(
|
|||||||
IDBDataFile* pFile,
|
IDBDataFile* pFile,
|
||||||
uint16_t dbRoot,
|
uint16_t dbRoot,
|
||||||
int nBlocks,
|
int nBlocks,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width,
|
int width,
|
||||||
bool bNewFile,
|
bool bNewFile,
|
||||||
bool bExpandExtent,
|
bool bExpandExtent,
|
||||||
@ -1225,7 +1225,7 @@ int FileOp::initAbbrevCompColumnExtent(
|
|||||||
IDBDataFile* pFile,
|
IDBDataFile* pFile,
|
||||||
uint16_t dbRoot,
|
uint16_t dbRoot,
|
||||||
int nBlocks,
|
int nBlocks,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width)
|
int width)
|
||||||
{
|
{
|
||||||
// Reserve disk space for optimized abbreviated extent
|
// Reserve disk space for optimized abbreviated extent
|
||||||
@ -1285,7 +1285,7 @@ int FileOp::writeInitialCompColumnChunk(
|
|||||||
IDBDataFile* pFile,
|
IDBDataFile* pFile,
|
||||||
int nBlocksAllocated,
|
int nBlocksAllocated,
|
||||||
int nRows,
|
int nRows,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width,
|
int width,
|
||||||
char* hdrs)
|
char* hdrs)
|
||||||
{
|
{
|
||||||
@ -1366,7 +1366,7 @@ int FileOp::writeInitialCompColumnChunk(
|
|||||||
***********************************************************/
|
***********************************************************/
|
||||||
int FileOp::fillCompColumnExtentEmptyChunks(OID oid,
|
int FileOp::fillCompColumnExtentEmptyChunks(OID oid,
|
||||||
int colWidth,
|
int colWidth,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
uint16_t dbRoot,
|
uint16_t dbRoot,
|
||||||
uint32_t partition,
|
uint32_t partition,
|
||||||
uint16_t segment,
|
uint16_t segment,
|
||||||
@ -1671,7 +1671,7 @@ int FileOp::fillCompColumnExtentEmptyChunks(OID oid,
|
|||||||
***********************************************************/
|
***********************************************************/
|
||||||
int FileOp::expandAbbrevColumnChunk(
|
int FileOp::expandAbbrevColumnChunk(
|
||||||
IDBDataFile* pFile,
|
IDBDataFile* pFile,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int colWidth,
|
int colWidth,
|
||||||
const CompChunkPtr& chunkInPtr,
|
const CompChunkPtr& chunkInPtr,
|
||||||
CompChunkPtr& chunkOutPtr )
|
CompChunkPtr& chunkOutPtr )
|
||||||
@ -2036,7 +2036,7 @@ int FileOp::reInitPartialColumnExtent(
|
|||||||
IDBDataFile* pFile,
|
IDBDataFile* pFile,
|
||||||
long long startOffset,
|
long long startOffset,
|
||||||
int nBlocks,
|
int nBlocks,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width )
|
int width )
|
||||||
{
|
{
|
||||||
int rc = setFileOffset( pFile, startOffset, SEEK_SET );
|
int rc = setFileOffset( pFile, startOffset, SEEK_SET );
|
||||||
@ -2845,7 +2845,7 @@ bool FileOp::isDiskSpaceAvail(const std::string& fileName, int nBlocks) const
|
|||||||
int FileOp::expandAbbrevColumnExtent(
|
int FileOp::expandAbbrevColumnExtent(
|
||||||
IDBDataFile* pFile, // FILE ptr to file where abbrev extent is to be expanded
|
IDBDataFile* pFile, // FILE ptr to file where abbrev extent is to be expanded
|
||||||
uint16_t dbRoot, // The DBRoot of the file with the abbreviated extent
|
uint16_t dbRoot, // The DBRoot of the file with the abbreviated extent
|
||||||
uint64_t emptyVal,// Empty value to be used in expanding the extent
|
uint8_t* emptyVal,// Empty value to be used in expanding the extent
|
||||||
int width ) // Width of the column (in bytes)
|
int width ) // Width of the column (in bytes)
|
||||||
{
|
{
|
||||||
// Based on extent size, see how many blocks to add to fill the extent
|
// Based on extent size, see how many blocks to add to fill the extent
|
||||||
|
@ -92,7 +92,7 @@ public:
|
|||||||
int& allocSize,
|
int& allocSize,
|
||||||
uint16_t dbRoot, uint32_t partition,
|
uint16_t dbRoot, uint32_t partition,
|
||||||
execplan::CalpontSystemCatalog::ColDataType colDataType,
|
execplan::CalpontSystemCatalog::ColDataType colDataType,
|
||||||
uint64_t emptyVal = 0, int width = 1 ) ;
|
uint8_t* emptyVal, int width = 1 ) ;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,7 +100,7 @@ public:
|
|||||||
* Changed to public for UT.
|
* Changed to public for UT.
|
||||||
*/
|
*/
|
||||||
int createFile( const char* fileName, int fileSize,
|
int createFile( const char* fileName, int fileSize,
|
||||||
uint64_t emptyVal, int width,
|
uint8_t* emptyVal, int width,
|
||||||
uint16_t dbRoot );
|
uint16_t dbRoot );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,7 +163,7 @@ public:
|
|||||||
EXPORT virtual int expandAbbrevColumnExtent(
|
EXPORT virtual int expandAbbrevColumnExtent(
|
||||||
IDBDataFile* pFile,
|
IDBDataFile* pFile,
|
||||||
uint16_t dbRoot,
|
uint16_t dbRoot,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width );
|
int width );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -198,7 +198,7 @@ public:
|
|||||||
* @param hdrs (in/out) Contents of headers, if file is compressed.
|
* @param hdrs (in/out) Contents of headers, if file is compressed.
|
||||||
* @return returns NO_ERROR if success.
|
* @return returns NO_ERROR if success.
|
||||||
*/
|
*/
|
||||||
EXPORT int extendFile(OID oid, uint64_t emptyVal,
|
EXPORT int extendFile(OID oid, uint8_t* emptyVal,
|
||||||
int width,
|
int width,
|
||||||
HWM hwm,
|
HWM hwm,
|
||||||
BRM::LBID_t startLbid,
|
BRM::LBID_t startLbid,
|
||||||
@ -226,7 +226,7 @@ public:
|
|||||||
* @param newFile (out) Indicates if a new file was created for the extent
|
* @param newFile (out) Indicates if a new file was created for the extent
|
||||||
* @param hdrs (in/out) Contents of headers, if file is compressed.
|
* @param hdrs (in/out) Contents of headers, if file is compressed.
|
||||||
*/
|
*/
|
||||||
EXPORT int addExtentExactFile(OID oid, uint64_t emptyVal,
|
EXPORT int addExtentExactFile(OID oid, uint8_t* emptyVal,
|
||||||
int width,
|
int width,
|
||||||
int& allocSize,
|
int& allocSize,
|
||||||
uint16_t dbRoot,
|
uint16_t dbRoot,
|
||||||
@ -253,7 +253,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
EXPORT int fillCompColumnExtentEmptyChunks(OID oid,
|
EXPORT int fillCompColumnExtentEmptyChunks(OID oid,
|
||||||
int colWidth,
|
int colWidth,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
uint16_t dbRoot,
|
uint16_t dbRoot,
|
||||||
uint32_t partition,
|
uint32_t partition,
|
||||||
uint16_t segment,
|
uint16_t segment,
|
||||||
@ -433,7 +433,7 @@ public:
|
|||||||
EXPORT int reInitPartialColumnExtent( IDBDataFile* pFile,
|
EXPORT int reInitPartialColumnExtent( IDBDataFile* pFile,
|
||||||
long long startOffset,
|
long long startOffset,
|
||||||
int nBlocks,
|
int nBlocks,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width );
|
int width );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -497,7 +497,7 @@ public:
|
|||||||
int initColumnExtent( IDBDataFile* pFile,
|
int initColumnExtent( IDBDataFile* pFile,
|
||||||
uint16_t dbRoot,
|
uint16_t dbRoot,
|
||||||
int nBlocks,
|
int nBlocks,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width,
|
int width,
|
||||||
bool bNewFile,
|
bool bNewFile,
|
||||||
bool bExpandExtent,
|
bool bExpandExtent,
|
||||||
@ -519,7 +519,7 @@ private:
|
|||||||
FileOp& operator=(const FileOp& rhs);
|
FileOp& operator=(const FileOp& rhs);
|
||||||
|
|
||||||
int expandAbbrevColumnChunk( IDBDataFile* pFile,
|
int expandAbbrevColumnChunk( IDBDataFile* pFile,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int colWidth,
|
int colWidth,
|
||||||
const compress::CompChunkPtr& chunkInPtr,
|
const compress::CompChunkPtr& chunkInPtr,
|
||||||
compress::CompChunkPtr& chunkOutPt);
|
compress::CompChunkPtr& chunkOutPt);
|
||||||
@ -527,7 +527,7 @@ private:
|
|||||||
int initAbbrevCompColumnExtent( IDBDataFile* pFile,
|
int initAbbrevCompColumnExtent( IDBDataFile* pFile,
|
||||||
uint16_t dbRoot,
|
uint16_t dbRoot,
|
||||||
int nBlocks,
|
int nBlocks,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width);
|
int width);
|
||||||
|
|
||||||
static void initDbRootExtentMutexes();
|
static void initDbRootExtentMutexes();
|
||||||
@ -536,7 +536,7 @@ private:
|
|||||||
int writeInitialCompColumnChunk( IDBDataFile* pFile,
|
int writeInitialCompColumnChunk( IDBDataFile* pFile,
|
||||||
int nBlocksAllocated,
|
int nBlocksAllocated,
|
||||||
int nRows,
|
int nRows,
|
||||||
uint64_t emptyVal,
|
uint8_t* emptyVal,
|
||||||
int width,
|
int width,
|
||||||
char* hdrs);
|
char* hdrs);
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ typedef uint32_t FID; /** @brief File ID */
|
|||||||
typedef uint64_t RID; /** @brief Row ID */
|
typedef uint64_t RID; /** @brief Row ID */
|
||||||
typedef uint32_t TxnID; /** @brief Transaction ID (New)*/
|
typedef uint32_t TxnID; /** @brief Transaction ID (New)*/
|
||||||
typedef uint32_t HWM; /** @brief high water mark */
|
typedef uint32_t HWM; /** @brief high water mark */
|
||||||
|
typedef unsigned __int128 uint128_t;
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Type enumerations
|
* Type enumerations
|
||||||
@ -347,7 +348,7 @@ struct JobColumn /** @brief Job Column Structure */
|
|||||||
execplan::CalpontSystemCatalog::ColDataType dataType; /** @brief column data type */
|
execplan::CalpontSystemCatalog::ColDataType dataType; /** @brief column data type */
|
||||||
ColType weType; /** @brief write engine data type */
|
ColType weType; /** @brief write engine data type */
|
||||||
std::string typeName; /** @brief data type name */
|
std::string typeName; /** @brief data type name */
|
||||||
uint64_t emptyVal; /** @brief default empty value */
|
uint128_t emptyVal; /** @brief default empty value */
|
||||||
int width; /** @brief column width; for a dictionary column, this is "eventually" the token width */
|
int width; /** @brief column width; for a dictionary column, this is "eventually" the token width */
|
||||||
int definedWidth; /** @brief column width as defined in the table, used for non-dictionary strings */
|
int definedWidth; /** @brief column width as defined in the table, used for non-dictionary strings */
|
||||||
int dctnryWidth; /** @brief dictionary width */
|
int dctnryWidth; /** @brief dictionary width */
|
||||||
|
@ -45,6 +45,7 @@ using namespace execplan;
|
|||||||
|
|
||||||
using namespace idbdatafile;
|
using namespace idbdatafile;
|
||||||
|
|
||||||
|
#include "emptyvaluemanip.h"
|
||||||
|
|
||||||
namespace WriteEngine
|
namespace WriteEngine
|
||||||
{
|
{
|
||||||
@ -54,6 +55,9 @@ struct RefcolInfo
|
|||||||
unsigned numExtents;
|
unsigned numExtents;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using int128_t = __int128;
|
||||||
|
using uint128_t = unsigned __int128;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
@ -126,10 +130,8 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
|
|||||||
Column newCol;
|
Column newCol;
|
||||||
unsigned char buf[BYTE_PER_BLOCK];
|
unsigned char buf[BYTE_PER_BLOCK];
|
||||||
unsigned char* curVal;
|
unsigned char* curVal;
|
||||||
int64_t emptyVal = getEmptyRowValue(column.colDataType, column.colWidth); // Seems is ok have it here and just once
|
uint8_t* emptyVal = (uint8_t*) alloca(column.colWidth);
|
||||||
// TODO MCOL-641 consolidate the emptyvalue logic
|
getEmptyRowValue(column.colDataType, column.colWidth, emptyVal);
|
||||||
//__int128 bigEmptyVal;
|
|
||||||
//dataconvert::DataConvert::uint128Max(bigEmptyVal);
|
|
||||||
|
|
||||||
if (useStartingExtent)
|
if (useStartingExtent)
|
||||||
{
|
{
|
||||||
@ -190,10 +192,12 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
|
|||||||
{
|
{
|
||||||
if (rc == ERR_FILE_EOF)
|
if (rc == ERR_FILE_EOF)
|
||||||
{
|
{
|
||||||
uint64_t emptyVal = getEmptyRowValue(column.colDataType, column.colWidth);
|
uint8_t* emptyVal = (uint8_t*) alloca(column.colWidth);
|
||||||
|
getEmptyRowValue(column.colDataType, column.colWidth, emptyVal);
|
||||||
setEmptyBuf(buf, BYTE_PER_BLOCK, emptyVal, column.colWidth);
|
setEmptyBuf(buf, BYTE_PER_BLOCK, emptyVal, column.colWidth);
|
||||||
RETURN_ON_ERROR(saveBlock(column.dataFile.pFile, buf, hwm));
|
RETURN_ON_ERROR(saveBlock(column.dataFile.pFile, buf, hwm));
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -287,7 +291,8 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
|
|||||||
|
|
||||||
if (newColStructList[i].fCompressionType > 0)
|
if (newColStructList[i].fCompressionType > 0)
|
||||||
{
|
{
|
||||||
uint64_t emptyVal = getEmptyRowValue(newColStructList[i].colDataType, newColStructList[i].colWidth);
|
uint8_t* emptyVal = (uint8_t*) alloca(newColStructList[i].colWidth);
|
||||||
|
getEmptyRowValue(newColStructList[i].colDataType, newColStructList[i].colWidth, emptyVal);
|
||||||
string errorInfo;
|
string errorInfo;
|
||||||
rc = fileOp.fillCompColumnExtentEmptyChunks(newColStructList[i].dataOid, newColStructList[i].colWidth,
|
rc = fileOp.fillCompColumnExtentEmptyChunks(newColStructList[i].dataOid, newColStructList[i].colWidth,
|
||||||
emptyVal, dbRoot, partition, segment, newHwm, segFile, errorInfo);
|
emptyVal, dbRoot, partition, segment, newHwm, segFile, errorInfo);
|
||||||
@ -313,7 +318,8 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t emptyVal = getEmptyRowValue(newColStructList[i].colDataType, newColStructList[i].colWidth);
|
uint8_t* emptyVal = (uint8_t*) alloca(newColStructList[i].colWidth);
|
||||||
|
getEmptyRowValue(newColStructList[i].colDataType, newColStructList[i].colWidth, emptyVal);
|
||||||
rc = fileOp.expandAbbrevColumnExtent( pFile, dbRoot, emptyVal, newColStructList[i].colWidth);
|
rc = fileOp.expandAbbrevColumnExtent( pFile, dbRoot, emptyVal, newColStructList[i].colWidth);
|
||||||
//set hwm for this extent.
|
//set hwm for this extent.
|
||||||
fileOp.closeFile(pFile);
|
fileOp.closeFile(pFile);
|
||||||
@ -385,7 +391,7 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
|
|||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
//create corresponding dictionary files
|
//create corresponding dictionary files
|
||||||
if (newFile )
|
if (newFile)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<WriteEngineWrapper> we (new WriteEngineWrapper());
|
boost::scoped_ptr<WriteEngineWrapper> we (new WriteEngineWrapper());
|
||||||
we->setTransId(txnid);
|
we->setTransId(txnid);
|
||||||
@ -406,7 +412,7 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
we->flushDataFiles(rc, txnid, columnOids );
|
we->flushDataFiles(rc, txnid, columnOids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,10 +496,12 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
|
|||||||
{
|
{
|
||||||
if (rc == ERR_FILE_EOF)
|
if (rc == ERR_FILE_EOF)
|
||||||
{
|
{
|
||||||
uint64_t emptyVal = getEmptyRowValue(newCol.colDataType, newCol.colWidth);
|
uint8_t* emptyVal = (uint8_t*) alloca(newCol.colWidth);
|
||||||
|
getEmptyRowValue(newCol.colDataType, newCol.colWidth, emptyVal);
|
||||||
setEmptyBuf(buf, BYTE_PER_BLOCK, emptyVal, newCol.colWidth);
|
setEmptyBuf(buf, BYTE_PER_BLOCK, emptyVal, newCol.colWidth);
|
||||||
RETURN_ON_ERROR(saveBlock(newCol.dataFile.pFile, buf, newHwm));
|
RETURN_ON_ERROR(saveBlock(newCol.dataFile.pFile, buf, newHwm));
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -531,10 +539,12 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
|
|||||||
{
|
{
|
||||||
if (rc == ERR_FILE_EOF)
|
if (rc == ERR_FILE_EOF)
|
||||||
{
|
{
|
||||||
uint64_t emptyVal = getEmptyRowValue(newCol.colDataType, newCol.colWidth);
|
uint8_t* emptyVal = (uint8_t*) alloca(newCol.colWidth);
|
||||||
|
getEmptyRowValue(newCol.colDataType, newCol.colWidth, emptyVal);
|
||||||
setEmptyBuf(buf, BYTE_PER_BLOCK, emptyVal, newCol.colWidth);
|
setEmptyBuf(buf, BYTE_PER_BLOCK, emptyVal, newCol.colWidth);
|
||||||
RETURN_ON_ERROR(saveBlock(newCol.dataFile.pFile, buf, newHwm));
|
RETURN_ON_ERROR(saveBlock(newCol.dataFile.pFile, buf, newHwm));
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -641,10 +651,10 @@ int ColumnOp::createColumn(Column& column,
|
|||||||
uint32_t partition)
|
uint32_t partition)
|
||||||
{
|
{
|
||||||
int rc, newWidth, allocSize;
|
int rc, newWidth, allocSize;
|
||||||
uint64_t emptyVal = 0;
|
|
||||||
int compressionType = column.compressionType;
|
int compressionType = column.compressionType;
|
||||||
setColParam(column, colNo, colWidth, colDataType, colType);
|
setColParam(column, colNo, colWidth, colDataType, colType);
|
||||||
emptyVal = getEmptyRowValue(colDataType, colWidth);
|
uint8_t* emptyVal = (uint8_t*) alloca(colWidth);
|
||||||
|
getEmptyRowValue(colDataType, colWidth, emptyVal);
|
||||||
newWidth = getCorrectRowWidth(colDataType, colWidth);
|
newWidth = getCorrectRowWidth(colDataType, colWidth);
|
||||||
column.dataFile.fid = dataFid;
|
column.dataFile.fid = dataFid;
|
||||||
column.dataFile.fDbRoot = dbRoot;
|
column.dataFile.fDbRoot = dbRoot;
|
||||||
@ -677,8 +687,6 @@ int ColumnOp::fillColumn(const TxnID& txnid, Column& column, Column& refCol, voi
|
|||||||
HWM colHwm = 0;
|
HWM colHwm = 0;
|
||||||
RID maxRowId = 0;
|
RID maxRowId = 0;
|
||||||
int size = sizeof(Token);
|
int size = sizeof(Token);
|
||||||
uint64_t emptyVal;
|
|
||||||
uint64_t refEmptyVal;
|
|
||||||
|
|
||||||
long long startColFbo = 0;
|
long long startColFbo = 0;
|
||||||
long long startRefColFbo = 0;
|
long long startRefColFbo = 0;
|
||||||
@ -713,8 +721,10 @@ int ColumnOp::fillColumn(const TxnID& txnid, Column& column, Column& refCol, voi
|
|||||||
config.initConfigCache();
|
config.initConfigCache();
|
||||||
std::vector<uint16_t> rootList;
|
std::vector<uint16_t> rootList;
|
||||||
config.getRootIdList( rootList );
|
config.getRootIdList( rootList );
|
||||||
emptyVal = getEmptyRowValue(column.colDataType, column.colWidth);
|
uint8_t* emptyVal = (uint8_t*) alloca(column.colWidth);
|
||||||
refEmptyVal = getEmptyRowValue(refCol.colDataType, refCol.colWidth);
|
uint8_t* refEmptyVal = (uint8_t*) alloca(refCol.colWidth);
|
||||||
|
getEmptyRowValue(column.colDataType, column.colWidth, emptyVal);
|
||||||
|
getEmptyRowValue(refCol.colDataType, refCol.colWidth, refEmptyVal);
|
||||||
//find the dbroots which have rows for refrence column
|
//find the dbroots which have rows for refrence column
|
||||||
unsigned int i = 0, k = 0;
|
unsigned int i = 0, k = 0;
|
||||||
|
|
||||||
@ -938,7 +948,7 @@ int ColumnOp::fillColumn(const TxnID& txnid, Column& column, Column& refCol, voi
|
|||||||
|
|
||||||
while (refBufOffset > 0)
|
while (refBufOffset > 0)
|
||||||
{
|
{
|
||||||
if (memcmp(&refColBuf[refBufOffset], &refEmptyVal, refCol.colWidth) != 0)
|
if (memcmp(&refColBuf[refBufOffset], refEmptyVal, refCol.colWidth) != 0)
|
||||||
{
|
{
|
||||||
maxRowId = maxRowId + (refBufOffset / refCol.colWidth);
|
maxRowId = maxRowId + (refBufOffset / refCol.colWidth);
|
||||||
break;
|
break;
|
||||||
@ -999,7 +1009,7 @@ int ColumnOp::fillColumn(const TxnID& txnid, Column& column, Column& refCol, voi
|
|||||||
while ((tmpBufOffset + refCol.colWidth) <= BYTE_PER_BLOCK)
|
while ((tmpBufOffset + refCol.colWidth) <= BYTE_PER_BLOCK)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (memcmp(refColBuf + tmpBufOffset, &refEmptyVal, refCol.colWidth) != 0) //Find the number of nextVal needed.
|
if (memcmp(refColBuf + tmpBufOffset, refEmptyVal, refCol.colWidth) != 0) //Find the number of nextVal needed.
|
||||||
{
|
{
|
||||||
nexValNeeded++;
|
nexValNeeded++;
|
||||||
//memcpy(colBuf + colBufOffset, defaultVal, column.colWidth);
|
//memcpy(colBuf + colBufOffset, defaultVal, column.colWidth);
|
||||||
@ -1028,7 +1038,7 @@ int ColumnOp::fillColumn(const TxnID& txnid, Column& column, Column& refCol, voi
|
|||||||
while (((refBufOffset + refCol.colWidth) <= BYTE_PER_BLOCK) &&
|
while (((refBufOffset + refCol.colWidth) <= BYTE_PER_BLOCK) &&
|
||||||
((colBufOffset + column.colWidth) <= BYTE_PER_BLOCK))
|
((colBufOffset + column.colWidth) <= BYTE_PER_BLOCK))
|
||||||
{
|
{
|
||||||
if (memcmp(refColBuf + refBufOffset, &refEmptyVal, refCol.colWidth) != 0) //Find the number of nextVal needed.
|
if (memcmp(refColBuf + refBufOffset, refEmptyVal, refCol.colWidth) != 0) //Find the number of nextVal needed.
|
||||||
{
|
{
|
||||||
memcpy(defaultVal, &nextVal, 8);
|
memcpy(defaultVal, &nextVal, 8);
|
||||||
nextVal++;
|
nextVal++;
|
||||||
@ -1085,7 +1095,7 @@ int ColumnOp::fillColumn(const TxnID& txnid, Column& column, Column& refCol, voi
|
|||||||
while (((refBufOffset + refCol.colWidth) <= BYTE_PER_BLOCK) &&
|
while (((refBufOffset + refCol.colWidth) <= BYTE_PER_BLOCK) &&
|
||||||
((colBufOffset + column.colWidth) <= BYTE_PER_BLOCK))
|
((colBufOffset + column.colWidth) <= BYTE_PER_BLOCK))
|
||||||
{
|
{
|
||||||
if (memcmp(refColBuf + refBufOffset, &refEmptyVal, refCol.colWidth) != 0)
|
if (memcmp(refColBuf + refBufOffset, refEmptyVal, refCol.colWidth) != 0)
|
||||||
{
|
{
|
||||||
/*if (autoincrement)
|
/*if (autoincrement)
|
||||||
{
|
{
|
||||||
@ -1097,8 +1107,7 @@ int ColumnOp::fillColumn(const TxnID& txnid, Column& column, Column& refCol, voi
|
|||||||
}
|
}
|
||||||
else if (column.compressionType != 0) //@Bug 3866, fill the empty row value for compressed chunk
|
else if (column.compressionType != 0) //@Bug 3866, fill the empty row value for compressed chunk
|
||||||
{
|
{
|
||||||
for(int b = 0, w = column.colWidth; b < column.colWidth; b += 8, w = 8) //FIXME for no loop!
|
memcpy(colBuf + colBufOffset, emptyVal, column.colWidth);
|
||||||
memcpy(colBuf + colBufOffset + b, &emptyVal, w);
|
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1327,9 +1336,8 @@ int ColumnOp::extendColumn(
|
|||||||
bool& newFile,
|
bool& newFile,
|
||||||
char* hdrs)
|
char* hdrs)
|
||||||
{
|
{
|
||||||
uint64_t emptyVal = 0;
|
uint8_t* emptyVal = (uint8_t*) alloca(column.colWidth);
|
||||||
|
getEmptyRowValue(column.colDataType, column.colWidth, emptyVal);
|
||||||
emptyVal = getEmptyRowValue(column.colDataType, column.colWidth);
|
|
||||||
int rc = extendFile(column.dataFile.fid,
|
int rc = extendFile(column.dataFile.fid,
|
||||||
emptyVal,
|
emptyVal,
|
||||||
column.colWidth,
|
column.colWidth,
|
||||||
@ -1370,9 +1378,8 @@ int ColumnOp::addExtent(
|
|||||||
int& allocSize,
|
int& allocSize,
|
||||||
char* hdrs)
|
char* hdrs)
|
||||||
{
|
{
|
||||||
uint64_t emptyVal = 0;
|
uint8_t* emptyVal = (uint8_t*) alloca(column.colWidth);
|
||||||
|
getEmptyRowValue(column.colDataType, column.colWidth, emptyVal);
|
||||||
emptyVal = getEmptyRowValue(column.colDataType, column.colWidth);
|
|
||||||
int rc = addExtentExactFile(column.dataFile.fid,
|
int rc = addExtentExactFile(column.dataFile.fid,
|
||||||
emptyVal,
|
emptyVal,
|
||||||
column.colWidth,
|
column.colWidth,
|
||||||
@ -1400,7 +1407,8 @@ int ColumnOp::addExtent(
|
|||||||
***********************************************************/
|
***********************************************************/
|
||||||
int ColumnOp::expandAbbrevExtent(const Column& column)
|
int ColumnOp::expandAbbrevExtent(const Column& column)
|
||||||
{
|
{
|
||||||
uint64_t emptyVal = getEmptyRowValue(column.colDataType, column.colWidth);
|
uint8_t* emptyVal = (uint8_t*) alloca(column.colWidth);
|
||||||
|
getEmptyRowValue(column.colDataType, column.colWidth, emptyVal);
|
||||||
int rc = expandAbbrevColumnExtent(column.dataFile.pFile,
|
int rc = expandAbbrevColumnExtent(column.dataFile.pFile,
|
||||||
column.dataFile.fDbRoot,
|
column.dataFile.fDbRoot,
|
||||||
emptyVal,
|
emptyVal,
|
||||||
@ -1456,33 +1464,30 @@ void ColumnOp::initColumn(Column& column) const
|
|||||||
* RETURN:
|
* RETURN:
|
||||||
* true if success, false otherwise
|
* true if success, false otherwise
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
|
inline bool ColumnOp::isEmptyRow(uint64_t* curVal, uint8_t* emptyVal, const int colWidth)
|
||||||
// It is called at just 4 places on allocRowId() but all the time inside extend scanning loops
|
|
||||||
// WIP Template this method
|
|
||||||
// TODO MCOL-641 Add support here.
|
|
||||||
inline bool ColumnOp::isEmptyRow(uint64_t* curVal, uint64_t emptyVal, const int colWidth)
|
|
||||||
{
|
{
|
||||||
|
// colWidth is either 1, 2, 4, 8, or 16 (Convertor::getCorrectRowWidth)
|
||||||
switch(colWidth){
|
switch(colWidth){
|
||||||
case 1:
|
case 1:
|
||||||
return *(uint8_t*)curVal == emptyVal;
|
return *(uint8_t*)curVal == *(uint8_t*)emptyVal;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
return *(uint16_t*)curVal == emptyVal;
|
return *(uint16_t*)curVal == *(uint16_t*)emptyVal;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
return *(uint32_t*)curVal == emptyVal;
|
return *(uint32_t*)curVal == *(uint32_t*)emptyVal;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
return *curVal == emptyVal;
|
return *(uint64_t*)curVal == *(uint64_t*)emptyVal;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
return ((curVal[0] == emptyVal) && (curVal[1] == emptyVal));
|
return *(uint128_t*)curVal == *(uint128_t*)emptyVal;
|
||||||
|
|
||||||
case 32:
|
//case 32:
|
||||||
return ((curVal[0] == emptyVal) && (curVal[1] == emptyVal)
|
// return ((curVal[0] == emptyVal) && (curVal[1] == emptyVal)
|
||||||
&& (curVal[2] == emptyVal) && (curVal[3] == emptyVal));
|
// && (curVal[2] == emptyVal) && (curVal[3] == emptyVal));
|
||||||
}
|
}
|
||||||
// WIP
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1610,11 +1615,6 @@ void ColumnOp::setColParam(Column& column,
|
|||||||
column.compressionType = compressionType;
|
column.compressionType = compressionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
// WIP
|
|
||||||
using int128_t = __int128;
|
|
||||||
using uint128_t = unsigned __int128;
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
* DESCRIPTION:
|
* DESCRIPTION:
|
||||||
* Write row(s)
|
* Write row(s)
|
||||||
@ -1637,7 +1637,7 @@ int ColumnOp::writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray,
|
|||||||
bool bExit = false, bDataDirty = false;
|
bool bExit = false, bDataDirty = false;
|
||||||
void* pVal = 0;
|
void* pVal = 0;
|
||||||
char charTmpBuf[8];
|
char charTmpBuf[8];
|
||||||
uint64_t emptyVal;
|
uint8_t* emptyVal = (uint8_t*) alloca(curCol.colWidth);
|
||||||
int rc = NO_ERROR;
|
int rc = NO_ERROR;
|
||||||
uint16_t rowsInBlock = BYTE_PER_BLOCK / curCol.colWidth;
|
uint16_t rowsInBlock = BYTE_PER_BLOCK / curCol.colWidth;
|
||||||
|
|
||||||
@ -1734,9 +1734,7 @@ int ColumnOp::writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WriteEngine::WR_BINARY:
|
case WriteEngine::WR_BINARY:
|
||||||
// WIP CSCCol type
|
if (!bDelete) pVal = &((int128_t*) valArray)[i];
|
||||||
pVal = &((uint128_t*) valArray)[i];
|
|
||||||
//pVal = (uint8_t*) valArray + i * curCol.colWidth;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
@ -1744,11 +1742,10 @@ int ColumnOp::writeRow(Column& curCol, uint64_t totalRow, const RID* rowIdArray,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO MCOL-641 do we need support here?
|
|
||||||
if (bDelete)
|
if (bDelete)
|
||||||
{
|
{
|
||||||
emptyVal = getEmptyRowValue(curCol.colDataType, curCol.colWidth);
|
utils::getEmptyRowValue(curCol.colDataType, curCol.colWidth, emptyVal);
|
||||||
pVal = &emptyVal;
|
pVal = emptyVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the write stuff
|
// This is the write stuff
|
||||||
@ -1793,16 +1790,9 @@ int ColumnOp::writeRows(Column& curCol, uint64_t totalRow, const RIDList& ridLis
|
|||||||
void* pVal = 0;
|
void* pVal = 0;
|
||||||
//void* pOldVal;
|
//void* pOldVal;
|
||||||
char charTmpBuf[8];
|
char charTmpBuf[8];
|
||||||
uint64_t emptyVal;
|
uint8_t* emptyVal;
|
||||||
int rc = NO_ERROR;
|
int rc = NO_ERROR;
|
||||||
|
|
||||||
int w = 0, incr = 8;
|
|
||||||
|
|
||||||
if (curCol.colType == WriteEngine::WR_BINARY)
|
|
||||||
w = incr = curCol.colWidth;
|
|
||||||
else
|
|
||||||
w = curCol.colWidth > 8 ? 8 : curCol.colWidth;
|
|
||||||
|
|
||||||
while (!bExit)
|
while (!bExit)
|
||||||
{
|
{
|
||||||
curRowId = ridList[i];
|
curRowId = ridList[i];
|
||||||
@ -1903,26 +1893,12 @@ int ColumnOp::writeRows(Column& curCol, uint64_t totalRow, const RIDList& ridLis
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (curCol.colType != WriteEngine::WR_BINARY)
|
emptyVal = (uint8_t*) alloca(curCol.colWidth);
|
||||||
{
|
getEmptyRowValue(curCol.colDataType, curCol.colWidth, emptyVal);
|
||||||
emptyVal = getEmptyRowValue(curCol.colDataType, curCol.colWidth);
|
pVal = emptyVal;
|
||||||
pVal = &emptyVal;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// fix this
|
|
||||||
uint128_t bigEmptyVal;
|
|
||||||
emptyVal = getEmptyRowValue(curCol.colDataType, curCol.colWidth);
|
|
||||||
*(reinterpret_cast<uint64_t*>(&bigEmptyVal)) = emptyVal;
|
|
||||||
*(reinterpret_cast<uint64_t*>(&bigEmptyVal) + 1) = emptyVal;
|
|
||||||
//dataconvert::DataConvert::uint128Max(bigEmptyVal);
|
|
||||||
pVal = &bigEmptyVal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the write stuff
|
writeBufValue(dataBuf + dataBio, pVal, curCol.colWidth);
|
||||||
for (int b = 0; b < curCol.colWidth; b += incr) //FIXME for no loop
|
|
||||||
writeBufValue(dataBuf + dataBio + b, pVal, w);
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Check whether it is an empty row
|
* @brief Check whether it is an empty row
|
||||||
*/
|
*/
|
||||||
EXPORT virtual bool isEmptyRow(uint64_t* curVal, uint64_t emptyVal, const int colWidth);
|
EXPORT virtual bool isEmptyRow(uint64_t* curVal, uint8_t* emptyVal, const int colWidth);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check whether it is a valid column
|
* @brief Check whether it is a valid column
|
||||||
|
@ -191,7 +191,7 @@ int ColumnOpCompress1::flushFile(int rc, std::map<FID, FID>& columnOids)
|
|||||||
|
|
||||||
|
|
||||||
int ColumnOpCompress1::expandAbbrevColumnExtent(
|
int ColumnOpCompress1::expandAbbrevColumnExtent(
|
||||||
IDBDataFile* pFile, uint16_t dbRoot, uint64_t emptyVal, int width)
|
IDBDataFile* pFile, uint16_t dbRoot, uint8_t* emptyVal, int width)
|
||||||
{
|
{
|
||||||
// update the uncompressed initial chunk to full chunk
|
// update the uncompressed initial chunk to full chunk
|
||||||
int rc = m_chunkManager->expandAbbrevColumnExtent(pFile, emptyVal, width);
|
int rc = m_chunkManager->expandAbbrevColumnExtent(pFile, emptyVal, width);
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief virtual method in FileOp
|
* @brief virtual method in FileOp
|
||||||
*/
|
*/
|
||||||
int expandAbbrevColumnExtent(IDBDataFile* pFile, uint16_t dbRoot, uint64_t emptyVal, int width);
|
int expandAbbrevColumnExtent(IDBDataFile* pFile, uint16_t dbRoot, uint8_t* emptyVal, int width);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief virtual method in ColumnOp
|
* @brief virtual method in ColumnOp
|
||||||
|
@ -168,7 +168,6 @@ int WriteEngineWrapper::checkValid(const TxnID& txnid, const ColStructList& colS
|
|||||||
structListSize = colStructList.size() ;
|
structListSize = colStructList.size() ;
|
||||||
valListSize = colValueList.size();
|
valListSize = colValueList.size();
|
||||||
|
|
||||||
// if (colStructList.size() != colValueList.size())
|
|
||||||
if (structListSize != valListSize)
|
if (structListSize != valListSize)
|
||||||
return ERR_STRUCT_VALUE_NOT_MATCH;
|
return ERR_STRUCT_VALUE_NOT_MATCH;
|
||||||
|
|
||||||
@ -400,16 +399,16 @@ void WriteEngineWrapper::convertValue(const execplan::CalpontSystemCatalog::ColT
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// WIP MCOL-641
|
|
||||||
case WriteEngine::WR_BINARY:
|
case WriteEngine::WR_BINARY:
|
||||||
{
|
{
|
||||||
size = cscColType.colWidth;
|
size = cscColType.colWidth;
|
||||||
if (cscColType.colDataType == CalpontSystemCatalog::DECIMAL)
|
if (cscColType.colDataType == CalpontSystemCatalog::DECIMAL ||
|
||||||
|
cscColType.colDataType == CalpontSystemCatalog::UDECIMAL)
|
||||||
{
|
{
|
||||||
int128_t val = boost::any_cast<int128_t>(data);
|
int128_t val = boost::any_cast<int128_t>(data);
|
||||||
memcpy(value, &val, size);
|
memcpy(value, &val, size);
|
||||||
}
|
}
|
||||||
else
|
else // for CalpontSystemCatalog::BINARY
|
||||||
{
|
{
|
||||||
char val = boost::any_cast<char>(data);
|
char val = boost::any_cast<char>(data);
|
||||||
memcpy(value, &val, size);
|
memcpy(value, &val, size);
|
||||||
@ -521,19 +520,19 @@ void WriteEngineWrapper::convertValue(const CalpontSystemCatalog::ColType& cscCo
|
|||||||
((Token*)valArray)[pos] = boost::any_cast<Token>(data);
|
((Token*)valArray)[pos] = boost::any_cast<Token>(data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// WIP MCOL-641
|
||||||
case WriteEngine::WR_BINARY:
|
case WriteEngine::WR_BINARY:
|
||||||
if (cscColType.colDataType != CalpontSystemCatalog::DECIMAL)
|
size_t size = cscColType.colWidth;
|
||||||
{
|
if (cscColType.colDataType == CalpontSystemCatalog::DECIMAL ||
|
||||||
curStr = boost::any_cast<string>(data);
|
cscColType.colDataType == CalpontSystemCatalog::UDECIMAL)
|
||||||
// String length or column width?
|
|
||||||
memcpy((char*)valArray + pos * curStr.length(), curStr.c_str(), curStr.length());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
int128_t val = boost::any_cast<int128_t>(data);
|
int128_t val = boost::any_cast<int128_t>(data);
|
||||||
size_t size = cscColType.colWidth;
|
memcpy((uint8_t*)valArray + pos * size, &val, size);
|
||||||
// WIP Why do we use memcpy here?
|
}
|
||||||
memcpy((uint8_t*)valArray+pos*size, &val, size);
|
else // for CalpontSystemCatalog::BINARY
|
||||||
|
{
|
||||||
|
char val = boost::any_cast<char>(data);
|
||||||
|
memcpy((uint8_t*)valArray + pos * size, &val, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -602,17 +601,19 @@ void WriteEngineWrapper::convertValue(const CalpontSystemCatalog::ColType& cscCo
|
|||||||
case WriteEngine::WR_TOKEN:
|
case WriteEngine::WR_TOKEN:
|
||||||
data = ((Token*)valArray)[pos];
|
data = ((Token*)valArray)[pos];
|
||||||
break;
|
break;
|
||||||
// WIP
|
// WIP MCOL-641
|
||||||
case WriteEngine::WR_BINARY :
|
case WriteEngine::WR_BINARY :
|
||||||
if (cscColType.colDataType == CalpontSystemCatalog::DECIMAL)
|
if (cscColType.colDataType == CalpontSystemCatalog::DECIMAL ||
|
||||||
|
cscColType.colDataType == CalpontSystemCatalog::UDECIMAL)
|
||||||
{
|
{
|
||||||
data = ((int128_t*)valArray)[pos];
|
data = ((int128_t*)valArray)[pos];
|
||||||
}
|
}
|
||||||
else
|
else // for CalpontSystemCatalog::BINARY
|
||||||
{
|
{
|
||||||
// WIP do we need tmp here?
|
// WIP do we need tmp here?
|
||||||
char *tmp = (char*) alloca (sizeof(char) * cscColType.colWidth);
|
size_t size = cscColType.colWidth;
|
||||||
memcpy(tmp, (char*)valArray + pos * cscColType.colWidth, cscColType.colWidth);
|
char *tmp = (char*) alloca (sizeof(char) * size);
|
||||||
|
memcpy(tmp, (uint8_t*)valArray + pos * size, size);
|
||||||
curStr = tmp;
|
curStr = tmp;
|
||||||
data = curStr;
|
data = curStr;
|
||||||
}
|
}
|
||||||
@ -778,7 +779,6 @@ int WriteEngineWrapper::deleteRow(const TxnID& txnid, const vector<CSCTypesList>
|
|||||||
DctnryValueList dctnryValueList;
|
DctnryValueList dctnryValueList;
|
||||||
ColStructList colStructList;
|
ColStructList colStructList;
|
||||||
CSCTypesList cscColTypeList;
|
CSCTypesList cscColTypeList;
|
||||||
uint64_t emptyVal;
|
|
||||||
int rc;
|
int rc;
|
||||||
string tmpStr("");
|
string tmpStr("");
|
||||||
vector<DctnryStructList> dctnryExtentsStruct;
|
vector<DctnryStructList> dctnryExtentsStruct;
|
||||||
@ -790,6 +790,8 @@ int WriteEngineWrapper::deleteRow(const TxnID& txnid, const vector<CSCTypesList>
|
|||||||
setTransId(txnid);
|
setTransId(txnid);
|
||||||
unsigned numExtents = colExtentsStruct.size();
|
unsigned numExtents = colExtentsStruct.size();
|
||||||
|
|
||||||
|
uint128_t emptyVal;
|
||||||
|
|
||||||
for (unsigned extent = 0; extent < numExtents; extent++)
|
for (unsigned extent = 0; extent < numExtents; extent++)
|
||||||
{
|
{
|
||||||
colStructList = colExtentsStruct[extent];
|
colStructList = colExtentsStruct[extent];
|
||||||
@ -802,23 +804,21 @@ int WriteEngineWrapper::deleteRow(const TxnID& txnid, const vector<CSCTypesList>
|
|||||||
cscColType = cscColTypeList[i];
|
cscColType = cscColTypeList[i];
|
||||||
Convertor::convertColType(&curColStruct);
|
Convertor::convertColType(&curColStruct);
|
||||||
|
|
||||||
if (curColStruct.colType == WriteEngine::WR_BINARY)
|
/*if (curColStruct.colType == WriteEngine::WR_BINARY)
|
||||||
{
|
{
|
||||||
uint128_t bigEmptyVal;
|
uint128_t bigEmptyVal;
|
||||||
emptyVal = m_colOp[op(curColStruct.fCompressionType)]->
|
emptyVal = m_colOp[op(curColStruct.fCompressionType)]->
|
||||||
getEmptyRowValue(curColStruct.colDataType, curColStruct.colWidth);
|
getEmptyRowValue(curColStruct.colDataType, curColStruct.colWidth);
|
||||||
*(reinterpret_cast<uint64_t*>(&bigEmptyVal)) = emptyVal;
|
*(reinterpret_cast<uint64_t*>(&bigEmptyVal)) = emptyVal;
|
||||||
*(reinterpret_cast<uint64_t*>(&bigEmptyVal) + 1) = emptyVal;
|
*(reinterpret_cast<uint64_t*>(&bigEmptyVal) + 1) = emptyVal;
|
||||||
//dataconvert::DataConvert::uint128Max(bigEmptyVal);
|
|
||||||
curTuple.data = bigEmptyVal;
|
curTuple.data = bigEmptyVal;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{*/
|
||||||
emptyVal = m_colOp[op(curColStruct.fCompressionType)]->
|
m_colOp[op(curColStruct.fCompressionType)]->
|
||||||
getEmptyRowValue(curColStruct.colDataType, curColStruct.colWidth);
|
getEmptyRowValue(curColStruct.colDataType, curColStruct.colWidth, (uint8_t*)&emptyVal);
|
||||||
|
|
||||||
curTuple.data = emptyVal;
|
curTuple.data = emptyVal;
|
||||||
}
|
//}
|
||||||
|
|
||||||
curTupleList.push_back(curTuple);
|
curTupleList.push_back(curTuple);
|
||||||
colValueList.push_back(curTupleList);
|
colValueList.push_back(curTupleList);
|
||||||
@ -850,6 +850,75 @@ int WriteEngineWrapper::deleteRow(const TxnID& txnid, const vector<CSCTypesList>
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void allocateValArray(void*& valArray, ColTupleList::size_type totalRow,
|
||||||
|
ColType colType, int colWidth)
|
||||||
|
{
|
||||||
|
valArray = calloc(totalRow, colWidth);
|
||||||
|
// TODO MCOL-641 is commenting out the switch statement below correct?
|
||||||
|
#if 0
|
||||||
|
switch (colType)
|
||||||
|
{
|
||||||
|
case WriteEngine::WR_INT:
|
||||||
|
case WriteEngine::WR_MEDINT:
|
||||||
|
valArray = (int*) calloc(sizeof(int), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_UINT:
|
||||||
|
case WriteEngine::WR_UMEDINT:
|
||||||
|
valArray = (uint32_t*) calloc(sizeof(uint32_t), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_VARBINARY : // treat same as char for now
|
||||||
|
case WriteEngine::WR_CHAR:
|
||||||
|
case WriteEngine::WR_BLOB:
|
||||||
|
case WriteEngine::WR_TEXT:
|
||||||
|
valArray = (char*) calloc(sizeof(char), totalRow * MAX_COLUMN_BOUNDARY);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_FLOAT:
|
||||||
|
valArray = (float*) calloc(sizeof(float), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_DOUBLE:
|
||||||
|
valArray = (double*) calloc(sizeof(double), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_BYTE:
|
||||||
|
valArray = (char*) calloc(sizeof(char), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_UBYTE:
|
||||||
|
valArray = (uint8_t*) calloc(sizeof(uint8_t), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_SHORT:
|
||||||
|
valArray = (short*) calloc(sizeof(short), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_USHORT:
|
||||||
|
valArray = (uint16_t*) calloc(sizeof(uint16_t), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_LONGLONG:
|
||||||
|
valArray = (long long*) calloc(sizeof(long long), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_ULONGLONG:
|
||||||
|
valArray = (uint64_t*) calloc(sizeof(uint64_t), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_TOKEN:
|
||||||
|
valArray = (Token*) calloc(sizeof(Token), totalRow);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WriteEngine::WR_BINARY:
|
||||||
|
valArray = calloc(totalRow, colWidth);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int WriteEngineWrapper::deleteBadRows(const TxnID& txnid, ColStructList& colStructs,
|
int WriteEngineWrapper::deleteBadRows(const TxnID& txnid, ColStructList& colStructs,
|
||||||
RIDList& ridList, DctnryStructList& dctnryStructList)
|
RIDList& ridList, DctnryStructList& dctnryStructList)
|
||||||
{
|
{
|
||||||
@ -889,69 +958,7 @@ int WriteEngineWrapper::deleteBadRows(const TxnID& txnid, ColStructList& colStru
|
|||||||
throw std::runtime_error(oss.str());
|
throw std::runtime_error(oss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (colStructs[i].colType)
|
allocateValArray(valArray, 1, colStructs[i].colType, colStructs[i].colWidth);
|
||||||
{
|
|
||||||
case WriteEngine::WR_INT:
|
|
||||||
case WriteEngine::WR_MEDINT:
|
|
||||||
valArray = (int*) calloc(sizeof(int), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UINT:
|
|
||||||
case WriteEngine::WR_UMEDINT:
|
|
||||||
valArray = (uint32_t*) calloc(sizeof(uint32_t), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_VARBINARY : // treat same as char for now
|
|
||||||
case WriteEngine::WR_CHAR:
|
|
||||||
case WriteEngine::WR_BLOB:
|
|
||||||
case WriteEngine::WR_TEXT:
|
|
||||||
valArray = (char*) calloc(sizeof(char), 1 * MAX_COLUMN_BOUNDARY);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_FLOAT:
|
|
||||||
valArray = (float*) calloc(sizeof(float), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_DOUBLE:
|
|
||||||
valArray = (double*) calloc(sizeof(double), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_BYTE:
|
|
||||||
valArray = (char*) calloc(sizeof(char), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UBYTE:
|
|
||||||
valArray = (uint8_t*) calloc(sizeof(uint8_t), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_SHORT:
|
|
||||||
valArray = (short*) calloc(sizeof(short), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_USHORT:
|
|
||||||
valArray = (uint16_t*) calloc(sizeof(uint16_t), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_LONGLONG:
|
|
||||||
valArray = (long long*) calloc(sizeof(long long), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_ULONGLONG:
|
|
||||||
valArray = (uint64_t*) calloc(sizeof(uint64_t), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_TOKEN:
|
|
||||||
valArray = (Token*) calloc(sizeof(Token), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_BINARY:
|
|
||||||
//case WriteEngine::WR_INT128:
|
|
||||||
// WIP use column width here
|
|
||||||
// remove all C-casts from above
|
|
||||||
valArray = calloc(1, 16);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = colOp->writeRows(curCol, ridList.size(), ridList, valArray, 0, true);
|
rc = colOp->writeRows(curCol, ridList.size(), ridList, valArray, 0, true);
|
||||||
|
|
||||||
@ -3270,8 +3277,6 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid,
|
|||||||
printInputValue(colStructList, colValueList, ridList);
|
printInputValue(colStructList, colValueList, ridList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// end
|
|
||||||
|
|
||||||
//Convert data type and column width to write engine specific
|
//Convert data type and column width to write engine specific
|
||||||
for (i = 0; i < colStructList.size(); i++)
|
for (i = 0; i < colStructList.size(); i++)
|
||||||
Convertor::convertColType(&colStructList[i]);
|
Convertor::convertColType(&colStructList[i]);
|
||||||
@ -3299,7 +3304,7 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid,
|
|||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// allocate row id(s)
|
// allocate row id(s)
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
curColStruct = colStructList[colId];
|
curColStruct = colStructList[colId];
|
||||||
colOp = m_colOp[op(curColStruct.fCompressionType)];
|
colOp = m_colOp[op(curColStruct.fCompressionType)];
|
||||||
|
|
||||||
colOp->initColumn(curCol);
|
colOp->initColumn(curCol);
|
||||||
@ -3336,7 +3341,7 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid,
|
|||||||
|
|
||||||
oldHwm = hwm; //Save this info for rollback
|
oldHwm = hwm; //Save this info for rollback
|
||||||
//need to pass real dbRoot, partition, and segment to setColParam
|
//need to pass real dbRoot, partition, and segment to setColParam
|
||||||
colOp->setColParam(curCol, colId, curColStruct.colWidth, curColStruct.colDataType,
|
colOp->setColParam(curCol, colId, curColStruct.colWidth, curColStruct.colDataType,
|
||||||
curColStruct.colType, curColStruct.dataOid, curColStruct.fCompressionType,
|
curColStruct.colType, curColStruct.dataOid, curColStruct.fCompressionType,
|
||||||
dbRoot, partitionNum, segmentNum);
|
dbRoot, partitionNum, segmentNum);
|
||||||
|
|
||||||
@ -3455,12 +3460,12 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid,
|
|||||||
// if totalRow == rowsLeft, then not adding rows to 1st extent, so skip it.
|
// if totalRow == rowsLeft, then not adding rows to 1st extent, so skip it.
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// DMC-SHARED_NOTHING_NOTE: Is it safe to assume only part0 seg0 is abbreviated?
|
// DMC-SHARED_NOTHING_NOTE: Is it safe to assume only part0 seg0 is abbreviated?
|
||||||
if ((colStructList[colId].fColPartition == 0) &&
|
if ((colStructList[colId].fColPartition == 0) &&
|
||||||
(colStructList[colId].fColSegment == 0) &&
|
(colStructList[colId].fColSegment == 0) &&
|
||||||
((totalRow - rowsLeft) > 0) &&
|
((totalRow - rowsLeft) > 0) &&
|
||||||
(rowIdArray[totalRow - rowsLeft - 1] >= (RID)INITIAL_EXTENT_ROWS_TO_DISK))
|
(rowIdArray[totalRow - rowsLeft - 1] >= (RID)INITIAL_EXTENT_ROWS_TO_DISK))
|
||||||
{
|
{
|
||||||
for (unsigned k=0; k<colStructList.size(); k++)
|
for (unsigned k=0; k<colStructList.size(); k++)
|
||||||
{
|
{
|
||||||
if (k == colId)
|
if (k == colId)
|
||||||
continue;
|
continue;
|
||||||
@ -3685,7 +3690,6 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid,
|
|||||||
lastRidNew = rowIdArray[totalRow - 1];
|
lastRidNew = rowIdArray[totalRow - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
//cout << "rowid allocated is " << lastRid << endl;
|
|
||||||
//if a new extent is created, all the columns in this table should
|
//if a new extent is created, all the columns in this table should
|
||||||
//have their own new extent
|
//have their own new extent
|
||||||
|
|
||||||
@ -3716,9 +3720,6 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid,
|
|||||||
succFlag = colOp->calculateRowId(lastRid,
|
succFlag = colOp->calculateRowId(lastRid,
|
||||||
BYTE_PER_BLOCK / colWidth, colWidth, curFbo, curBio);
|
BYTE_PER_BLOCK / colWidth, colWidth, curFbo, curBio);
|
||||||
|
|
||||||
//cout << "insertcolumnrec oid:rid:fbo:hwm = " <<
|
|
||||||
//colStructList[i].dataOid << ":" << lastRid << ":" <<
|
|
||||||
//curFbo << ":" << hwm << endl;
|
|
||||||
if (succFlag)
|
if (succFlag)
|
||||||
{
|
{
|
||||||
if ((HWM)curFbo > oldHwm)
|
if ((HWM)curFbo > oldHwm)
|
||||||
@ -3811,7 +3812,6 @@ int WriteEngineWrapper::insertColumnRec_Single(const TxnID& txnid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//cout << "lbids size = " << lbids.size()<< endl;
|
|
||||||
if (lbids.size() > 0)
|
if (lbids.size() > 0)
|
||||||
rc = BRMWrapper::getInstance()->markExtentsInvalid(lbids, colDataTypes);
|
rc = BRMWrapper::getInstance()->markExtentsInvalid(lbids, colDataTypes);
|
||||||
|
|
||||||
@ -4516,68 +4516,7 @@ int WriteEngineWrapper::writeColumnRecords(const TxnID& txnid,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (curColStruct.colType)
|
allocateValArray(valArray, totalRow, curColStruct.colType, curColStruct.colWidth);
|
||||||
{
|
|
||||||
case WriteEngine::WR_INT:
|
|
||||||
case WriteEngine::WR_MEDINT:
|
|
||||||
valArray = (int*) calloc(sizeof(int), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UINT:
|
|
||||||
case WriteEngine::WR_UMEDINT:
|
|
||||||
valArray = (uint32_t*) calloc(sizeof(uint32_t), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_VARBINARY : // treat same as char for now
|
|
||||||
case WriteEngine::WR_CHAR:
|
|
||||||
case WriteEngine::WR_BLOB:
|
|
||||||
case WriteEngine::WR_TEXT:
|
|
||||||
valArray = (char*) calloc(sizeof(char), totalRow * MAX_COLUMN_BOUNDARY);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_FLOAT:
|
|
||||||
valArray = (float*) calloc(sizeof(float), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_DOUBLE:
|
|
||||||
valArray = (double*) calloc(sizeof(double), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_BYTE:
|
|
||||||
valArray = (char*) calloc(sizeof(char), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UBYTE:
|
|
||||||
valArray = (uint8_t*) calloc(sizeof(uint8_t), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_SHORT:
|
|
||||||
valArray = (short*) calloc(sizeof(short), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_USHORT:
|
|
||||||
valArray = (uint16_t*) calloc(sizeof(uint16_t), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_LONGLONG:
|
|
||||||
valArray = (long long*) calloc(sizeof(long long), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_ULONGLONG:
|
|
||||||
valArray = (uint64_t*) calloc(sizeof(uint64_t), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_TOKEN:
|
|
||||||
valArray = (Token*) calloc(sizeof(Token), totalRow);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// WIP MCOL-641
|
|
||||||
case WriteEngine::WR_BINARY:
|
|
||||||
// Use column width and remove all C-casts from above
|
|
||||||
valArray = calloc(totalRow, curColType.colWidth);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert values to valArray
|
// convert values to valArray
|
||||||
bExcp = false;
|
bExcp = false;
|
||||||
@ -4679,16 +4618,11 @@ int WriteEngineWrapper::writeColumnRec(const TxnID& txnid,
|
|||||||
StopWatch timer;
|
StopWatch timer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
totalRow1 = colValueList[0].size();
|
||||||
|
totalRow2 = 0;
|
||||||
|
|
||||||
if (newColValueList.size() > 0)
|
if (newColValueList.size() > 0)
|
||||||
{
|
|
||||||
totalRow1 = colValueList[0].size();
|
|
||||||
totalRow2 = newColValueList[0].size();
|
totalRow2 = newColValueList[0].size();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
totalRow1 = colValueList[0].size();
|
|
||||||
totalRow2 = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
TableMetaData* aTbaleMetaData = TableMetaData::makeTableMetaData(tableOid);
|
TableMetaData* aTbaleMetaData = TableMetaData::makeTableMetaData(tableOid);
|
||||||
|
|
||||||
@ -4763,74 +4697,10 @@ int WriteEngineWrapper::writeColumnRec(const TxnID& txnid,
|
|||||||
|
|
||||||
// WIP We can allocate based on column size and not colType
|
// WIP We can allocate based on column size and not colType
|
||||||
// have to init the size here
|
// have to init the size here
|
||||||
valArray = calloc(totalRow1, colStructList[i].colWidth);
|
allocateValArray(valArray, totalRow1, colStructList[i].colType, colStructList[i].colWidth);
|
||||||
#if 0
|
|
||||||
switch (colStructList[i].colType)
|
|
||||||
{
|
|
||||||
// WIP we don't need type cast here only size
|
|
||||||
case WriteEngine::WR_INT:
|
|
||||||
case WriteEngine::WR_MEDINT:
|
|
||||||
valArray = (int*) calloc(sizeof(int), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UINT:
|
|
||||||
case WriteEngine::WR_UMEDINT:
|
|
||||||
valArray = (uint32_t*) calloc(sizeof(uint32_t), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_VARBINARY : // treat same as char for now
|
|
||||||
case WriteEngine::WR_CHAR:
|
|
||||||
case WriteEngine::WR_BLOB:
|
|
||||||
case WriteEngine::WR_TEXT:
|
|
||||||
valArray = (char*) calloc(sizeof(char), totalRow1 * MAX_COLUMN_BOUNDARY);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_FLOAT:
|
|
||||||
valArray = (float*) calloc(sizeof(float), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_DOUBLE:
|
|
||||||
valArray = (double*) calloc(sizeof(double), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_BYTE:
|
|
||||||
valArray = (char*) calloc(sizeof(char), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UBYTE:
|
|
||||||
valArray = (uint8_t*) calloc(sizeof(uint8_t), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_SHORT:
|
|
||||||
valArray = (short*) calloc(sizeof(short), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_USHORT:
|
|
||||||
valArray = (uint16_t*) calloc(sizeof(uint16_t), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_LONGLONG:
|
|
||||||
valArray = (long long*) calloc(sizeof(long long), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_ULONGLONG:
|
|
||||||
valArray = (uint64_t*) calloc(sizeof(uint64_t), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_TOKEN:
|
|
||||||
valArray = (Token*) calloc(sizeof(Token), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// WIP
|
|
||||||
case WriteEngine::WR_BINARY:
|
|
||||||
valArray = calloc(totalRow1, colStructList[i].colWidth);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// convert values to valArray
|
// convert values to valArray
|
||||||
// WIP
|
// WIP Is m_opType ever set to DELETE?
|
||||||
// Is this m_opType ever set to DELETE?
|
|
||||||
if (m_opType != DELETE)
|
if (m_opType != DELETE)
|
||||||
{
|
{
|
||||||
bExcp = false;
|
bExcp = false;
|
||||||
@ -4857,7 +4727,7 @@ int WriteEngineWrapper::writeColumnRec(const TxnID& txnid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
iimer.start("writeRow ");
|
timer.start("writeRow ");
|
||||||
#endif
|
#endif
|
||||||
rc = colOp->writeRow(curCol, totalRow1, firstPart, valArray);
|
rc = colOp->writeRow(curCol, totalRow1, firstPart, valArray);
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
@ -4950,71 +4820,7 @@ int WriteEngineWrapper::writeColumnRec(const TxnID& txnid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// have to init the size here
|
allocateValArray(valArray, totalRow2, newColStructList[i].colType, newColStructList[i].colWidth);
|
||||||
// TODO MCOL-641 is commenting out the switch statement below correct?
|
|
||||||
valArray = calloc(totalRow2, newColStructList[i].colWidth);
|
|
||||||
/*switch (newColStructList[i].colType)
|
|
||||||
{
|
|
||||||
case WriteEngine::WR_INT:
|
|
||||||
case WriteEngine::WR_MEDINT:
|
|
||||||
valArray = (int*) calloc(sizeof(int), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UINT:
|
|
||||||
case WriteEngine::WR_UMEDINT:
|
|
||||||
valArray = (uint32_t*) calloc(sizeof(uint32_t), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_VARBINARY : // treat same as char for now
|
|
||||||
case WriteEngine::WR_CHAR:
|
|
||||||
case WriteEngine::WR_BLOB:
|
|
||||||
case WriteEngine::WR_TEXT:
|
|
||||||
valArray = (char*) calloc(sizeof(char), totalRow2 * MAX_COLUMN_BOUNDARY);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_FLOAT:
|
|
||||||
valArray = (float*) calloc(sizeof(float), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_DOUBLE:
|
|
||||||
valArray = (double*) calloc(sizeof(double), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_BYTE:
|
|
||||||
valArray = (char*) calloc(sizeof(char), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UBYTE:
|
|
||||||
valArray = (uint8_t*) calloc(sizeof(uint8_t), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_SHORT:
|
|
||||||
valArray = (short*) calloc(sizeof(short), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_USHORT:
|
|
||||||
valArray = (uint16_t*) calloc(sizeof(uint16_t), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_LONGLONG:
|
|
||||||
valArray = (long long*) calloc(sizeof(long long), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_ULONGLONG:
|
|
||||||
valArray = (uint64_t*) calloc(sizeof(uint64_t), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_TOKEN:
|
|
||||||
valArray = (Token*) calloc(sizeof(Token), totalRow2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_BINARY:
|
|
||||||
//case WriteEngine::WR_INT128:
|
|
||||||
// WIP
|
|
||||||
valArray = calloc(totalRow2, 16);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// convert values to valArray
|
// convert values to valArray
|
||||||
if (m_opType != DELETE)
|
if (m_opType != DELETE)
|
||||||
@ -5131,71 +4937,7 @@ int WriteEngineWrapper::writeColumnRec(const TxnID& txnid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// have to init the size here
|
allocateValArray(valArray, totalRow1, colStructList[i].colType, colStructList[i].colWidth);
|
||||||
// shared pointers or memory in a stack
|
|
||||||
// TODO MCOL-641 is commenting out the switch statement below correct?
|
|
||||||
valArray = calloc(totalRow1, colStructList[i].colWidth);
|
|
||||||
// WIP
|
|
||||||
/*switch (colStructList[i].colType)
|
|
||||||
{
|
|
||||||
case WriteEngine::WR_INT:
|
|
||||||
case WriteEngine::WR_MEDINT:
|
|
||||||
valArray = (int*) calloc(sizeof(int), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UINT:
|
|
||||||
case WriteEngine::WR_UMEDINT:
|
|
||||||
valArray = (uint32_t*) calloc(sizeof(uint32_t), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_VARBINARY : // treat same as char for now
|
|
||||||
case WriteEngine::WR_CHAR:
|
|
||||||
case WriteEngine::WR_BLOB:
|
|
||||||
case WriteEngine::WR_TEXT:
|
|
||||||
valArray = (char*) calloc(sizeof(char), totalRow1 * MAX_COLUMN_BOUNDARY);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_FLOAT:
|
|
||||||
valArray = (float*) calloc(sizeof(float), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_DOUBLE:
|
|
||||||
valArray = (double*) calloc(sizeof(double), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_BYTE:
|
|
||||||
valArray = (char*) calloc(sizeof(char), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UBYTE:
|
|
||||||
valArray = (uint8_t*) calloc(sizeof(uint8_t), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_SHORT:
|
|
||||||
valArray = (short*) calloc(sizeof(short), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_USHORT:
|
|
||||||
valArray = (uint16_t*) calloc(sizeof(uint16_t), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_LONGLONG:
|
|
||||||
valArray = (long long*) calloc(sizeof(long long), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_ULONGLONG:
|
|
||||||
valArray = (uint64_t*) calloc(sizeof(uint64_t), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_TOKEN:
|
|
||||||
valArray = (Token*) calloc(sizeof(Token), totalRow1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_BINARY:
|
|
||||||
//case WriteEngine::WR_INT128:
|
|
||||||
valArray = calloc(colStructList[i].colWidth, totalRow1);
|
|
||||||
break;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// convert values to valArray
|
// convert values to valArray
|
||||||
if (m_opType != DELETE)
|
if (m_opType != DELETE)
|
||||||
@ -5415,9 +5157,8 @@ int WriteEngineWrapper::writeColumnRecBinary(const TxnID& txnid,
|
|||||||
((uint16_t*)valArray)[j] = tmp16;
|
((uint16_t*)valArray)[j] = tmp16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WriteEngine::WR_BINARY:
|
|
||||||
// WIP
|
// WIP
|
||||||
//case WriteEngine::WR_INT128:
|
case WriteEngine::WR_BINARY:
|
||||||
((uint64_t*)valArray)[j] = curValue; //FIXME maybe
|
((uint64_t*)valArray)[j] = curValue; //FIXME maybe
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5565,9 +5306,8 @@ int WriteEngineWrapper::writeColumnRecBinary(const TxnID& txnid,
|
|||||||
((uint16_t*)valArray)[j] = tmp16;
|
((uint16_t*)valArray)[j] = tmp16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WriteEngine::WR_BINARY:
|
|
||||||
// WIP
|
// WIP
|
||||||
//case WriteEngine::WR_INT128:
|
case WriteEngine::WR_BINARY:
|
||||||
((uint64_t*)valArray)[j] = curValue; // FIXME maybe
|
((uint64_t*)valArray)[j] = curValue; // FIXME maybe
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5786,64 +5526,7 @@ int WriteEngineWrapper::writeColumnRec(const TxnID& txnid,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (curColStruct.colType)
|
allocateValArray(valArray, 1, curColStruct.colType, curColStruct.colWidth);
|
||||||
{
|
|
||||||
case WriteEngine::WR_INT:
|
|
||||||
case WriteEngine::WR_MEDINT:
|
|
||||||
valArray = (int*) calloc(sizeof(int), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UINT:
|
|
||||||
case WriteEngine::WR_UMEDINT:
|
|
||||||
valArray = (uint32_t*) calloc(sizeof(uint32_t), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_VARBINARY : // treat same as char for now
|
|
||||||
case WriteEngine::WR_CHAR:
|
|
||||||
case WriteEngine::WR_BLOB:
|
|
||||||
case WriteEngine::WR_TEXT:
|
|
||||||
valArray = (char*) calloc(sizeof(char), 1 * MAX_COLUMN_BOUNDARY);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_FLOAT:
|
|
||||||
valArray = (float*) calloc(sizeof(float), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_DOUBLE:
|
|
||||||
valArray = (double*) calloc(sizeof(double), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_BYTE:
|
|
||||||
valArray = (char*) calloc(sizeof(char), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_UBYTE:
|
|
||||||
valArray = (uint8_t*) calloc(sizeof(uint8_t), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_SHORT:
|
|
||||||
valArray = (short*) calloc(sizeof(short), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_USHORT:
|
|
||||||
valArray = (uint16_t*) calloc(sizeof(uint16_t), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_LONGLONG:
|
|
||||||
valArray = (long long*) calloc(sizeof(long long), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_ULONGLONG:
|
|
||||||
valArray = (uint64_t*) calloc(sizeof(uint64_t), 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WriteEngine::WR_TOKEN:
|
|
||||||
valArray = (Token*) calloc(sizeof(Token), 1);
|
|
||||||
break;
|
|
||||||
case WriteEngine::WR_BINARY:
|
|
||||||
valArray = calloc(1, curColStruct.colWidth);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert values to valArray
|
// convert values to valArray
|
||||||
if (m_opType != DELETE)
|
if (m_opType != DELETE)
|
||||||
|
Reference in New Issue
Block a user