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

planner, executor: supports select statement with AS OF #24613

Merged
merged 44 commits into from
May 27, 2021

Conversation

nolouch
Copy link
Member

@nolouch nolouch commented May 13, 2021

Signed-off-by: nolouch [email protected]

What problem does this PR solve?

Ref: #24557
Problem Summary:

Implement the syntax Select .... FROM xxx AS OF timestamp xxx with stale read.

What is changed and how it works?

the planner should visit the as of clause and extract the tso.

Check List

Tests

  • Unit test
  • Integration test

Release note

  • make select statements support stale read

@ti-chi-bot ti-chi-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 13, 2021
@nolouch nolouch changed the title planner, exector: supports select statement with AS OF planner, executor: supports select statement with AS OF May 13, 2021
@github-actions github-actions bot added sig/execution SIG execution sig/planner SIG: Planner labels May 13, 2021
Signed-off-by: nolouch <[email protected]>
planner/core/logical_plan_builder.go Outdated Show resolved Hide resolved
planner/core/logical_plan_builder.go Outdated Show resolved Hide resolved
Signed-off-by: nolouch <[email protected]>
Signed-off-by: nolouch <[email protected]>
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 13, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 16, 2021
@nolouch nolouch marked this pull request as ready for review May 16, 2021 21:50
@nolouch nolouch requested review from a team as code owners May 16, 2021 21:50
@nolouch nolouch requested review from XuHuaiyu and removed request for a team May 16, 2021 21:50
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 16, 2021
@nolouch
Copy link
Member Author

nolouch commented May 17, 2021

planner/optimize.go Outdated Show resolved Hide resolved
planner/core/logical_plan_builder.go Outdated Show resolved Hide resolved
planner/core/logical_plan_builder.go Outdated Show resolved Hide resolved
Copy link
Contributor

@xhebox xhebox left a comment

Choose a reason for hiding this comment

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

LGTM, expect that I am not sure if handles nested select stmt well. I doubt that it needs to be recursively called.

executor/stale_txn_test.go Outdated Show resolved Hide resolved
executor/stale_txn_test.go Outdated Show resolved Hide resolved
executor/stale_txn_test.go Outdated Show resolved Hide resolved
planner/core/logical_plan_builder.go Outdated Show resolved Hide resolved
planner/core/logical_plan_builder.go Outdated Show resolved Hide resolved
planner/optimize.go Outdated Show resolved Hide resolved
Signed-off-by: nolouch <[email protected]>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 26, 2021
@nolouch
Copy link
Member Author

nolouch commented May 26, 2021

/run-all-tests

@purelind
Copy link
Contributor

/run-unit-test

@purelind
Copy link
Contributor

/run-sqllogic-test

@ti-chi-bot
Copy link
Member

@JmPotato: Thanks for your review. The bot only counts /lgtm from reviewers and higher roles in list, but you're still welcome to leave your comments.

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 ti-community-infra/tichi repository.

planner/optimize.go Outdated Show resolved Hide resolved
planner/core/errors.go Show resolved Hide resolved
planner/core/common_plans.go Outdated Show resolved Hide resolved
executor/prepared.go Show resolved Hide resolved
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Yisaer
  • winoros

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@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 May 27, 2021
@winoros
Copy link
Member

winoros commented May 27, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: c7a8a96

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

/run-all-tests

This bot automatically retries jobs that failed on can merge PRs (send feedback to hi-rustin).

Silence the bot with the /merge cancel comment for consistent failures.

@ti-chi-bot
Copy link
Member

@nolouch: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

/run-all-tests

This bot automatically retries jobs that failed on can merge PRs (send feedback to hi-rustin).

Silence the bot with the /merge cancel comment for consistent failures.

@nolouch
Copy link
Member Author

nolouch commented May 27, 2021

/merge

@ti-chi-bot
Copy link
Member

@nolouch: /merge is only allowed for the committers, you can assign this pull request to the committer in list by filling /assign @committer in the comment to help merge this pull request.

In response to this:

/merge

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit f3557bb into pingcap:master May 27, 2021
@nolouch nolouch deleted the stale-select branch May 27, 2021 13:12
@@ -1309,7 +1309,7 @@ func (s *testPlanSuite) TestVisitInfo(c *C) {
stmt, err := s.ParseOneStmt(tt.sql, "", "")
c.Assert(err, IsNil, comment)
// to fix, Table 'test.ttt' doesn't exist
_ = Preprocess(s.ctx, stmt, s.is)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
builder, _ := NewPlanBuilder(MockContext(), s.is, &hint.BlockHintProcessor{})
Copy link
Contributor

Choose a reason for hiding this comment

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

You forgot to check err here.
Try run make check before every commit.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, errcheck will ignore test files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression component/statistics sig/execution SIG execution sig/planner SIG: Planner sig/sql-infra SIG: SQL Infra size/XL Denotes a PR that changes 500-999 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.

9 participants