You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-27 21:01:50 +03:00
MCOL-4823 WHERE char_col<varchar_col returns a wrong result of a large table (#2060)
SCommand StrFilterCmd::duplicate() missed these two lines: filterCmd->leftColType = leftColType; filterCmd->rightColType = rightColType; which exist in the parent's FilterCommand::duplicate(). Rewriting the code to avoid duplication by using more inherited methods/constructors. This reduces the probability of similar bugs in the future.
This commit is contained in:
80
mysql-test/columnstore/basic/r/type_string.result
Normal file
80
mysql-test/columnstore/basic/r/type_string.result
Normal file
@ -0,0 +1,80 @@
|
||||
DROP DATABASE IF EXISTS mcs_type_string;
|
||||
CREATE DATABASE mcs_type_string;
|
||||
#
|
||||
# MCOL-4823 WHERE char_col<varchar_col returns a wrong result of a large table
|
||||
#
|
||||
CREATE TABLE t1
|
||||
(
|
||||
l_returnflag char(1) CHARACTER SET latin1 COLLATE latin1_bin,
|
||||
l_shipinstruct char(25) CHARACTER SET latin1 COLLATE latin1_bin,
|
||||
l_comment varchar(44) CHARACTER SET latin1 COLLATE latin1_bin
|
||||
) ENGINE=MyISAM;
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE ins TEXT DEFAULT 'INSERT INTO t1 VALUES <rows>';
|
||||
DECLARE onerow TEXT DEFAULT '(''a'',''aaaa'',''AAAA'')';
|
||||
DECLARE rows256 TEXT DEFAULT CONCAT(REPEAT(CONCAT(onerow, ','), 255), onerow);
|
||||
-- The problem was repeatable with at least 122881 records
|
||||
-- For faster data loading, insert 256 records at a time 480 times
|
||||
-- That gives 480*256=122880 records
|
||||
FOR i IN 1..480
|
||||
DO
|
||||
EXECUTE IMMEDIATE REPLACE(ins, '<rows>', rows256);
|
||||
END FOR;
|
||||
-- Now insert one more record to make 122881 records
|
||||
EXECUTE IMMEDIATE REPLACE(ins, '<rows>', onerow);
|
||||
END
|
||||
$$
|
||||
SELECT count(*) FROM t1 WHERE l_comment < l_shipinstruct;
|
||||
count(*)
|
||||
122881
|
||||
SELECT count(*) FROM t1 WHERE l_comment <= l_shipinstruct;
|
||||
count(*)
|
||||
122881
|
||||
SELECT count(*) FROM t1 WHERE l_comment >= l_shipinstruct;
|
||||
count(*)
|
||||
0
|
||||
SELECT count(*) FROM t1 WHERE l_comment > l_shipinstruct;
|
||||
count(*)
|
||||
0
|
||||
SELECT count(*) FROM t1 WHERE l_shipinstruct < l_comment;
|
||||
count(*)
|
||||
0
|
||||
SELECT count(*) FROM t1 WHERE l_shipinstruct <= l_comment;
|
||||
count(*)
|
||||
0
|
||||
SELECT count(*) FROM t1 WHERE l_shipinstruct >= l_comment;
|
||||
count(*)
|
||||
122881
|
||||
SELECT count(*) FROM t1 WHERE l_shipinstruct > l_comment;
|
||||
count(*)
|
||||
122881
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
ALTER TABLE t2 ENGINE=ColumnStore;
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
SELECT count(*) FROM t2 WHERE l_comment < l_shipinstruct;
|
||||
count(*)
|
||||
122881
|
||||
SELECT count(*) FROM t2 WHERE l_comment <= l_shipinstruct;
|
||||
count(*)
|
||||
122881
|
||||
SELECT count(*) FROM t2 WHERE l_comment >= l_shipinstruct;
|
||||
count(*)
|
||||
0
|
||||
SELECT count(*) FROM t2 WHERE l_comment > l_shipinstruct;
|
||||
count(*)
|
||||
0
|
||||
SELECT count(*) FROM t2 WHERE l_shipinstruct < l_comment;
|
||||
count(*)
|
||||
0
|
||||
SELECT count(*) FROM t2 WHERE l_shipinstruct <= l_comment;
|
||||
count(*)
|
||||
0
|
||||
SELECT count(*) FROM t2 WHERE l_shipinstruct >= l_comment;
|
||||
count(*)
|
||||
122881
|
||||
SELECT count(*) FROM t2 WHERE l_shipinstruct > l_comment;
|
||||
count(*)
|
||||
122881
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE mcs_type_string;
|
Reference in New Issue
Block a user