Skip to content

Commit 5b77924

Browse files
[release-20.0] Bugfix: Missing data when running vtgate outer joins (vitessio#18036) (vitessio#18043)
Signed-off-by: Andres Taylor <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
1 parent 7bdb74f commit 5b77924

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

go/test/endtoend/vtgate/queries/misc/misc_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,21 @@ func TestStraightJoin(t *testing.T) {
530530
require.Contains(t, fmt.Sprintf("%v", res.Rows), "t1_tbl")
531531
}
532532

533+
func TestFailingOuterJoinInOLAP(t *testing.T) {
534+
// This query was returning different results in MySQL and Vitess
535+
mcmp, closer := start(t)
536+
defer closer()
537+
538+
// Insert data into the 2 tables
539+
mcmp.Exec("insert into t1(id1, id2) values (1,2), (5, 42)")
540+
mcmp.Exec("insert into tbl(id, unq_col, nonunq_col) values (1,2,3), (2,5,3)")
541+
542+
utils.Exec(t, mcmp.VtConn, "set workload = olap")
543+
544+
// This query was
545+
mcmp.Exec("select t1.id1 from t1 left join tbl on t1.id2 = tbl.nonunq_col")
546+
}
547+
533548
func TestColumnAliases(t *testing.T) {
534549
mcmp, closer := start(t)
535550
defer closer()

go/vt/vtgate/engine/join.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ func (jn *Join) TryStreamExecute(ctx context.Context, vcursor VCursor, bindVars
166166
nil,
167167
jn.Cols,
168168
)}
169-
return callback(result)
169+
170+
if err := callback(result); err != nil {
171+
return err
172+
}
170173
}
171174
}
172175
// This needs to be locking since it's not safe to just use

0 commit comments

Comments
 (0)