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: BuildContext
read location from EvalContext
instead of SessionVars
#52451
Conversation
Hi @lcwangchao. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -72,6 +72,7 @@ func (sg *Pool) Get() (sessionctx.Context, error) { | |||
} | |||
ctx.GetSessionVars().SetStatusFlag(mysql.ServerStatusAutocommit, true) | |||
ctx.GetSessionVars().InRestrictedSQL = true | |||
ctx.GetSessionVars().StmtCtx.SetTimeZone(ctx.GetSessionVars().Location()) |
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.
To make sure the timezone info are the same in session and statement context. PTAL @tangenta
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
tc := ctx.TypeCtx() | ||
tcLoc := tc.Location().String() |
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.
We moved most asserts to SessionEvalContext
. So we only need to check the Expression.Location()
and EvalContext.TypeCtx().Locaion()
are the same
a15d638
to
c3b1252
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #52451 +/- ##
================================================
+ Coverage 72.1286% 74.8870% +2.7584%
================================================
Files 1467 1493 +26
Lines 426911 442103 +15192
================================================
+ Hits 307925 331078 +23153
+ Misses 99739 90578 -9161
- Partials 19247 20447 +1200
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
c3b1252
to
e37338a
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hawkingrei, tangenta, XuHuaiyu, YangKeao The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
…f `SessionVars` (pingcap#52451) ref pingcap#52366
What problem does this PR solve?
Issue Number: ref #52366
Problem Summary:
Some codes are using
BuildContext.GetSessionVars().Location()
to read the time zone info. Because we are going to removeGetSessionVars
in the future, it's better to replace it withBuildContext.Location()
.We should notice that
SessionVars.Location()
reads the timezone info from another place that is different fromBuildContext.Location()
. When replacing it, we should ensure they are same to avoid to introduce new bugs.What changed and how does it work?
BuildContext.GetSessionVars().Location()
withBuildContext.Location()
.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.