1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

fix: MCOL-5755: incorrect handling of BLOB (and TEXT) in GROUP BY

BLOB fields did not work as grouping keys at all, they were assigned
value NULL for any value, be it NULL or not. The fix is in the
rowaggregation.cpp in the initMapping(), a switch/case branch was added
to handle BLOB field copying there.

Also, TEXT columns did not distinguish between NULL and empty string in
the grouping algorithm, now they do. The fix is in the equals()
function, now we specifically check for isNull() equality between
values.
This commit is contained in:
Serguey Zefirov
2024-07-09 10:29:08 +03:00
committed by Leonid Fedorov
parent 6d1c6d8242
commit 3bb2496ca1
8 changed files with 79 additions and 10 deletions

View File

@ -86,7 +86,11 @@ COUNT(*)
9
SELECT COUNT(*) FROM t1 GROUP BY t1_blob;
COUNT(*)
14
1
1
3
3
6
SELECT COUNT(*) FROM t1 GROUP BY t1_text;
COUNT(*)
1

View File

@ -0,0 +1,29 @@
DROP DATABASE IF EXISTS MCOL5755;
CREATE DATABASE MCOL5755;
USE MCOL5755;
CREATE TABLE t1 (t TEXT,c CHAR(10),b BLOB) ENGINE = columnstore;
INSERT INTO t1 VALUES (NULL,NULL,NULL);
INSERT INTO t1 VALUES ("","","");
INSERT INTO t1 VALUES ("hello","hello","hello");
INSERT INTO t1 VALUES ("HELLO","HELLO","HELLO");
INSERT INTO t1 VALUES ("HELLO MY","HELLO MY","HELLO MY");
INSERT INTO t1 VALUES ("a","a","a");
INSERT INTO t1 VALUES (1,1,1);
SELECT b FROM t1 GROUP BY b;
b
1
HELLO
HELLO MY
NULL
a
hello
SELECT t FROM t1 GROUP BY t;
t
1
HELLO MY
NULL
a
hello
DROP DATABASE MCOL5755;

View File

@ -0,0 +1,18 @@
--disable_warnings
DROP DATABASE IF EXISTS MCOL5755;
--enable_warnings
CREATE DATABASE MCOL5755;
USE MCOL5755;
CREATE TABLE t1 (t TEXT,c CHAR(10),b BLOB) ENGINE = columnstore;
INSERT INTO t1 VALUES (NULL,NULL,NULL);
INSERT INTO t1 VALUES ("","","");
INSERT INTO t1 VALUES ("hello","hello","hello");
INSERT INTO t1 VALUES ("HELLO","HELLO","HELLO");
INSERT INTO t1 VALUES ("HELLO MY","HELLO MY","HELLO MY");
INSERT INTO t1 VALUES ("a","a","a");
INSERT INTO t1 VALUES (1,1,1);
--sorted_result
SELECT b FROM t1 GROUP BY b;
--sorted_result
SELECT t FROM t1 GROUP BY t;
DROP DATABASE MCOL5755;