@@ -20,6 +20,7 @@ import (
2020 "io"
2121 "reflect"
2222
23+ "github.com/sirupsen/logrus"
2324 "go.opentelemetry.io/otel/attribute"
2425 "go.opentelemetry.io/otel/trace"
2526
@@ -405,6 +406,7 @@ func (i *existsIter) Close(ctx *sql.Context) (err error) {
405406}
406407
407408func newFullJoinIter (ctx * sql.Context , b sql.NodeExecBuilder , j * plan.JoinNode , row sql.Row ) (sql.RowIter , error ) {
409+ logrus .Info ("full_join_prefix: Creating new full join iterator" )
408410 leftIter , err := b .Build (ctx , j .Left (), row )
409411 if err != nil {
410412 return nil , err
@@ -447,11 +449,13 @@ type fullJoinIter struct {
447449func (i * fullJoinIter ) Next (ctx * sql.Context ) (sql.Row , error ) {
448450 for {
449451 if i .leftDone {
452+ logrus .Info ("full_join_prefix: Left side finished, entering right-only phase" )
450453 break
451454 }
452455 if i .leftRow == nil {
453456 r , err := i .l .Next (ctx )
454457 if errors .Is (err , io .EOF ) {
458+ logrus .Info ("full_join_prefix: Left side exhausted, no more left rows" )
455459 i .leftDone = true
456460 i .l = nil
457461 i .r = nil
@@ -487,6 +491,10 @@ func (i *fullJoinIter) Next(ctx *sql.Context) (sql.Row, error) {
487491 }
488492 i .r = nil
489493 i .leftRow = nil
494+ continue
495+ }
496+ if err != nil {
497+ return nil , err
490498 }
491499
492500 row := i .buildRow (i .leftRow , rightRow )
@@ -512,7 +520,8 @@ func (i *fullJoinIter) Next(ctx *sql.Context) (sql.Row, error) {
512520
513521 for {
514522 if i .r == nil {
515- iter , err := i .b .Build (ctx , i .rp , i .leftRow )
523+ logrus .Info ("full_join_prefix: Building right iterator for unmatched right rows" )
524+ iter , err := i .b .Build (ctx , i .rp , i .parentRow )
516525 if err != nil {
517526 return nil , err
518527 }
0 commit comments