From 15d080a35b8c9a8a971102757a4a36e9edee6a6e Mon Sep 17 00:00:00 2001 From: Andres Taylor Date: Mon, 28 Oct 2024 12:00:34 +0100 Subject: [PATCH] feat: handle error from predicate skipping Signed-off-by: Andres Taylor --- go/vt/vtgate/planbuilder/operators/SQL_builder.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/go/vt/vtgate/planbuilder/operators/SQL_builder.go b/go/vt/vtgate/planbuilder/operators/SQL_builder.go index e2ccf41d028..f21ac58c8f2 100644 --- a/go/vt/vtgate/planbuilder/operators/SQL_builder.go +++ b/go/vt/vtgate/planbuilder/operators/SQL_builder.go @@ -564,14 +564,20 @@ func buildProjection(op *Projection, qb *queryBuilder) error { } func buildApplyJoin(op *ApplyJoin, qb *queryBuilder) error { - predicates := slice.Map(op.JoinPredicates, func(jc JoinColumn) sqlparser.Expr { + predicates, err := slice.MapWithError(op.JoinPredicates, func(jc JoinColumn) (sqlparser.Expr, error) { // since we are adding these join predicates, we need to mark to broken up version (RHSExpr) of it as done - _ = qb.ctx.SkipJoinPredicates(jc.Original.Expr) - return jc.Original.Expr + err := qb.ctx.SkipJoinPredicates(jc.Original.Expr) + if err != nil { + return nil, err + } + return jc.Original.Expr, nil }) + if err != nil { + return err + } pred := sqlparser.AndExpressions(predicates...) - err := buildQuery(op.LHS, qb) + err = buildQuery(op.LHS, qb) if err != nil { return err }