Skip to content

Commit f994321

Browse files
committed
copy parent row when building row
1 parent de207f5 commit f994321

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sql/rowexec/join_iters.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ func (i *crossJoinIterator) Close(ctx *sql.Context) (err error) {
688688
return err
689689
}
690690

691-
// lateralJoinIter is an iterator that performs a lateral join.
691+
// lateralJoinIterator is an iterator that performs a lateral join.
692692
// A LateralJoin is a join where the right side is a subquery that can reference the left side, like through a filter.
693693
// MySQL Docs: https://dev.mysql.com/doc/refman/8.0/en/lateral-derived-tables.html
694694
// Example:
@@ -806,8 +806,9 @@ func (i *lateralJoinIterator) loadSecondary(ctx *sql.Context) error {
806806

807807
func (i *lateralJoinIterator) buildRow(primaryRow, secondaryRow sql.Row) sql.Row {
808808
row := make(sql.Row, i.rowSize)
809-
copy(row, primaryRow)
810-
copy(row[len(primaryRow):], secondaryRow)
809+
copy(row, i.parentRow)
810+
copy(row[len(i.parentRow):], primaryRow)
811+
copy(row[len(i.parentRow)+len(primaryRow):], secondaryRow)
811812
return row
812813
}
813814

0 commit comments

Comments
 (0)