diff --git a/enginetest/join_op_tests.go b/enginetest/join_op_tests.go index bf7722dc7c..8fb2a5b2db 100644 --- a/enginetest/join_op_tests.go +++ b/enginetest/join_op_tests.go @@ -123,6 +123,26 @@ var joinOpTests = []struct { }, }, }, + { + name: "left join on array data", + setup: [][]string{ + { + "create table xy (x binary(2) primary key, y binary(2))", + "create table uv (u binary(2) primary key, v binary(2))", + "insert into xy values (x'F0F0',x'1234'),(x'2345',x'3456');", + "insert into uv values (x'fedc',x'F0F0');", + }, + }, + tests: []JoinOpTests{ + { + Query: "select HEX(x),HEX(u) from xy left join uv on x = v OR y = u", + Expected: []sql.Row{ + {"2345", nil}, + {"F0F0", "FEDC"}, + }, + }, + }, + }, { name: "point lookups", setup: [][]string{ diff --git a/sql/plan/hash_lookup.go b/sql/plan/hash_lookup.go index fc47da11f8..dfa98bee82 100644 --- a/sql/plan/hash_lookup.go +++ b/sql/plan/hash_lookup.go @@ -132,22 +132,7 @@ func (n *HashLookup) GetHashKey(ctx *sql.Context, e sql.Expression, row sql.Row) return nil, err } if s, ok := key.([]interface{}); ok { - switch len(s) { - case 0: - return [0]interface{}{}, nil - case 1: - return [1]interface{}{s[0]}, nil - case 2: - return [2]interface{}{s[0], s[1]}, nil - case 3: - return [3]interface{}{s[0], s[1], s[2]}, nil - case 4: - return [4]interface{}{s[0], s[1], s[2], s[3]}, nil - case 5: - return [5]interface{}{s[0], s[1], s[2], s[3], s[4]}, nil - default: - return sql.HashOf(s) - } + return sql.HashOf(s) } // byte slices are not hashable if k, ok := key.([]byte); ok {