Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alivxxx committed Jan 7, 2019
1 parent 59c86e3 commit 313de1f
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions executor/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,29 @@ func (e *WindowExec) Next(ctx context.Context, chk *chunk.Chunk) error {
}

func (e *WindowExec) consumeOneGroup(ctx context.Context, chk *chunk.Chunk) error {
for !e.executed {
if err := e.fetchChildIfNecessary(ctx, chk); err != nil {
if err := e.fetchChildIfNecessary(ctx, chk); err != nil {
return errors.Trace(err)
}
for ; e.inputRow != e.inputIter.End(); e.inputRow = e.inputIter.Next() {
meetNewGroup, err := e.groupChecker.meetNewGroup(e.inputRow)
if err != nil {
return errors.Trace(err)
}
for ; e.inputRow != e.inputIter.End(); e.inputRow = e.inputIter.Next() {
meetNewGroup, err := e.groupChecker.meetNewGroup(e.inputRow)
if meetNewGroup {
err := e.consumeGroupRows(chk)
if err != nil {
return errors.Trace(err)
}
if meetNewGroup {
err := e.consumeGroupRows(chk)
if err != nil {
return errors.Trace(err)
}
err = e.appendResult2Chunk(chk)
if err != nil {
return errors.Trace(err)
}
}
e.groupRows = append(e.groupRows, e.inputRow)
if meetNewGroup {
e.inputRow = e.inputIter.Next()
return nil
err = e.appendResult2Chunk(chk)
if err != nil {
return errors.Trace(err)
}
}
e.groupRows = append(e.groupRows, e.inputRow)
if meetNewGroup {
e.inputRow = e.inputIter.Next()
return nil
}
}
return nil
}
Expand Down

0 comments on commit 313de1f

Please sign in to comment.