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

45 lines
1.5 KiB
Plaintext

DROP DATABASE IF EXISTS mcs218_db;
CREATE DATABASE mcs218_db;
USE mcs218_db;
CREATE TABLE t1
(
t1_BIGINT BIGINT,
t1_DOUBLE DOUBLE,
t1_FLOAT FLOAT,
t1_BLOB BLOB,
t1_TEXT TEXT,
t1_CHAR_1 CHAR(1),
t1_DATETIME DATETIME
)ENGINE=Columnstore;
INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, NULL, NULL, '0-0-0');
INSERT INTO t1 VALUES(203685477580676, -3.797693231E+108, -7.402866E+18, repeat('b',10), repeat('b',10), 'b', '2387-11-08 11:22:30.123');
SELECT t1_BIGINT, MD5(t1_BIGINT) FROM t1 ORDER BY t1_BIGINT;
t1_BIGINT MD5(t1_BIGINT)
NULL NULL
203685477580676 9e05a00575dbbdb0e9c03d479cea5eb9
SELECT t1_DOUBLE, MD5(t1_DOUBLE) FROM t1 ORDER BY t1_DOUBLE;
t1_DOUBLE MD5(t1_DOUBLE)
NULL NULL
-3.797693231e108 bba02430bfe020a8d8ddffaff6b04004
SELECT t1_FLOAT, MD5(t1_FLOAT) FROM t1 ORDER BY t1_FLOAT;
t1_FLOAT MD5(t1_FLOAT)
NULL NULL
-7.40287e18 4957f3df13f93c70ab3957bf738826dc
SELECT t1_TEXT, MD5(t1_TEXT) FROM t1 ORDER BY t1_TEXT;
t1_TEXT MD5(t1_TEXT)
NULL NULL
bbbbbbbbbb 82136b4240d6ce4ea7d03e51469a393b
SELECT t1_CHAR_1, MD5(t1_CHAR_1) FROM t1 ORDER BY t1_CHAR_1;
t1_CHAR_1 MD5(t1_CHAR_1)
NULL NULL
b 92eb5ffee6ae2fec3ad71c777531578f
SELECT t1_DATETIME, MD5(t1_DATETIME) FROM t1 ORDER BY t1_DATETIME;
t1_DATETIME MD5(t1_DATETIME)
0000-00-00 00:00:00 8e30a659c31b53017073692309ab0da1
2387-11-08 11:22:30 9cf01b3f830ff29aa3f394fd54ea5a23
SELECT t1_DATETIME FROM t1 WHERE MD5(t1_DATETIME) <> 0 ORDER BY t1_DATETIME;
t1_DATETIME
0000-00-00 00:00:00
2387-11-08 11:22:30
DROP DATABASE mcs218_db;