Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions enginetest/join_planning_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ var JoinPlanningTests = []struct {
{
// anti join will be cross-join-right, be passed non-nil parent row
q: "select x,a from ab, (select * from xy where x != (select r from rs where r = 1) order by 1) sq where x = 2 and b = 2 order by 1,2;",
types: []plan.JoinType{plan.JoinTypeCross, plan.JoinTypeLeftOuterHashExcludeNulls},
types: []plan.JoinType{plan.JoinTypeCrossHash, plan.JoinTypeLeftOuterHashExcludeNulls},
exp: []sql.Row{{2, 0}, {2, 1}, {2, 2}},
},
{
Expand All @@ -276,7 +276,7 @@ select * from uv where u > (
order by 1 limit 1
)
order by 1;`,
types: []plan.JoinType{plan.JoinTypeSemi, plan.JoinTypeCross, plan.JoinTypeLeftOuterHashExcludeNulls},
types: []plan.JoinType{plan.JoinTypeSemi, plan.JoinTypeCrossHash, plan.JoinTypeLeftOuterHashExcludeNulls},
exp: []sql.Row{{1, 1}, {2, 2}, {3, 2}},
},
{
Expand Down Expand Up @@ -305,7 +305,7 @@ order by 1;`,
{
// semi join will be right-side, be passed non-nil parent row
q: "select x,a from ab, (select * from xy where x = (select r from rs where r = 1) order by 1) sq order by 1,2",
types: []plan.JoinType{plan.JoinTypeCross, plan.JoinTypeLookup},
types: []plan.JoinType{plan.JoinTypeCrossHash, plan.JoinTypeLookup},
exp: []sql.Row{{1, 0}, {1, 1}, {1, 2}, {1, 3}},
},
//{
Expand All @@ -321,7 +321,7 @@ order by 1;`,
// order by 1 limit 1
//)
//order by 1;`,
//types: []plan.JoinType{plan.JoinTypeCross, plan.JoinTypeLookup},
//types: []plan.JoinType{plan.JoinTypeCrossHash, plan.JoinTypeLookup},
//exp: []sql.Row{{2, 2}, {3, 2}},
//},
{
Expand Down Expand Up @@ -459,7 +459,7 @@ WHERE EXISTS (
},
{
q: `select * from xy where exists (select * from uv) and x = 0`,
types: []plan.JoinType{plan.JoinTypeLookup},
types: []plan.JoinType{plan.JoinTypeCrossHash},
exp: []sql.Row{{0, 2}},
},
{
Expand All @@ -481,6 +481,31 @@ select * from xy where x in (
types: []plan.JoinType{plan.JoinTypeHash, plan.JoinTypeHash},
exp: []sql.Row{{1, 0}},
},
{
q: `
SELECT *
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is like an e e cummings poem

FROM xy
WHERE
EXISTS (
SELECT 1
FROM ab
WHERE
xy.x = ab.a AND
EXISTS (
SELECT 1
FROM uv
WHERE
ab.a = uv.v
)
)`,
types: []plan.JoinType{plan.JoinTypeLookup, plan.JoinTypeLookup},
exp: []sql.Row{{1, 0}, {2, 1}},
},
{
q: `select * from xy where exists (select * from uv join ab on u = a)`,
types: []plan.JoinType{plan.JoinTypeCrossHash, plan.JoinTypeMerge},
exp: []sql.Row{{0, 2}, {1, 0}, {2, 1}, {3, 3}},
},
},
},
{
Expand Down
Loading