Skip to content

Commit

Permalink
executor: support Chunk for SetExecutor (pingcap#5397)
Browse files Browse the repository at this point in the history
  • Loading branch information
zz-jason authored and coocood committed Dec 14, 2017
1 parent 81ffef9 commit d209a36
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,12 @@ func (b *executorBuilder) buildSimple(v *plan.Simple) Executor {
}

func (b *executorBuilder) buildSet(v *plan.Set) Executor {
return &SetExecutor{
e := &SetExecutor{
baseExecutor: newBaseExecutor(v.Schema(), b.ctx),
vars: v.VarAssigns,
}
e.supportChk = true
return e
}

func (b *executorBuilder) buildInsert(v *plan.Insert) Executor {
Expand Down
12 changes: 12 additions & 0 deletions executor/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/pingcap/tidb/terror"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/charset"
"github.com/pingcap/tidb/util/chunk"
"github.com/pingcap/tidb/util/sqlexec"
goctx "golang.org/x/net/context"
)
Expand All @@ -55,6 +56,17 @@ func (e *SetExecutor) Next(goCtx goctx.Context) (Row, error) {
return nil, nil
}

// NextChunk implements the Executor NextChunk interface.
func (e *SetExecutor) NextChunk(goCtx goctx.Context, chk *chunk.Chunk) error {
chk.Reset()
if !e.done {
e.done = true
err := e.executeSet()
return errors.Trace(err)
}
return nil
}

func (e *SetExecutor) executeSet() error {
sessionVars := e.ctx.GetSessionVars()
for _, v := range e.vars {
Expand Down

0 comments on commit d209a36

Please sign in to comment.