diff --git a/dbcon/ddlpackage/ddl.y b/dbcon/ddlpackage/ddl.y index 98894873b..b340fbeaa 100644 --- a/dbcon/ddlpackage/ddl.y +++ b/dbcon/ddlpackage/ddl.y @@ -87,11 +87,8 @@ void fix_column_length(SchemaObject* elem, const CHARSET_INFO* def_cs) { column->fType->fLength = 255; else if (column->fType->fLength <= 65535) column->fType->fLength = 65535; - else if (column->fType->fLength <= 16777215) + else column->fType->fLength = 16777215; - else if (column->fType->fLength <= 2100000000) - column->fType->fLength = 2100000000; - // otherwise leave the decision to a caller code } } @@ -1000,7 +997,7 @@ blob_type: | LONGBLOB { $$ = new ColumnType(DDL_BLOB); - $$->fLength = 2100000000; + $$->fLength = 16777215; } ; @@ -1029,7 +1026,7 @@ text_type: | LONGTEXT { $$ = new ColumnType(DDL_TEXT); - $$->fLength = 2100000000; + $$->fLength = 16777215; } ; diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index 0fb137942..67bb30ce9 100755 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -3157,15 +3157,12 @@ CalpontSystemCatalog::ColType colType_MysqlToIDB (const Item* item) case STRING_RESULT: ct.colDataType = CalpontSystemCatalog::VARCHAR; - // MCOL-697 the longest TEXT we deal with is 2100000000 so - // limit to that. Otherwise for LONGBLOB ct.colWidth ends - // up being -1 and demons eat your data and first born - // (or you just get truncated to 20 bytes with the 'if' - // below) - if (item->max_length < 2100000000) + // MCOL-4758 the longest TEXT we deal with is 16777215 so + // limit to that. + if (item->max_length < 16777215) ct.colWidth = item->max_length; else - ct.colWidth = 2100000000; + ct.colWidth = 16777215; // force token if (item->type() == Item::FUNC_ITEM) diff --git a/mysql-test/columnstore/basic/r/mcol_2000.result b/mysql-test/columnstore/basic/r/mcol_2000.result index f8389d900..9905e179d 100644 --- a/mysql-test/columnstore/basic/r/mcol_2000.result +++ b/mysql-test/columnstore/basic/r/mcol_2000.result @@ -1,4 +1,5 @@ drop database if exists test_mcol2000; +SET @@SQL_MODE = CONCAT(@@SQL_MODE, ',STRICT_TRANS_TABLES'); create database test_mcol2000; use test_mcol2000; drop table if exists orig; @@ -1079,7 +1080,7 @@ g text 65535 h datetime 8 i text 16777215 j datetime 8 -k text 2100000000 +k text 16777215 l datetime 8 drop table if exists cs1; drop table if exists cs2; @@ -1186,7 +1187,7 @@ g text 65535 h datetime 8 i text 16777215 j datetime 8 -k text 2100000000 +k text 16777215 l datetime 8 drop table if exists cs1; drop table if exists cs2; @@ -1293,7 +1294,7 @@ g text 65535 h datetime 8 i text 16777215 j datetime 8 -k text 2100000000 +k text 16777215 l datetime 8 drop table cs1; drop table cs2; diff --git a/mysql-test/columnstore/basic/t/mcol_2000.test b/mysql-test/columnstore/basic/t/mcol_2000.test index 4b00832cd..99d635e53 100644 --- a/mysql-test/columnstore/basic/t/mcol_2000.test +++ b/mysql-test/columnstore/basic/t/mcol_2000.test @@ -9,6 +9,8 @@ drop database if exists test_mcol2000; -- enable_warnings +SET @@SQL_MODE = CONCAT(@@SQL_MODE, ',STRICT_TRANS_TABLES'); + #let $saved_cs = `SELECT @@character_set_client`; #SET CHARSET utf8; diff --git a/mysql-test/columnstore/bugfixes/mcol-3879.result b/mysql-test/columnstore/bugfixes/mcol-3879.result new file mode 100644 index 000000000..c49e5aff4 --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol-3879.result @@ -0,0 +1,22 @@ +DROP DATABASE IF EXISTS `mcol_3879`; +CREATE DATABASE `mcol_3879`; +USE `mcol_3879`; +create table t1 ( +id bigint(20) DEFAULT NULL, +v1 varchar(32) DEFAULT NULL, +v2 varchar(100) DEFAULT NULL, +json1 longtext DEFAULT NULL, +json2 longtext DEFAULT NULL, +json3 longtext DEFAULT NULL) +ENGINE = COLUMNSTORE +DEFAULT CHARSET utf8mb4; +insert into t1 (id, v1, v2) values (1, "DUP", "This is a test of a bug 1"), +(2, "REF", "This is a test of a bug 2"), +(1002, "REF", "This is a test of a bug 3"), +(1002, "DUP", "This is a test of a bug 4"), +(5, "dup", "This is a test of a bug 5"); +select * from t1 where v1 = "DUP" and id <> 1002; +id v1 v2 json1 json2 json3 +1 DUP This is a test of a bug 1 NULL NULL NULL +5 dup This is a test of a bug 5 NULL NULL NULL +DROP DATABASE `mcol_3879`; diff --git a/mysql-test/columnstore/bugfixes/mcol-3879.test b/mysql-test/columnstore/bugfixes/mcol-3879.test new file mode 100644 index 000000000..1154e0adb --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol-3879.test @@ -0,0 +1,27 @@ +--source ../include/have_columnstore.inc +--disable_warnings +DROP DATABASE IF EXISTS `mcol_3879`; +--enable_warnings +CREATE DATABASE `mcol_3879`; +USE `mcol_3879`; + +create table t1 ( + id bigint(20) DEFAULT NULL, + v1 varchar(32) DEFAULT NULL, + v2 varchar(100) DEFAULT NULL, + json1 longtext DEFAULT NULL, + json2 longtext DEFAULT NULL, + json3 longtext DEFAULT NULL) + ENGINE = COLUMNSTORE + DEFAULT CHARSET utf8mb4; + +insert into t1 (id, v1, v2) values (1, "DUP", "This is a test of a bug 1"), + (2, "REF", "This is a test of a bug 2"), + (1002, "REF", "This is a test of a bug 3"), + (1002, "DUP", "This is a test of a bug 4"), + (5, "dup", "This is a test of a bug 5"); + +select * from t1 where v1 = "DUP" and id <> 1002; + +# cleanup +DROP DATABASE `mcol_3879`; diff --git a/mysql-test/columnstore/bugfixes/mcol-4758.result b/mysql-test/columnstore/bugfixes/mcol-4758.result new file mode 100644 index 000000000..b3172e3af --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol-4758.result @@ -0,0 +1,14 @@ +DROP DATABASE IF EXISTS `mcol_4758`; +CREATE DATABASE `mcol_4758`; +USE `mcol_4758`; +CREATE TABLE src (c0 INT, cLB LONGBLOB, cLT LONGTEXT)engine=columnstore default charset utf8mb4; +SELECT column_name, data_type, column_length FROM information_schema.columnstore_columns WHERE hex(table_schema)=hex('mcol_4758') and hex(table_name)=hex('src'); +column_name data_type column_length +c0 int 4 +clb blob 16777215 +clt text 16777215 +INSERT INTO src VALUES (1, "Pretty Bloby Thing", "This is some text"); +select * from src where c0=1 and substr(cLT, 1, 4)="This"; +c0 cLB cLT +1 Pretty Bloby Thing This is some text +DROP DATABASE `mcol_4758`; diff --git a/mysql-test/columnstore/bugfixes/mcol-4758.test b/mysql-test/columnstore/bugfixes/mcol-4758.test new file mode 100644 index 000000000..a9117a96f --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol-4758.test @@ -0,0 +1,19 @@ +--source ../include/have_columnstore.inc +--disable_warnings +DROP DATABASE IF EXISTS `mcol_4758`; +--enable_warnings +CREATE DATABASE `mcol_4758`; +USE `mcol_4758`; + +CREATE TABLE src (c0 INT, cLB LONGBLOB, cLT LONGTEXT)engine=columnstore default charset utf8mb4; +SELECT column_name, data_type, column_length FROM information_schema.columnstore_columns WHERE hex(table_schema)=hex('mcol_4758') and hex(table_name)=hex('src'); +INSERT INTO src VALUES (1, "Pretty Bloby Thing", "This is some text"); +select * from src where c0=1 and substr(cLT, 1, 4)="This"; + +# To be uncommented when MCOL-4480 is fixed +#ALTER TABLE src ADD COLUMN (cLT2 LONGTEXT); +#UPDATE src SET cLT2="My Friday Night" where c0=1; +#select * from src where c0=1 and substr(cLT, 1, 4)="This"; + +# cleanup +DROP DATABASE `mcol_4758`; diff --git a/writeengine/dictionary/we_dctnry.cpp b/writeengine/dictionary/we_dctnry.cpp index 6a1be9c29..f78b490f8 100644 --- a/writeengine/dictionary/we_dctnry.cpp +++ b/writeengine/dictionary/we_dctnry.cpp @@ -67,7 +67,7 @@ const int m_bigSpace = // free space in an empty block const int START_HDR1 = // start loc of 2nd offset (HDR1) HDR_UNIT_SIZE + NEXT_PTR_BYTES + HDR_UNIT_SIZE; const int PSEUDO_COL_WIDTH = DICT_COL_WIDTH; // used to convert row count to block count -const int MAX_BLOB_SIZE = 2100000000; // for safety, we use an 18bit block count of 8KB blocks +const int MAX_BLOB_SIZE = 16777215; // MCOL-4758 limit TEXT and BLOB to 16MB } namespace WriteEngine