1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +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;
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
{
break;