summaryrefslogtreecommitdiff
path: root/mysql-test/t/join_cache.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2010-11-07 15:19:30 -0800
committerIgor Babaev <igor@askmonty.org>2010-11-07 15:19:30 -0800
commit74d18e93c6a620460fb2f75af11056739fea8f6b (patch)
tree96e6e3847977bb2067081769fe63d859dbcaae58 /mysql-test/t/join_cache.test
parentbbbe3ac8fbef905a7c8e0afcb6cb67bb67fb3ba5 (diff)
downloadmariadb-git-74d18e93c6a620460fb2f75af11056739fea8f6b.tar.gz
Fixed LP bug #671901.
Currently BNLH join uses a simplified implementation of hash function when hash function is calculated over the whole key buffer, not only the significant bytes of it. It means that both building keys and probing keys both must fill insignificant bytes with the same filler. Usually 0 is used as such a filler. Yet the code before patch filled insignificant bytes only for probing keys.
Diffstat (limited to 'mysql-test/t/join_cache.test')
-rw-r--r--mysql-test/t/join_cache.test43
1 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test
index 16bd2d515ad..615c8068c0f 100644
--- a/mysql-test/t/join_cache.test
+++ b/mysql-test/t/join_cache.test
@@ -2315,5 +2315,48 @@ SET SESSION join_buffer_size = DEFAULT;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug #671901: hash join using a ref to a varchar field
+--echo #
+
+CREATE TABLE t1 (
+ v varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
+ i int DEFAULT NULL
+);
+INSERT INTO t1 VALUES
+ ('k',8), ('abcdefjh',-575340544), ('f',77), ('because', 2), ('f',-517472256),
+ ('abcdefjhj',5), ('z',7);
+
+CREATE TABLE t2 (
+ v varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
+ i int DEFAULT NULL,
+ INDEX idx (v)
+);
+INSERT INTO t2 VALUES
+ ('did',5), ('was',-1631322112), ('are',3), ('abcdefjhjk',3),
+ ('abcdefjhjk',4), ('tell',-824573952), ('t',0),('v',-1711013888),
+ ('abcdefjhjk',1015414784), ('or',4), ('now',0), ('abcdefjhjk',-32702464),
+ ('abcdefjhjk',4), ('time',1078394880), ('f',4), ('m',-1845559296),
+ ('ff', 5), ('abcdefjhjk',-1074397184);
+
+EXPLAIN
+SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v;
+SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v;
+EXPLAIN
+SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v);
+SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v);
+
+SET SESSION join_cache_level = 4;
+EXPLAIN
+SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v;
+SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v;
+EXPLAIN
+SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v);
+SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v);
+
+SET SESSION join_cache_level = DEFAULT;
+
+DROP TABLE t1,t2;
+
# this must be the last command in the file
set @@optimizer_switch=@save_optimizer_switch;