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: refine the precision for avg #7860

Merged
merged 3 commits into from
Oct 11, 2018
Merged

Conversation

XuHuaiyu
Copy link
Contributor

@XuHuaiyu XuHuaiyu commented Oct 10, 2018

What problem does this PR solve?

This commit ports the old logic for handling decimal avg result .

What is changed and how it works?

  1. Set the finalResult.RetTp.Decimal to the result of type inferring when appendFinalResult2Chunk for avg.
  2. Set the finalResult.RetTp.Decimal to 0 when the input argument is integer type for sum.

Check List

https://github.com/pingcap/tidb-test/pull/634

Code changes

  • Has exported function/method change

Side effects

N/A

Related changes

  • Need to cherry-pick to the release branch

@XuHuaiyu
Copy link
Contributor Author

/run-all-tests tidb-test=pr/634

@XuHuaiyu
Copy link
Contributor Author

/run-common-test tidb-test=pr/634
/run-integration-common-test tidb-test=pr/634

@XuHuaiyu XuHuaiyu added type/enhancement The issue or PR belongs to an enhancement. component/expression and removed status/WIP labels Oct 11, 2018
@XuHuaiyu
Copy link
Contributor Author

PTAL @winoros @zz-jason

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason
Copy link
Member

/run-all-tests tidb-test=pr/634

@winoros
Copy link
Member

winoros commented Oct 11, 2018

BTW, do we need to change SUM's?

Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

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

lgtm

@XuHuaiyu
Copy link
Contributor Author

@winoros
Maybe we should, I'll investigate it.
But it's better to push another to do this.

@XuHuaiyu XuHuaiyu added the status/LGT2 Indicates that a PR has LGTM 2. label Oct 11, 2018
@XuHuaiyu XuHuaiyu merged commit f3a9390 into pingcap:master Oct 11, 2018
@XuHuaiyu XuHuaiyu deleted the avg_precision branch October 11, 2018 06:52
XuHuaiyu added a commit to XuHuaiyu/tidb that referenced this pull request Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants