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

MCOL-1347 ALTER TABLE ADD COLUMN now creates a column with correct width for a varchar columns.

This commit is contained in:
Roman Nozdrin
2018-12-05 13:47:49 -08:00
parent 3fc1893ce9
commit d807aaee0a

View File

@ -562,6 +562,7 @@ int WriteEngineWrapper::fillColumn(const TxnID& txnid, const OID& dataOid,
// refColOp.reset(colOpRefCol);
// dctnry.reset(dctOp);
uint16_t dbRoot = 1; //not to be used
int newDataWidth = dataWidth;
//Convert HWM of the reference column for the new column
//Bug 1703,1705
bool isToken = false;
@ -584,10 +585,17 @@ int WriteEngineWrapper::fillColumn(const TxnID& txnid, const OID& dataOid,
isToken = true;
}
newDataWidth = colOpNewCol->getCorrectRowWidth(dataType, dataWidth);
// MCOL-1347 CS doubles the width for ALTER TABLE..ADD COLUMN
if ( dataWidth < 4 && dataType == CalpontSystemCatalog::VARCHAR )
{
newDataWidth >>= 1;
}
Convertor::convertColType(refColDataType, refColType, isToken);
refColOp->setColParam(refCol, 0, refColOp->getCorrectRowWidth(refColDataType, refColWidth),
refColDataType, refColType, (FID)refColOID, refCompressionType, dbRoot);
colOpNewCol->setColParam(newCol, 0, colOpNewCol->getCorrectRowWidth(dataType, dataWidth),
colOpNewCol->setColParam(newCol, 0, newDataWidth,
dataType, newColType, (FID)dataOid, compressionType, dbRoot);
int size = sizeof(Token);