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

expression: check timezone when encoding timestamp datum #10303

Merged
merged 10 commits into from
Apr 30, 2019

Conversation

eurekaka
Copy link
Contributor

What problem does this PR solve?

Fix #10302

What is changed and how it works?

Convert timestamp datum to UTC timezone in encodeDatum, to make it compatible with encode and PBToExpr.

Note that in code of coprocessor, there exists timezone conversion logic as well, see https://github.com/tikv/tikv/blob/2e1e20f7ced72a3333c2504fa4bfb53b44fe4b8a/src/coprocessor/dag/expr/mod.rs#L254 for details, so this change is compatible with TiKV.

Check List

Tests

  • Unit test
  • Integration test: I will add an integration test to cover real TiKV in tidb-test repo.

Code changes

N/A

Side effects

N/A

Related changes

  • Need to cherry-pick to the release branch

@eurekaka
Copy link
Contributor Author

/run-all-tests

@eurekaka
Copy link
Contributor Author

/run-mybatis-test

@codecov
Copy link

codecov bot commented Apr 29, 2019

Codecov Report

Merging #10303 into master will decrease coverage by 0.0067%.
The diff coverage is 72%.

@@               Coverage Diff                @@
##             master     #10303        +/-   ##
================================================
- Coverage   77.6781%   77.6714%   -0.0068%     
================================================
  Files           411        411                
  Lines         85450      85451         +1     
================================================
- Hits          66376      66371         -5     
- Misses        14111      14118         +7     
+ Partials       4963       4962         -1

@eurekaka
Copy link
Contributor Author

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

Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

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

LGTM

expression/expr_to_pb.go Outdated Show resolved Hide resolved
@winoros
Copy link
Member

winoros commented Apr 29, 2019

/rebuild

@winoros
Copy link
Member

winoros commented Apr 29, 2019

@eurekaka there's a unit test failed in check_dev_2 though it passed in circle CI.

@eurekaka
Copy link
Contributor Author

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

1 similar comment
@zhouqiang-cl
Copy link
Contributor

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

@eurekaka eurekaka requested review from qw4990 and winoros April 30, 2019 02:49
Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

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

LGTM

@qw4990 qw4990 added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 30, 2019
@zimulala zimulala added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 30, 2019
@eurekaka eurekaka removed the status/LGT2 Indicates that a PR has LGTM 2. label Apr 30, 2019
@eurekaka eurekaka added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 30, 2019
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

@eurekaka eurekaka added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 30, 2019
@qw4990 qw4990 merged commit e8d9a3f into pingcap:master Apr 30, 2019
@eurekaka eurekaka deleted the timestamp_tz branch April 30, 2019 09:55
erjiaqing pushed a commit to erjiaqing/tidb that referenced this pull request May 5, 2019
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/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wrong result for query containing timestamp type
5 participants