1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-18 21:44:02 +03:00
Sergey Zefirov b53c231ca6 MCOL-271 empty strings should not be NULLs (#2794)
This patch improves handling of NULLs in textual fields in ColumnStore.
Previously empty strings were considered NULLs and it could be a problem
if data scheme allows for empty strings. It was also one of major
reasons of behavior difference between ColumnStore and other engines in
MariaDB family.

Also, this patch fixes some other bugs and incorrect behavior, for
example, incorrect comparison for "column <= ''" which evaluates to
constant True for all purposes before this patch.
2023-03-30 21:18:29 +03:00

46 lines
1.0 KiB
Plaintext

DROP DATABASE IF EXISTS mcs286_db;
CREATE DATABASE mcs286_db;
USE mcs286_db;
CREATE TABLE t1 (a INT, b CHAR(15))ENGINE=Columnstore;
INSERT INTO t1 VALUES (NULL, NULL),(1, 'mariadb'),(2, 'columnstore'),(3, 'Innodb');
SELECT LEFT('mariadb cs', 7) FROM t1 LIMIT 1;
LEFT('mariadb cs', 7)
mariadb
SELECT LEFT('mariadb cs', 8) FROM t1 LIMIT 1;
LEFT('mariadb cs', 8)
mariadb
SELECT LEFT('mariadb cs', 9) FROM t1 LIMIT 1;
LEFT('mariadb cs', 9)
mariadb c
SELECT b, LEFT(b, 0) FROM t1 ORDER BY 1;
b LEFT(b, 0)
NULL NULL
columnstore
Innodb
mariadb
SELECT b, LEFT(b, -1) FROM t1 ORDER BY 1;
b LEFT(b, -1)
NULL NULL
columnstore
Innodb
mariadb
SELECT b, LEFT(b, 6) FROM t1 ORDER BY 1;
b LEFT(b, 6)
NULL NULL
columnstore column
Innodb Innodb
mariadb mariad
SELECT b, LEFT(b, 9) FROM t1 ORDER BY 1;
b LEFT(b, 9)
NULL NULL
columnstore columnsto
Innodb Innodb
mariadb mariadb
SELECT b, LEFT(concat('mmm_', b), 10) FROM t1 ORDER BY 1;
b LEFT(concat('mmm_', b), 10)
NULL NULL
columnstore mmm_column
Innodb mmm_Innodb
mariadb mmm_mariad
DROP DATABASE mcs286_db;