mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-05-02 19:24:47 +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.
49 lines
1.8 KiB
Plaintext
49 lines
1.8 KiB
Plaintext
#
|
|
# Test WHERE conditions
|
|
# Author: Bharath, bharath.bokka@mariadb.com
|
|
#
|
|
-- source ../include/have_columnstore.inc
|
|
|
|
--disable_warnings
|
|
DROP DATABASE IF EXISTS mcs77_db;
|
|
--enable_warnings
|
|
|
|
CREATE DATABASE mcs77_db;
|
|
USE mcs77_db;
|
|
|
|
CREATE TABLE t1
|
|
(
|
|
t1_tinyint TINYINT DEFAULT 0,
|
|
t1_int INT DEFAULT NULL,
|
|
t1_bigint BIGINT,
|
|
t1_decimal DECIMAL(5,2),
|
|
t1_text TEXT,
|
|
t1_char CHAR(5),
|
|
t1_varchar VARCHAR(255) DEFAULT 'hello world!',
|
|
t1_datetime DATETIME
|
|
)ENGINE=Columnstore;
|
|
INSERT INTO t1 VALUES();
|
|
INSERT INTO t1 VALUES(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
INSERT INTO t1 VALUES(1, 123456, 987654321, 122.32, repeat('z', 20), 'aaa', repeat('a', 20), '1111-11-11 11:11:11');
|
|
INSERT INTO t1 VALUES(0, 1023456, 887654321, 222.32, repeat('y', 20), 'aaa', repeat('b', 20), '1111-11-11 11:11:11');
|
|
INSERT INTO t1 VALUES(1, -123456, -987654321, -122.32, repeat('z', 20), 'bbb', repeat('a', 20), '1111-11-11 11:11:11');
|
|
INSERT INTO t1 VALUES(0, -1023456, -887654321, -222.32, repeat('x', 20), 'bbb', repeat('b', 20), '1111-11-11 11:11:11');
|
|
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t1 WHERE t1_int IS NULL;
|
|
SELECT * FROM t1 WHERE t1_tinyint = 0;
|
|
SELECT * FROM t1 WHERE t1_tinyint != 0;
|
|
SELECT * FROM t1 WHERE t1_bigint > 0;
|
|
SELECT * FROM t1 WHERE t1_bigint < 0;
|
|
SELECT * FROM t1 WHERE t1_decimal >= -122.22;
|
|
SELECT * FROM t1 WHERE t1_decimal <= -122.22;
|
|
SELECT * FROM t1 WHERE t1_text LIKE '%x%';
|
|
SELECT * FROM t1 WHERE t1_datetime IN ('1111-11-11 11:11:10','1111-11-13 0:0:0');
|
|
SELECT * FROM t1 WHERE t1_datetime IN ('1111-11-11 11:11:11','1111-11-13 0:0:0');
|
|
SELECT * FROM t1 WHERE t1_datetime BETWEEN '111-11-10' AND '1111-11-12';
|
|
SELECT * FROM t1 WHERE t1_text LIKE '%x%' OR t1_varchar LIKE '%a%';
|
|
SELECT * FROM t1 WHERE t1_text LIKE '%x%' AND t1_varchar LIKE '%b%';
|
|
|
|
# Clean UP
|
|
DROP DATABASE mcs77_db;
|