Skip to content

Commit c8940d7

Browse files
author
James Cor
committed
add a test
1 parent ee61b87 commit c8940d7

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

enginetest/queries/join_queries.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,25 @@ var JoinScriptTests = []ScriptTest{
11611161
},
11621162
},
11631163
},
1164+
{
1165+
// Since hash.HashOf takes in a sql.Schema to convert and hash keys,
1166+
// we need to pass in the right keys.
1167+
Name: "HashLookups regression test",
1168+
SetUpScript: []string{
1169+
"create table t1 (i int primary key, j varchar(1), k int);",
1170+
"create table t2 (i int primary key, k int);",
1171+
"insert into t1 values (111111, 'a', 111111);",
1172+
"insert into t2 values (111111, 111111);",
1173+
},
1174+
Assertions: []ScriptTestAssertion{
1175+
{
1176+
Query: "select /*+ HASH_JOIN(t1, t2) */ * from t1 join t2 on t1.i = t2.i and t1.k = t2.k;",
1177+
Expected: []sql.Row{
1178+
{111111, "a", 111111, 111111, 111111},
1179+
},
1180+
},
1181+
},
1182+
},
11641183
}
11651184

11661185
var LateralJoinScriptTests = []ScriptTest{

sql/plan/hash_lookup.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ import (
1818
"fmt"
1919
"sync"
2020

21-
"github.com/dolthub/go-mysql-server/sql/expression"
22-
2321
"github.com/dolthub/go-mysql-server/sql"
22+
"github.com/dolthub/go-mysql-server/sql/expression"
2423
"github.com/dolthub/go-mysql-server/sql/hash"
2524
"github.com/dolthub/go-mysql-server/sql/types"
2625
)

0 commit comments

Comments
 (0)