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

MCOL-669 TEXT cpimport fixes

* 64KB TEXT column had off-by-one length pointer counting
* TEXT I_S/LDI was looping where it shouldn't causing pointer issues
* TEXT data type wasn't fully understood by cpimport
This commit is contained in:
Andrew Hutchings
2017-04-19 14:11:21 +01:00
parent dce4b11437
commit f251ebccb2
3 changed files with 19 additions and 18 deletions

View File

@ -153,11 +153,11 @@ public:
UFLOAT, /*!< Unsigned FLOAT type */ UFLOAT, /*!< Unsigned FLOAT type */
UBIGINT, /*!< Unsigned BIGINT type */ UBIGINT, /*!< Unsigned BIGINT type */
UDOUBLE, /*!< Unsigned DOUBLE type */ UDOUBLE, /*!< Unsigned DOUBLE type */
NUM_OF_COL_DATA_TYPE, TEXT, /*!< TEXT type */
NUM_OF_COL_DATA_TYPE, /* NEW TYPES ABOVE HERE */
LONGDOUBLE, /* @bug3241, dev and variance calculation only */ LONGDOUBLE, /* @bug3241, dev and variance calculation only */
STRINT, /* @bug3532, string as int for fast comparison */ STRINT /* @bug3532, string as int for fast comparison */
TEXT /*!< TEXT type */ };
};
/** the set of column constraint types /** the set of column constraint types
* *

View File

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

View File

@ -152,7 +152,8 @@ namespace WriteEngine
"unsigned-int", "unsigned-int",
"unsigned-float", "unsigned-float",
"unsigned-bigint", "unsigned-bigint",
"unsigned-double" "unsigned-double",
"text"
}; };
enum FuncType { FUNC_WRITE_ENGINE, FUNC_INDEX, FUNC_DICTIONARY }; enum FuncType { FUNC_WRITE_ENGINE, FUNC_INDEX, FUNC_DICTIONARY };