diff --git a/mysql-test/columnstore/bugfixes/mcol-4741-strings-ranges-are-unsigned.result b/mysql-test/columnstore/bugfixes/mcol-4741-strings-ranges-are-unsigned.result new file mode 100644 index 000000000..c9e2db639 --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol-4741-strings-ranges-are-unsigned.result @@ -0,0 +1,12 @@ +DROP DATABASE IF EXISTS db4741; +CREATE DATABASE db4741; +USE db4741; +CREATE TABLE t (x VARCHAR(5) DEFAULT '') engine = columnstore; +LOAD DATA LOCAL infile 'MTR_SUITE_DIR/../std_data/mcol-4741-part-1-strings-and-nulls.txt' INTO TABLE t; +SELECT COUNT(*) FROM t WHERE x='val'; +COUNT(*) +2 +LOAD DATA LOCAL infile 'MTR_SUITE_DIR/../std_data/mcol-4741-part-2-empty-strings.txt' INTO TABLE t; +SELECT COUNT(*) FROM t WHERE x='val'; +COUNT(*) +2 diff --git a/mysql-test/columnstore/bugfixes/mcol-4741-strings-ranges-are-unsigned.test b/mysql-test/columnstore/bugfixes/mcol-4741-strings-ranges-are-unsigned.test new file mode 100644 index 000000000..06cc2abdd --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol-4741-strings-ranges-are-unsigned.test @@ -0,0 +1,17 @@ +--disable_warnings +DROP DATABASE IF EXISTS db4741; +--enable_warnings +CREATE DATABASE db4741; +USE db4741; +CREATE TABLE t (x VARCHAR(5) DEFAULT '') engine = columnstore; + +--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR +--eval LOAD DATA LOCAL infile '$MTR_SUITE_DIR/../std_data/mcol-4741-part-1-strings-and-nulls.txt' INTO TABLE t + +SELECT COUNT(*) FROM t WHERE x='val'; + +--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR +--eval LOAD DATA LOCAL infile '$MTR_SUITE_DIR/../std_data/mcol-4741-part-2-empty-strings.txt' INTO TABLE t + +SELECT COUNT(*) FROM t WHERE x='val'; + diff --git a/mysql-test/columnstore/std_data/mcol-4741-part-1-strings-and-nulls.txt b/mysql-test/columnstore/std_data/mcol-4741-part-1-strings-and-nulls.txt new file mode 100644 index 000000000..00f06a1c4 --- /dev/null +++ b/mysql-test/columnstore/std_data/mcol-4741-part-1-strings-and-nulls.txt @@ -0,0 +1,6 @@ +val +val +aal +xal +\N +\N diff --git a/mysql-test/columnstore/std_data/mcol-4741-part-2-empty-strings.txt b/mysql-test/columnstore/std_data/mcol-4741-part-2-empty-strings.txt new file mode 100644 index 000000000..3f2ff2d6c --- /dev/null +++ b/mysql-test/columnstore/std_data/mcol-4741-part-2-empty-strings.txt @@ -0,0 +1,5 @@ + + + + + diff --git a/versioning/BRM/extentmap.cpp b/versioning/BRM/extentmap.cpp index aba3e3211..136373bbc 100644 --- a/versioning/BRM/extentmap.cpp +++ b/versioning/BRM/extentmap.cpp @@ -893,18 +893,18 @@ void ExtentMap::mergeExtentsMaxMin(CPMaxMinMergeMap_t& cpMap, bool useLock) // Swap byte order to do binary string comparison if (isCharType(it->second.type)) { - int64_t newMinVal = - static_cast( uint64ToStr( + uint64_t newMinVal = + static_cast( uint64ToStr( static_cast(it->second.min))); - int64_t newMaxVal = - static_cast( uint64ToStr( + uint64_t newMaxVal = + static_cast( uint64ToStr( static_cast(it->second.max))); - int64_t oldMinVal = - static_cast( uint64ToStr( + uint64_t oldMinVal = + static_cast( uint64ToStr( static_cast( fExtentMap[i].partition.cprange.loVal)) ); - int64_t oldMaxVal = - static_cast( uint64ToStr( + uint64_t oldMaxVal = + static_cast( uint64ToStr( static_cast( fExtentMap[i].partition.cprange.hiVal)) );