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

MCOL-641 Fix alter table add wide decimal column.

This patch also removes CalpontSystemCatalog::BINARY and
ddlpackage::DDL_BINARY that were added during the initial
stages of the work on MCOL-641.
This commit is contained in:
Gagan Goel
2020-11-20 18:23:54 -05:00
parent ba4156fe13
commit 995cadef2d
32 changed files with 62 additions and 255 deletions

View File

@ -91,7 +91,7 @@ CPPUNIT_TEST(setUp);
// Extent & dict related testing
CPPUNIT_TEST( testExtensionWOPrealloc );
CPPUNIT_TEST( testDictExtensionWOPrealloc );
CPPUNIT_TEST( testExtentCrWOPreallocBin );
// CPPUNIT_TEST( testExtentCrWOPreallocBin );
// Semaphore related testing
// CPPUNIT_TEST( testSem );
@ -1571,7 +1571,6 @@ public:
fileOp.deleteFile(fileName);
CPPUNIT_ASSERT(fileOp.exists(fileName) == false);
//binary16 emptyVal = blockOp.getEmptyBinRowValue( execplan::CalpontSystemCatalog::BINARY, 16 );
uint64_t emptyVal = blockOp.getEmptyRowValue(execplan::CalpontSystemCatalog::BIGINT, 8);
int width = blockOp.getCorrectRowWidth(execplan::CalpontSystemCatalog::BINARY, sizeof (binary16));
int nBlocks = INITIAL_EXTENT_ROWS_TO_DISK / BYTE_PER_BLOCK * width;

View File

@ -953,7 +953,7 @@ int BRMWrapper::rollBack(const VER_t transID, int sessionId)
CalpontSystemCatalog::ColDataType colDataType = colType.colDataType;
ColType weColType;
Convertor::convertColType(colDataType, weColType);
Convertor::convertColType(colDataType, colType.colWidth, weColType);
column.colWidth = Convertor::getCorrectRowWidth(colDataType, colType.colWidth);
column.colType = weColType;
column.colDataType = colDataType;
@ -1240,7 +1240,7 @@ int BRMWrapper::rollBackBlocks(const VER_t transID, int sessionId)
CalpontSystemCatalog::ColDataType colDataType = colType.colDataType;
ColType weColType;
Convertor::convertColType(colDataType, weColType);
Convertor::convertColType(colDataType, colType.colWidth, weColType);
column.colWidth = Convertor::getCorrectRowWidth(colDataType, colType.colWidth);
column.colType = weColType;
column.colDataType = colDataType;

View File

@ -328,9 +328,8 @@ void Convertor::mapErrnoToString(int errNum, std::string& errString)
* none
******************************************************************************/
/* static */
// TODO MCOL-641
void Convertor::convertColType(CalpontSystemCatalog::ColDataType dataType,
ColType& internalType, bool isToken)
int colWidth, ColType& internalType, bool isToken)
{
if (isToken)
{
@ -382,6 +381,36 @@ void Convertor::convertColType(CalpontSystemCatalog::ColDataType dataType,
internalType = WriteEngine::WR_DOUBLE;
break;
// Map DECIMAL to applicable integer type
case CalpontSystemCatalog::DECIMAL :
case CalpontSystemCatalog::UDECIMAL :
{
switch (colWidth)
{
case 1 :
internalType = WriteEngine::WR_BYTE;
break;
case 2 :
internalType = WriteEngine::WR_SHORT;
break;
case 4 :
internalType = WriteEngine::WR_INT;
break;
case 8:
internalType = WriteEngine::WR_LONGLONG;
break;
default:
internalType = WriteEngine::WR_BINARY;
break;
}
break;
}
// Map BLOB to WR_BLOB
case CalpontSystemCatalog::BLOB :
internalType = WriteEngine::WR_BLOB;
@ -397,13 +426,6 @@ void Convertor::convertColType(CalpontSystemCatalog::ColDataType dataType,
internalType = WriteEngine::WR_VARBINARY;
break;
// Map DECIMAL to applicable WR_CHAR
// We can't map them to their proper int size, since in this version
// of convertColType(), we don't know what that is. Hopefully
// this is never used for DECIMAL.
case CalpontSystemCatalog::DECIMAL :
case CalpontSystemCatalog::UDECIMAL:
// Map CHAR, VARCHAR, and CLOB to WR_CHAR
case CalpontSystemCatalog::CHAR :
case CalpontSystemCatalog::VARCHAR :
@ -436,11 +458,6 @@ void Convertor::convertColType(CalpontSystemCatalog::ColDataType dataType,
internalType = WriteEngine::WR_ULONGLONG;
break;
// Map BINARY to WR_BINARY
case CalpontSystemCatalog::BINARY:
internalType = WriteEngine::WR_BINARY;
break;
default:
internalType = WriteEngine::WR_CHAR;
break;
@ -693,11 +710,6 @@ void Convertor::convertColType(ColStruct* curStruct)
*internalType = WriteEngine::WR_ULONGLONG;
break;
// Map BINARY to WR_BINARY
case CalpontSystemCatalog::BINARY:
*internalType = WriteEngine::WR_BINARY;
break;
default:
*internalType = WriteEngine::WR_CHAR;
break;
@ -783,10 +795,6 @@ int Convertor::getCorrectRowWidth(CalpontSystemCatalog::ColDataType dataType, in
newWidth = 8;
break;
case CalpontSystemCatalog::BINARY:
newWidth = width;
break;
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::VARBINARY: // treat same as varchar for now

View File

@ -98,7 +98,8 @@ public:
*/
//BUG931
EXPORT static void convertColType(execplan::CalpontSystemCatalog::ColDataType dataType,
ColType& internalType, bool isToken = false);
int colWidth, ColType& internalType,
bool isToken = false);
/**
* @brief Convert specified internal storage type (ColType) to
* ColDataType