diff --git a/go/test/endtoend/vtgate/vitess_tester/join/join.test b/go/test/endtoend/vtgate/vitess_tester/join/join.test index cffd3a1b3aa..72d79a1206e 100644 --- a/go/test/endtoend/vtgate/vitess_tester/join/join.test +++ b/go/test/endtoend/vtgate/vitess_tester/join/join.test @@ -25,6 +25,15 @@ CREATE TABLE `t3` CHARSET utf8mb4, COLLATE utf8mb4_unicode_ci; +CREATE TABLE `t4` +( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `col` int unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE InnoDB, + CHARSET utf8mb4, + COLLATE utf8mb4_unicode_ci; + insert into t1 (id, name) values (1, 'A'), (2, 'B'), @@ -43,7 +52,28 @@ values (1, 'A'), (4, 'B'), (5, 'B'); +insert into t4 (id, col) +values (1, 1), + (2, 2), + (3, 3); + -- wait_authoritative t1 -- wait_authoritative t2 -- wait_authoritative t3 -select 42 from t1 join t2 on t1.id = t2.t1_id join t3 on t1.id = t3.id where t1.name or t2.id or t3.name; +select 42 +from t1 + join t2 on t1.id = t2.t1_id + join t3 on t1.id = t3.id +where t1.name + or t2.id + or t3.name; + +# Complex query that requires hash join underneath a memory sort and ordered aggregate +select 1 +from t1 + join t2 on t1.id = t2.t1_id + join t4 on t4.col = t2.id + left join (select t4.col, count(*) as count from t4 group by t4.col) t3 on t3.col = t2.id +where t1.id IN (1, 2) +group by t2.id, t4.col; + diff --git a/go/test/endtoend/vtgate/vitess_tester/join/vschema.json b/go/test/endtoend/vtgate/vitess_tester/join/vschema.json index b922d3f760c..1105b951e61 100644 --- a/go/test/endtoend/vtgate/vitess_tester/join/vschema.json +++ b/go/test/endtoend/vtgate/vitess_tester/join/vschema.json @@ -31,6 +31,14 @@ "name": "hash" } ] + }, + "t4": { + "column_vindexes": [ + { + "column": "id", + "name": "hash" + } + ] } } }