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

types: fix fsp for datetime, time and timestamp #27170

Merged
merged 6 commits into from
Aug 16, 2021

Conversation

wjhuang2016
Copy link
Member

@wjhuang2016 wjhuang2016 commented Aug 12, 2021

Signed-off-by: wjhuang2016 [email protected]

What problem does this PR solve?

Issue Number: close #27159

Problem Summary:
If the decimal is unspecified, we should use the maxFsp, which is compatible with what we do for function.

What is changed and how it works?

If the decimal is unspecified, we should use the maxFsp, which is compatible with what we do for function.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

 'None' 

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 12, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • AilinKid
  • tangenta

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 12, 2021
@ichn-hu ichn-hu mentioned this pull request Aug 12, 2021
@morgo
Copy link
Contributor

morgo commented Aug 13, 2021

It looks like this test is related:


[2021-08-12T14:19:49.458Z] FAIL: convert_test.go:590: testTypeConvertSuite.TestConvert

[2021-08-12T14:19:49.458Z] 

[2021-08-12T14:19:49.458Z] convert_test.go:744:

[2021-08-12T14:19:49.458Z]     signedAccept(c, mysql.TypeDatetime, NewDecFromFloatForTest(20010101100000.123456), "2001-01-01 10:00:00")

[2021-08-12T14:19:49.458Z] convert_test.go:548:

[2021-08-12T14:19:49.458Z]     c.Assert(str, Equals, expected)

[2021-08-12T14:19:49.458Z] ... obtained string = "2001-01-01 10:00:00.125000"

[2021-08-12T14:19:49.458Z] ... expected string = "2001-01-01 10:00:00"

@wjhuang2016
Copy link
Member Author

It looks like this test is related:


[2021-08-12T14:19:49.458Z] FAIL: convert_test.go:590: testTypeConvertSuite.TestConvert

[2021-08-12T14:19:49.458Z] 

[2021-08-12T14:19:49.458Z] convert_test.go:744:

[2021-08-12T14:19:49.458Z]     signedAccept(c, mysql.TypeDatetime, NewDecFromFloatForTest(20010101100000.123456), "2001-01-01 10:00:00")

[2021-08-12T14:19:49.458Z] convert_test.go:548:

[2021-08-12T14:19:49.458Z]     c.Assert(str, Equals, expected)

[2021-08-12T14:19:49.458Z] ... obtained string = "2001-01-01 10:00:00.125000"

[2021-08-12T14:19:49.458Z] ... expected string = "2001-01-01 10:00:00"

Yeah, I am thinking about whether set the decimal to 0 or just change the result.

@ti-chi-bot ti-chi-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 13, 2021
@wjhuang2016 wjhuang2016 changed the title types: fix datetime fsp types: fix fsp for datetime, time and timestamp Aug 13, 2021
@wjhuang2016
Copy link
Member Author

/run-check_dev_2

types/datum.go Outdated
@@ -1122,7 +1122,7 @@ func (d *Datum) convertToMysqlTimestamp(sc *stmtctx.StatementContext, target *Fi
t Time
err error
)
fsp := DefaultFsp
fsp := MaxFsp
Copy link
Contributor

@AilinKid AilinKid Aug 13, 2021

Choose a reason for hiding this comment

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

this change will cause some automated-test/mysql-test fail, be cautious with that since no CI tests for now

Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

Rest LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 13, 2021
@tangenta
Copy link
Contributor

Why do you write integration tests in the explain_test? 😕

@wjhuang2016
Copy link
Member Author

Why do you write integration tests in the explain_test? 😕

Let's forget its name. We should take it as mysql_test

@wjhuang2016
Copy link
Member Author

/run-common-test

1 similar comment
@wjhuang2016
Copy link
Member Author

/run-common-test

@tangenta
Copy link
Contributor

I can't forget its name :)

Signed-off-by: wjhuang2016 <[email protected]>
@ti-chi-bot ti-chi-bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 13, 2021
@wjhuang2016 wjhuang2016 reopened this Aug 13, 2021
@ti-chi-bot ti-chi-bot removed the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 13, 2021
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 13, 2021
@wjhuang2016
Copy link
Member Author

/run-common-test

@wjhuang2016
Copy link
Member Author

I can't forget its name :)

It's suggested by @zz-jason that we should add the tests into mysql-test instead of integration_test, I think it's a good idea. You can refer to cte.t and select.t in this folder.

@github-actions github-actions bot added the sig/sql-infra SIG: SQL Infra label Aug 13, 2021
@wjhuang2016
Copy link
Member Author

/run-common-test

Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

/LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Aug 16, 2021
@wjhuang2016
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: bd42281

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 16, 2021
@wjhuang2016
Copy link
Member Author

/run-all-tests

1 similar comment
@wjhuang2016
Copy link
Member Author

/run-all-tests

@wjhuang2016
Copy link
Member Author

/run-build

@wjhuang2016
Copy link
Member Author

/run-check_dev_2

@ti-chi-bot ti-chi-bot merged commit 5ae87ca into pingcap:master Aug 16, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 16, 2021
@ti-srebot
Copy link
Contributor

cherry pick to release-5.2 in PR #27243

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression needs-cherry-pick-release-5.2 release-note-none Denotes a PR that doesn't merit a release note. sig/sql-infra SIG: SQL Infra size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

got wrong result while use expression index
6 participants