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

MCOL-636 CHAR/VARCHAR return optimisation

Returns pointers to string buffer instead of making a copy first.
This commit is contained in:
Andrew Hutchings
2017-07-18 14:51:40 +01:00
parent d1386928dc
commit 9ad2b0c496

View File

@@ -353,7 +353,6 @@ int fetchNextRow(uchar *buf, cal_table_info& ti, cal_connection_info* ci)
std::vector<CalpontSystemCatalog::ColType> &colTypes = ti.tpl_scan_ctx->ctp; std::vector<CalpontSystemCatalog::ColType> &colTypes = ti.tpl_scan_ctx->ctp;
int64_t intColVal = 0; int64_t intColVal = 0;
uint64_t uintColVal = 0; uint64_t uintColVal = 0;
string stringColVal;
char tmp[256]; char tmp[256];
RowGroup *rowGroup = ti.tpl_scan_ctx->rowGroup; RowGroup *rowGroup = ti.tpl_scan_ctx->rowGroup;
@@ -468,7 +467,6 @@ int fetchNextRow(uchar *buf, cal_table_info& ti, cal_connection_info* ci)
case CalpontSystemCatalog::CHAR: case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::VARCHAR: case CalpontSystemCatalog::VARCHAR:
{ {
// TODO: use getStringPointer instead of getStringField to stop the string copies
Field_varstring* f2 = (Field_varstring*)*f; Field_varstring* f2 = (Field_varstring*)*f;
switch (colType.colWidth) switch (colType.colWidth)
{ {
@@ -492,8 +490,7 @@ int fetchNextRow(uchar *buf, cal_table_info& ti, cal_connection_info* ci)
f2->store(tmp, strlen(tmp), f2->charset()); f2->store(tmp, strlen(tmp), f2->charset());
break; break;
default: default:
stringColVal = row.getStringField(s); f2->store((const char*)row.getStringPointer(s), row.getStringLength(s), f2->charset());
f2->store(stringColVal.c_str(), strlen(stringColVal.c_str()), f2->charset());
} }
if ((*f)->null_ptr) if ((*f)->null_ptr)
*(*f)->null_ptr &= ~(*f)->null_bit; *(*f)->null_ptr &= ~(*f)->null_bit;