Skip to content

Commit

Permalink
*: remove SupportChunk() from interface ResultSet and RecordSet (ping…
Browse files Browse the repository at this point in the history
  • Loading branch information
XuHuaiyu authored and coocood committed Mar 7, 2018
1 parent 096562e commit 913db28
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 22 deletions.
3 changes: 0 additions & 3 deletions ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ type RecordSet interface {
// NewChunk creates a new chunk with initial capacity.
NewChunk() *chunk.Chunk

// SupportChunk check if the RecordSet supports Chunk structure.
SupportChunk() bool

// Close closes the underlying iterator, call Next after Close will
// restart the iteration.
Close() error
Expand Down
4 changes: 0 additions & 4 deletions executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ func (a *recordSet) NewChunk() *chunk.Chunk {
return chunk.NewChunk(a.executor.retTypes())
}

func (a *recordSet) SupportChunk() bool {
return true
}

func (a *recordSet) Close() error {
err := a.executor.Close()
a.stmt.logSlowQuery(a.txnStartTS, a.lastErr == nil)
Expand Down
2 changes: 1 addition & 1 deletion server/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ func (cc *clientConn) writeResultset(ctx context.Context, rs ResultSet, binary b
buf = buf[:stackSize]
log.Errorf("query: %s:\n%s", cc.lastCmd, buf)
}()
if cc.server.cfg.EnableChunk && rs.SupportChunk() {
if cc.server.cfg.EnableChunk {
err := cc.writeChunks(ctx, rs, binary, more)
if err != nil {
return errors.Trace(err)
Expand Down
1 change: 0 additions & 1 deletion server/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ type PreparedStatement interface {
type ResultSet interface {
Columns() []*ColumnInfo
Next(context.Context) (types.Row, error)
SupportChunk() bool
NewChunk() *chunk.Chunk
NextChunk(context.Context, *chunk.Chunk) error
Close() error
Expand Down
4 changes: 0 additions & 4 deletions server/driver_tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,6 @@ func (trs *tidbResultSet) NextChunk(ctx context.Context, chk *chunk.Chunk) error
return trs.recordSet.NextChunk(ctx, chk)
}

func (trs *tidbResultSet) SupportChunk() bool {
return trs.recordSet.SupportChunk()
}

func (trs *tidbResultSet) Close() error {
return trs.recordSet.Close()
}
Expand Down
4 changes: 0 additions & 4 deletions statistics/statistics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ func (r *recordSet) NewChunk() *chunk.Chunk {
return chunk.NewChunk(fields)
}

func (r *recordSet) SupportChunk() bool {
return true
}

func (r *recordSet) Close() error {
r.cursor = 0
return nil
Expand Down
4 changes: 0 additions & 4 deletions store/mockstore/mocktikv/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,6 @@ func (e *analyzeColumnsExec) NewChunk() *chunk.Chunk {
return chunk.NewChunk(fields)
}

func (e *analyzeColumnsExec) SupportChunk() bool {
return true
}

// Close implements the ast.RecordSet Close interface.
func (e *analyzeColumnsExec) Close() error {
return nil
Expand Down
2 changes: 1 addition & 1 deletion tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func GetRows4Test(ctx context.Context, sctx sessionctx.Context, rs ast.RecordSet
return nil, nil
}
var rows []types.Row
if sctx.GetSessionVars().EnableChunk && rs.SupportChunk() {
if sctx.GetSessionVars().EnableChunk {
for {
// Since we collect all the rows, we can not reuse the chunk.
chk := rs.NewChunk()
Expand Down

0 comments on commit 913db28

Please sign in to comment.