You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
Merge pull request #141 from mariadb-corporation/MCOL-267
MCOL-267 Add BLOB/TEXT support
This commit is contained in:
@@ -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;
|
||||
|
@@ -2233,10 +2233,10 @@ CalpontSystemCatalog::ColType colType_MysqlToIDB (const Item* item)
|
||||
ct.colDataType = CalpontSystemCatalog::DATETIME;
|
||||
ct.colWidth = 8;
|
||||
}
|
||||
if (item->field_type() == MYSQL_TYPE_BLOB)
|
||||
{
|
||||
throw runtime_error ("BLOB/TEXT data types are not supported by ColumnStore.");
|
||||
}
|
||||
if (item->field_type() == MYSQL_TYPE_BLOB)
|
||||
{
|
||||
ct.colDataType = CalpontSystemCatalog::BLOB;
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* FIXME:
|
||||
|
@@ -467,6 +467,7 @@ int fetchNextRow(uchar *buf, cal_table_info& ti, cal_connection_info* ci)
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
{
|
||||
// TODO: use getStringPointer instead of getStringField to stop the string copies
|
||||
Field_varstring* f2 = (Field_varstring*)*f;
|
||||
switch (colType.colWidth)
|
||||
{
|
||||
@@ -622,6 +623,14 @@ int fetchNextRow(uchar *buf, cal_table_info& ti, cal_connection_info* ci)
|
||||
storeNumericField(f, intColVal, colType);
|
||||
break;
|
||||
}
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
{
|
||||
Field_blob *f2 = (Field_blob*)*f;
|
||||
f2->set_ptr(row.getVarBinaryLength(s), (unsigned char*)row.getVarBinaryField(s));
|
||||
if ((*f)->null_ptr)
|
||||
*(*f)->null_ptr &= ~(*f)->null_bit;
|
||||
break;
|
||||
}
|
||||
default: // treat as int64
|
||||
{
|
||||
intColVal = row.getUintField<8>(s);
|
||||
|
Reference in New Issue
Block a user