Skip to content

Commit eddd580

Browse files
author
James Cor
committed
test for lookup join
1 parent 5b1a12f commit eddd580

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

enginetest/queries/script_queries.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8332,6 +8332,55 @@ where
83328332
},
83338333
},
83348334
},
8335+
{
8336+
Name: "lookup join string test",
8337+
Dialect: "mysql",
8338+
SetUpScript: []string{
8339+
`
8340+
CREATE TABLE testA (
8341+
id int PRIMARY KEY,
8342+
supplierkey VARCHAR(100),
8343+
name VARCHAR(100),
8344+
product VARCHAR(100),
8345+
UNIQUE KEY unique_product_supplier_key (product, supplierKey)
8346+
);`,
8347+
`
8348+
CREATE TABLE testB (
8349+
id int PRIMARY KEY,
8350+
vendorkey VARCHAR(100),
8351+
name VARCHAR(100),
8352+
supplierkey VARCHAR(100),
8353+
product VARCHAR(100),
8354+
UNIQUE KEY unique_product_vendor_key (product,vendorKey)
8355+
);`,
8356+
"INSERT INTO testA VALUES (1, 'texwin-post-frame', 'Texwin (Post Frame)', 'carports');",
8357+
"INSERT INTO testA VALUES (2, 'texwin', 'Texwin', 'carports');",
8358+
"INSERT INTO testB VALUES (1, 'advancebldg', 'Test', 'texwin', 'carports');",
8359+
},
8360+
Assertions: []ScriptTestAssertion{
8361+
{
8362+
Query: `
8363+
SELECT /*+ LOOKUP_JOIN(v,s) */
8364+
v.vendorkey AS vendor,
8365+
v.product,
8366+
v.supplierkey,
8367+
s.name AS supplierName
8368+
FROM
8369+
testB AS v
8370+
INNER JOIN
8371+
testA AS s
8372+
ON
8373+
s.supplierkey = v.supplierkey AND
8374+
s.product = v.product
8375+
WHERE
8376+
v.vendorkey = 'advancebldg';
8377+
`,
8378+
Expected: []sql.Row{
8379+
{"advancebldg", "carports", "texwin", "Texwin"},
8380+
},
8381+
},
8382+
},
8383+
},
83358384
}
83368385

83378386
var SpatialScriptTests = []ScriptTest{

0 commit comments

Comments
 (0)