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
18 changes: 18 additions & 0 deletions enginetest/queries/join_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1445,4 +1445,22 @@ LATERAL (
},
},
},
{
Name: "full outer join as child of cross join",
SetUpScript: []string{
"CREATE TABLE t1(c0 VARCHAR(500) , c1 INT , c2 BOOLEAN);",
"CREATE TABLE t2(c0 INT , c1 VARCHAR(500) , c2 BOOLEAN);",
"CREATE TABLE t3(c0 VARCHAR(500) , c1 INT);",
"INSERT INTO t1 VALUES ('UjhU', 9, TRUE);",
"INSERT INTO t2 VALUES (5, 'ao', TRUE);",
"INSERT INTO t3 VALUES ('4GD', 6);",
},
Assertions: []ScriptTestAssertion{
{
Query: "SELECT t2.c0, t2.c1, t2.c2 FROM t2 FULL OUTER JOIN t3 ON LEFT(t2.c1, 2) = t2.c1 CROSS JOIN (SELECT t1.c0 AS c0 FROM t1) AS vtable0;",
// TODO: possible type mismatch; 1 should be true
Expected: []sql.Row{{5, "ao", 1}},
},
},
},
}
5 changes: 3 additions & 2 deletions sql/rowexec/join_iters.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,9 @@ func (i *fullJoinIter) removeParentRow(r sql.Row) sql.Row {
// buildRow builds the result set row using the rows from the primary and secondary tables
func (i *fullJoinIter) buildRow(primary, secondary sql.Row) sql.Row {
row := make(sql.Row, i.rowSize)
copy(row, primary)
copy(row[len(primary):], secondary)
copy(row, i.parentRow)
copy(row[len(i.parentRow):], primary)
copy(row[len(i.parentRow)+len(primary):], secondary)
return row
}

Expand Down
Loading