Skip to content

Commit c4b1e79

Browse files
authored
[no-release-notes] test for lookup join (#2956)
1 parent 5b1a12f commit c4b1e79

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

enginetest/join_op_tests.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,56 @@ SELECT SUM(x) FROM xy WHERE x IN (
19841984
},
19851985
},
19861986
},
1987+
{
1988+
name: "string key test",
1989+
setup: [][]string{
1990+
{
1991+
`
1992+
CREATE TABLE testA (
1993+
id int PRIMARY KEY,
1994+
supplierkey VARCHAR(100),
1995+
name VARCHAR(100),
1996+
product VARCHAR(100),
1997+
UNIQUE KEY unique_product_supplier_key (product, supplierKey)
1998+
);`,
1999+
`
2000+
CREATE TABLE testB (
2001+
id int PRIMARY KEY,
2002+
vendorkey VARCHAR(100),
2003+
name VARCHAR(100),
2004+
supplierkey VARCHAR(100),
2005+
product VARCHAR(100),
2006+
UNIQUE KEY unique_product_vendor_key (product,vendorKey)
2007+
);`,
2008+
"INSERT INTO testA VALUES (1, 'texwin-post-frame', 'Texwin (Post Frame)', 'carports');",
2009+
"INSERT INTO testA VALUES (2, 'texwin', 'Texwin', 'carports');",
2010+
"INSERT INTO testB VALUES (1, 'advancebldg', 'Test', 'texwin', 'carports');",
2011+
},
2012+
},
2013+
tests: []JoinOpTests{
2014+
{
2015+
Query: `
2016+
SELECT
2017+
v.vendorkey AS vendor,
2018+
v.product,
2019+
v.supplierkey,
2020+
s.name AS supplierName
2021+
FROM
2022+
testB AS v
2023+
INNER JOIN
2024+
testA AS s
2025+
ON
2026+
s.supplierkey = v.supplierkey AND
2027+
s.product = v.product
2028+
WHERE
2029+
v.vendorkey = 'advancebldg';
2030+
`,
2031+
Expected: []sql.Row{
2032+
{"advancebldg", "carports", "texwin", "Texwin"},
2033+
},
2034+
},
2035+
},
2036+
},
19872037
}
19882038

19892039
var rangeJoinOpTests = []JoinOpTests{

0 commit comments

Comments
 (0)