Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: MaxOneRow operator should keep its promise #7375

Merged
merged 4 commits into from Aug 14, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions executor/executor.go
Expand Up @@ -899,11 +899,17 @@ func (e *MaxOneRowExec) Next(ctx context.Context, chk *chunk.Chunk) error {
chk.AppendNull(i)
}
return nil
} else if num == 1 {
return nil
} else if num != 1 {
return errors.New("subquery returns more than 1 row")
}

childChunk := e.children[0].newChunk()
err = e.children[0].Next(ctx, childChunk)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check this error?

if childChunk.NumRows() != 0 {
return errors.New("subquery returns more than 1 row")
}

return errors.New("subquery returns more than 1 row")
return nil
}

// UnionExec pulls all it's children's result and returns to its parent directly.
Expand Down