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: add some methods in BuildContext to read fields in SessionVars before #52367

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

lcwangchao
Copy link
Collaborator

@lcwangchao lcwangchao commented Apr 7, 2024

What problem does this PR solve?

Issue Number: close #52366

Problem Summary:

It's better to remove some methods like Value, SetValue or GetSessionVars in expression.BuildContext because these methods are too common and contain too many fields even they are not used in BuildContext. These methods makes it's hard to mock or build a standalone context without a session enviroment.

What changed and how does it work?

In this PR, we

  • Provide some methods in BuildContext to read the properties in SessionVars before to make sure we can remove GetSessionVars in the future.
  • Add a new interface AggFuncBuildContext to build aggregation functions.
  • Add a new interface ExprContext that can provide full context to build/eval all types of expressions.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

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

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 7, 2024
Copy link

tiprow bot commented Apr 7, 2024

Hi @lcwangchao. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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.

@lcwangchao lcwangchao force-pushed the build_ctx_1 branch 3 times, most recently from 97c8879 to 010a448 Compare April 7, 2024 06:02
Copy link

codecov bot commented Apr 7, 2024

Codecov Report

Merging #52367 (8c03d4e) into master (482ce59) will increase coverage by 0.4856%.
Report is 27 commits behind head on master.
The diff coverage is 94.3181%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #52367        +/-   ##
================================================
+ Coverage   74.0661%   74.5518%   +0.4856%     
================================================
  Files          1467       1467                
  Lines        354163     432094     +77931     
================================================
+ Hits         262315     322134     +59819     
- Misses        72606      90007     +17401     
- Partials      19242      19953       +711     
Flag Coverage Δ
integration 49.1245% <86.3636%> (?)
unit 71.2384% <88.6363%> (-1.5817%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (-2.3014%) ⬇️
parser ∅ <ø> (∅)
br 49.0475% <ø> (+6.8992%) ⬆️

@lcwangchao lcwangchao force-pushed the build_ctx_1 branch 2 times, most recently from 38e4bc7 to 406217c Compare April 7, 2024 09:35
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Apr 8, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 8, 2024
Copy link

ti-chi-bot bot commented Apr 8, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-04-08 07:58:20.029656984 +0000 UTC m=+862761.557197515: ☑️ agreed by XuHuaiyu.
  • 2024-04-08 08:02:51.937308944 +0000 UTC m=+863033.464849486: ☑️ agreed by lance6716.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Apr 8, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@lcwangchao lcwangchao requested a review from tangenta April 8, 2024 23:57
Copy link

ti-chi-bot bot commented Apr 9, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, tangenta, XuHuaiyu

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Apr 9, 2024
@ti-chi-bot ti-chi-bot bot merged commit 1905e89 into pingcap:master Apr 9, 2024
23 checks passed
@lcwangchao lcwangchao deleted the build_ctx_1 branch April 9, 2024 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove GetSessionVars and Value/GetValue in expression.BuildContext
4 participants