mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-04-20 09:07:44 +03:00
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.
46 lines
883 B
Plaintext
46 lines
883 B
Plaintext
DROP DATABASE IF EXISTS mcs260_db;
|
|
CREATE DATABASE mcs260_db;
|
|
USE mcs260_db;
|
|
CREATE TABLE t1 (a INT, b DECIMAL(3,2), c CHAR(5))ENGINE=Columnstore;
|
|
INSERT INTO t1 VALUES (NULL, NULL, ''),(1, 1.11, 'a'),(2, 2.22, 'b'),(3, 3.33, 'c');
|
|
SELECT SPACE(-1) FROM t1 LIMIT 1;
|
|
SPACE(-1)
|
|
|
|
SELECT SPACE(0) FROM t1 LIMIT 1;
|
|
SPACE(0)
|
|
|
|
SELECT SPACE(0.49) FROM t1 LIMIT 1;
|
|
SPACE(0.49)
|
|
|
|
SELECT SPACE(0.5) FROM t1 LIMIT 1;
|
|
SPACE(0.5)
|
|
|
|
SELECT SPACE(1) FROM t1 LIMIT 1;
|
|
SPACE(1)
|
|
|
|
SELECT SPACE('@') FROM t1 LIMIT 1;
|
|
SPACE('@')
|
|
|
|
Warnings:
|
|
Warning 1292 Truncated incorrect INTEGER value: '@'
|
|
Warning 1292 Truncated incorrect INTEGER value: '@'
|
|
SELECT a, SPACE(a) FROM t1 ORDER BY 1;
|
|
a SPACE(a)
|
|
NULL NULL
|
|
1
|
|
2
|
|
3
|
|
SELECT b, SPACE(b) FROM t1 ORDER BY 1;
|
|
b SPACE(b)
|
|
NULL NULL
|
|
1.11
|
|
2.22
|
|
3.33
|
|
SELECT c, SPACE(c) FROM t1 ORDER BY 1;
|
|
c SPACE(c)
|
|
NULL
|
|
a NULL
|
|
b NULL
|
|
c NULL
|
|
DROP DATABASE mcs260_db;
|