diff --git a/expression/in.go b/expression/in.go index 1523aa348b324..3edc30a131bdf 100644 --- a/expression/in.go +++ b/expression/in.go @@ -142,14 +142,15 @@ func (n *PatternIn) Eval(ctx context.Context, args map[interface{}]interface{}) } if n.Sel == nil { - if err := hasSameColumnCount(ctx, n.Expr, n.List...); err != nil { - return nil, errors.Trace(err) + err1 := hasSameColumnCount(ctx, n.Expr, n.List...) + if err1 != nil { + return nil, errors.Trace(err1) } var values []interface{} - values, err = evalExprList(ctx, args, n.List) - if err != nil { - return nil, errors.Trace(err) + values, err1 = evalExprList(ctx, args, n.List) + if err1 != nil { + return nil, errors.Trace(err1) } return n.checkInList(lhs, values) diff --git a/expression/isnull.go b/expression/isnull.go index 428777761a676..13bba740e00d7 100644 --- a/expression/isnull.go +++ b/expression/isnull.go @@ -54,14 +54,14 @@ func (is *IsNull) String() string { } // Eval implements the Expression Eval interface. -func (is *IsNull) Eval(ctx context.Context, args map[interface{}]interface{}) (v interface{}, err error) { +func (is *IsNull) Eval(ctx context.Context, args map[interface{}]interface{}) (interface{}, error) { if err := CheckOneColumn(ctx, is.Expr); err != nil { return nil, errors.Trace(err) } val, err := is.Expr.Eval(ctx, args) if err != nil { - return + return nil, errors.Trace(err) } return types.IsNil(val) != is.Not, nil diff --git a/expression/istruth.go b/expression/istruth.go index 5df1f43fa389c..61b2bfebd5a50 100644 --- a/expression/istruth.go +++ b/expression/istruth.go @@ -63,14 +63,14 @@ func (is *IsTruth) String() string { } // Eval implements the Expression Eval interface. -func (is *IsTruth) Eval(ctx context.Context, args map[interface{}]interface{}) (v interface{}, err error) { +func (is *IsTruth) Eval(ctx context.Context, args map[interface{}]interface{}) (interface{}, error) { if err := CheckOneColumn(ctx, is.Expr); err != nil { return nil, errors.Trace(err) } val, err := is.Expr.Eval(ctx, args) if err != nil { - return + return nil, errors.Trace(err) } if types.IsNil(val) { @@ -81,7 +81,7 @@ func (is *IsTruth) Eval(ctx context.Context, args map[interface{}]interface{}) ( b, err := types.ToBool(val) if err != nil { - return + return nil, errors.Trace(err) } if !is.Not { diff --git a/interpreter/main.go b/interpreter/main.go index 95d6f00c89020..e679defd39495 100644 --- a/interpreter/main.go +++ b/interpreter/main.go @@ -205,7 +205,7 @@ func main() { } if strings.HasPrefix(txnLine, "COMMIT") || strings.HasPrefix(txnLine, "commit") { - err := tx.Commit() + err = tx.Commit() if err != nil { log.Error(errors.ErrorStack(err)) tx.Rollback() diff --git a/plan/plans/groupby.go b/plan/plans/groupby.go index ffdba3e5f0890..8e224a6518e74 100644 --- a/plan/plans/groupby.go +++ b/plan/plans/groupby.go @@ -275,14 +275,14 @@ func (r *GroupByDefaultPlan) fetchAll(ctx context.Context) error { // TODO: later order by will use the same mechanism, so we may use another plan to do this evalArgs := map[interface{}]interface{}{} // must first eval none aggregate fields, because alias group by will use this. - if err := r.evalNoneAggFields(ctx, row.Data, evalArgs, srcRow.Data); err != nil { + if err = r.evalNoneAggFields(ctx, row.Data, evalArgs, srcRow.Data); err != nil { return errors.Trace(err) } // update outer query becuase group by may use it if it has a subquery. updateRowStack(ctx, row.Data, row.FromData) - if err := r.evalGroupKey(ctx, k, row.Data, srcRow.Data); err != nil { + if err = r.evalGroupKey(ctx, k, row.Data, srcRow.Data); err != nil { return errors.Trace(err) } @@ -298,7 +298,7 @@ func (r *GroupByDefaultPlan) fetchAll(ctx context.Context) error { index = len(r.rows) r.rows = append(r.rows, &groupRow{Row: row, Args: evalArgs}) - if err := t.Set(k, []interface{}{index}); err != nil { + if err = t.Set(k, []interface{}{index}); err != nil { return errors.Trace(err) } } else { @@ -310,7 +310,7 @@ func (r *GroupByDefaultPlan) fetchAll(ctx context.Context) error { } // eval aggregate fields - if err := r.evalAggFields(ctx, row.Data, evalArgs, srcRow.Data); err != nil { + if err = r.evalAggFields(ctx, row.Data, evalArgs, srcRow.Data); err != nil { return errors.Trace(err) } } @@ -326,7 +326,7 @@ func (r *GroupByDefaultPlan) fetchAll(ctx context.Context) error { } else { for _, row := range r.rows { // eval aggregate done - if err := r.evalAggDone(ctx, row.Row.Data, row.Args); err != nil { + if err = r.evalAggDone(ctx, row.Row.Data, row.Args); err != nil { return errors.Trace(err) } } diff --git a/rset/rsets/join.go b/rset/rsets/join.go index 8d343cd51b7cd..bc63556ef07a9 100644 --- a/rset/rsets/join.go +++ b/rset/rsets/join.go @@ -214,7 +214,7 @@ func (r *JoinRset) buildSourcePlan(ctx context.Context, t *TableSource) (plan.Pl return nil, nil, errors.Trace(err) } src = tr - if err := r.checkTableDuplicate(t, tr); err != nil { + if err = r.checkTableDuplicate(t, tr); err != nil { return nil, nil, errors.Trace(err) } case stmt.Statement: diff --git a/table/tables/tables.go b/table/tables/tables.go index 8e917545ede3e..f3acf3d1ccd4f 100644 --- a/table/tables/tables.go +++ b/table/tables/tables.go @@ -470,7 +470,7 @@ func (t *Table) removeRowData(ctx context.Context, h int64) error { // Remove row's colume one by one for _, col := range t.Cols() { k := t.RecordKey(h, col) - err := txn.Delete([]byte(k)) + err = txn.Delete([]byte(k)) if err != nil { return errors.Trace(err) }