-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: fix group_concat when chunk size is set to 1 #7328
Conversation
@XuHuaiyu The 800+ line change is all to fix the problem described in title? |
@XuHuaiyu can you remove the irrelevant changes so that we can be focused on the bugfix itself and merge this PR as soon as possible? |
bf77539
to
29d5fec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
PTAL @zz-jason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
/run-all-tests |
What have you changed? (mandatory)
Before this PR, the following sql would return wrong result.
The PR fix the problem:
How does this bug occur?
This bug is caused by this line.
When max_chunk_size is set to 1, rowInGroup pass into the function
contains only 1 row every time. As we can see, separator be appended
here would be truncated out of the loop.
How does this bug be fixed?
This commit first check whether
p.buffer != nil
, which means we'vegot part of the result for a group, if it's true, we'll append separator at
the end of p.buffer. Through this, we can avoid truncating separator
wrongly. Then we append the string be consist of the values. If
this string is null, we'll truncated the separator which is appended at
the first.
What is the type of the changes? (mandatory)
Bug-fix
How has this PR been tested? (mandatory)
unit test
Does this PR affect documentation (docs/docs-cn) update? (mandatory)
Does this PR affect tidb-ansible update? (mandatory)
no
Does this PR need to be added to the release notes? (mandatory)
no
Refer to a related PR or issue link (optional)
Benchmark result if necessary (optional)
Add a few positive/negative examples (optional)