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

23 lines
543 B
Plaintext

DROP DATABASE IF EXISTS mcs191_db;
CREATE DATABASE mcs191_db;
USE mcs191_db;
CREATE TABLE t1 (a INT, b CHAR(5))ENGINE=Columnstore;
INSERT INTO t1 VALUES (NULL, NULL),(1, 'aaa'),(2, 'aaa'),(1, 'ccc'),(4, 'ddd'),(5, 'aaa'),(6, 'ddd'),(7, 'eee');
SELECT MIN(DISTINCT a) FROM t1;
MIN(DISTINCT a)
1
SELECT MIN(DISTINCT a) FROM t1 GROUP BY b HAVING b = 'aaa';
MIN(DISTINCT a)
1
SELECT b, MIN(DISTINCT a) FROM t1 GROUP BY b ORDER BY b DESC;
b MIN(DISTINCT a)
eee 7
ddd 4
ccc 1
aaa 1
NULL NULL
SELECT MIN(a) FROM t1;
MIN(a)
1
DROP DATABASE mcs191_db;