Skip to content

Commit

Permalink
executor: break innerTable fetcher is error happend during fetching o…
Browse files Browse the repository at this point in the history
…uter table (#7554)
  • Loading branch information
XuHuaiyu authored Aug 30, 2018
1 parent 4df2c7e commit 5823fb5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions executor/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ func (e *HashJoinExec) Close() error {
close(e.closeCh)
e.finished.Store(true)
if e.prepared {
if e.innerFinished != nil {
for range e.innerFinished {
}
}
if e.joinResultCh != nil {
for range e.joinResultCh {
}
Expand Down Expand Up @@ -264,6 +268,9 @@ func (e *HashJoinExec) fetchInnerRows(ctx context.Context) (err error) {
e.innerResult.GetMemTracker().AttachTo(e.memTracker)
e.innerResult.GetMemTracker().SetLabel("innerResult")
for {
if e.finished.Load().(bool) {
return nil
}
chk := e.children[e.innerIdx].newChunk()
err = e.innerExec.Next(ctx, chk)
if err != nil || chk.NumRows() == 0 {
Expand Down Expand Up @@ -511,6 +518,10 @@ func (e *HashJoinExec) fetchInnerAndBuildHashTable(ctx context.Context) {
return
}

if e.finished.Load().(bool) {
return
}

if err := e.buildHashTableForList(); err != nil {
e.innerFinished <- errors.Trace(err)
return
Expand All @@ -533,6 +544,9 @@ func (e *HashJoinExec) buildHashTableForList() error {
valBuf = make([]byte, 8)
)
for i := 0; i < e.innerResult.NumChunks(); i++ {
if e.finished.Load().(bool) {
return nil
}
chk := e.innerResult.GetChunk(i)
for j := 0; j < chk.NumRows(); j++ {
hasNull, keyBuf, err = e.getJoinKeyFromChkRow(false, chk.GetRow(j), keyBuf)
Expand Down

0 comments on commit 5823fb5

Please sign in to comment.