Skip to content

Commit

Permalink
addressed review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <[email protected]>
  • Loading branch information
harshit-gangal committed Dec 12, 2023
1 parent b3b4edd commit 50bd269
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions go/vt/vtgate/planbuilder/operators/upsert.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,18 @@ func createUpsertOperator(ctx *plancontext.PlanningContext, ins *sqlparser.Inser

upsert := &Upsert{}
for _, row := range rows {
var whereExpr sqlparser.Expr
var comparisons []sqlparser.Expr
for _, pIdx := range pIndexes {
var expr sqlparser.Expr
if pIdx.idx == -1 {
expr = pIdx.def
} else {
expr = row[pIdx.idx]
}
equalExpr := sqlparser.NewComparisonExpr(sqlparser.EqualOp, sqlparser.NewColName(pIdx.col.String()), expr, nil)
whereExpr = sqlparser.AndExpressions(whereExpr, equalExpr)
comparisons = append(comparisons,
sqlparser.NewComparisonExpr(sqlparser.EqualOp, sqlparser.NewColName(pIdx.col.String()), expr, nil))
}
whereExpr := sqlparser.AndExpressions(comparisons...)

var updExprs sqlparser.UpdateExprs
for _, ue := range ins.OnDup {
Expand Down

0 comments on commit 50bd269

Please sign in to comment.