@@ -200,22 +200,40 @@ func TestSingleQueryPrepared(t *testing.T) {
200200
201201// Convenience test for debugging a single query. Unskip and set to the desired query.
202202func TestSingleScript (t * testing.T ) {
203- t .Skip ()
203+ // t.Skip()
204204 var scripts = []queries.ScriptTest {
205205 {
206- Name : "AS OF propagates to nested CALLs" ,
207- SetUpScript : []string {},
206+ Name : "merge join optimization" ,
207+ Dialect : "mysql" ,
208+ SetUpScript : []string {
209+ "create table t3 (i int, j int, primary key (i, j));" ,
210+ "create table t4 (x int, y int, primary key (x, y));" ,
211+ "insert into t3 values (1, 1), (1, 2), (2, 2), (2, 3), (3, 3);" ,
212+ "insert into t4 values (2, 2), (3, 3), (4, 4);" ,
213+ },
208214 Assertions : []queries.ScriptTestAssertion {
209215 {
210- Query : "create procedure create_proc() create table t (i int primary key, j int);" ,
216+ Query : "select /*+ MERGE_JOIN(t3, t4) */ * from t3 join t4 on t3.i = t4.x order by t3.i;" ,
217+ Expected : []sql.Row {
218+ {2 , 2 , 2 , 2 },
219+ {2 , 3 , 2 , 2 },
220+ {3 , 3 , 3 , 3 },
221+ },
222+ },
223+ {
224+ Query : "explain plan select /*+ MERGE_JOIN(t3, t4) */ * from t3 join t4 on t3.i = t4.x order by t3.i desc;" ,
211225 Expected : []sql.Row {
212- {types .NewOkResult (0 )},
226+ {3 , 3 , 3 , 3 },
227+ {2 , 3 , 2 , 2 },
228+ {2 , 2 , 2 , 2 },
213229 },
214230 },
215231 {
216- Query : "call create_proc() " ,
232+ Query : "explain plan select /*+ MERGE_JOIN(t3, t4) */ * from t3 join t4 on t3.i = t4.x order by t3.j; " ,
217233 Expected : []sql.Row {
218- {types .NewOkResult (0 )},
234+ {2 , 2 , 2 , 2 },
235+ {2 , 3 , 2 , 2 },
236+ {3 , 3 , 3 , 3 },
219237 },
220238 },
221239 },
0 commit comments