1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-20 09:07:44 +03:00
mariadb-columnstore-engine/mysql-test/columnstore/basic/r/mcs222_position_function.result
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

56 lines
1.1 KiB
Plaintext

DROP DATABASE IF EXISTS mcs222_db;
CREATE DATABASE mcs222_db;
USE mcs222_db;
CREATE TABLE t1 (a INT, b CHAR(15))ENGINE=Columnstore;
INSERT INTO t1 VALUES (NULL, NULL),(1, 'a'),(2, 'aqaaqq'),(3, 'cqcqqcq'),(4, 'qdqdqqdq'),(5, 'aaaqq');
SELECT POSITION('zz' IN 'aazazazapq');
POSITION('zz' IN 'aazazazapq')
0
SELECT POSITION('zz' IN 'zzaazapq');
POSITION('zz' IN 'zzaazapq')
1
SELECT POSITION('zz' IN 'aazzzazzaq');
POSITION('zz' IN 'aazzzazzaq')
3
SELECT b, POSITION('a' IN b) FROM t1 ORDER BY b;
b POSITION('a' IN b)
NULL NULL
a 1
aaaqq 1
aqaaqq 1
cqcqqcq 0
qdqdqqdq 0
SELECT b, POSITION('aa' IN b) FROM t1 ORDER BY b;
b POSITION('aa' IN b)
NULL NULL
a 0
aaaqq 1
aqaaqq 3
cqcqqcq 0
qdqdqqdq 0
SELECT b, POSITION('aaa' IN b) FROM t1 ORDER BY b;
b POSITION('aaa' IN b)
NULL NULL
a 0
aaaqq 1
aqaaqq 0
cqcqqcq 0
qdqdqqdq 0
SELECT b, POSITION('qq' IN b) FROM t1 ORDER BY b;
b POSITION('qq' IN b)
NULL NULL
a 0
aaaqq 4
aqaaqq 5
cqcqqcq 4
qdqdqqdq 5
SELECT b, POSITION(concat(b, 'zzz') IN 'azzzghijk') FROM t1 ORDER BY b;
b POSITION(concat(b, 'zzz') IN 'azzzghijk')
NULL NULL
a 1
aaaqq 0
aqaaqq 0
cqcqqcq 0
qdqdqqdq 0
DROP DATABASE mcs222_db;