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

MCOL-267 Add blob support for INSERT_SELECT

* Note there is a 1MB buffer limit, rows longer than 512KB will fail (2x
due to hex of blob data)
* cpimport needs to use hex of blob data
This commit is contained in:
Andrew Hutchings
2017-03-23 14:04:14 +00:00
parent b1d04c04fb
commit b7a01ce02e
2 changed files with 44 additions and 1 deletions

View File

@ -1585,6 +1585,49 @@ int ha_calpont_impl_write_batch_row_(uchar *buf, TABLE* table, cal_impl_if::cal_
buf += ci.columnTypes[colpos].colWidth; buf += ci.columnTypes[colpos].colWidth;
break; break;
} }
case CalpontSystemCatalog::BLOB:
{
int dataLength = 0;
uintptr_t *dataptr;
uchar *ucharptr;
if (ci.columnTypes[colpos].colWidth < 256)
{
dataLength = *(int8_t*) buf;
buf++;
}
else if (ci.columnTypes[colpos].colWidth < 65535)
{
dataLength = *(int16_t*) buf;
buf = buf + 2 ;
}
else if (ci.columnTypes[colpos].colWidth < 16777216)
{
dataLength = *(int32_t*) buf;
buf = buf + 3 ;
}
else
{
dataLength = *(int32_t*) buf;
buf = buf + 4 ;
}
// buf contains pointer to blob, for example:
// (gdb) p (char*)*(uintptr_t*)buf
// $43 = 0x7f68500c58f8 "hello world"
dataptr = (uintptr_t*)buf;
ucharptr = (uchar*)*dataptr;
buf+= sizeof(uintptr_t);
for (int32_t i=0; i<dataLength; i++)
{
fprintf(ci.filePtr, "%02x", *(uint8_t*)ucharptr);
ucharptr++;
}
fprintf(ci.filePtr, "%c", ci.delimiter);
break;
}
default: // treat as int64 default: // treat as int64
{ {
break; break;

View File

@ -1792,7 +1792,7 @@ int ColumnInfo::updateDctnryStore(char* buf,
// column. // column.
// This only applies to default text mode. This step is bypassed for // This only applies to default text mode. This step is bypassed for
// binary imports, because in that case, the data is already true binary. // binary imports, because in that case, the data is already true binary.
if ((curCol.colType == WR_VARBINARY) && if (((curCol.colType == WR_VARBINARY) || (curCol.colType == WR_BLOB)) &&
(fpTableInfo->getImportDataMode() == IMPORT_DATA_TEXT)) (fpTableInfo->getImportDataMode() == IMPORT_DATA_TEXT))
{ {
#ifdef PROFILE #ifdef PROFILE