Skip to content

[gen4 planner] Move more horizon planning to operators#12750

Merged
systay merged 10 commits intovitessio:mainfrom
planetscale:move-more-horizon
Mar 30, 2023
Merged

[gen4 planner] Move more horizon planning to operators#12750
systay merged 10 commits intovitessio:mainfrom
planetscale:move-more-horizon

Conversation

@systay
Copy link
Copy Markdown
Collaborator

@systay systay commented Mar 29, 2023

Description

While planning, we use two important types of data structures - logical plans and operators. We are moving more and more logic over to the operators. This PR moves planning of projections over to the operators.

Still to do is: ordering, limit, distinct and aggregation.

Related Issue(s)

Tracking issue: #11626

Other PRs in this series: #11622, #11680, #12506

systay added 4 commits March 29, 2023 09:18
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@vitess-bot vitess-bot bot added NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says labels Mar 29, 2023
@vitess-bot
Copy link
Copy Markdown
Contributor

vitess-bot bot commented Mar 29, 2023

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • If this is a change that users need to know about, please apply the release notes (needs details) label so that merging is blocked unless the summary release notes document is included.
  • If a test is added or modified, there should be a documentation on top of the test to explain what the expected behavior is what the test does.

If a new flag is being introduced:

  • Is it really necessary to add this flag?
  • Flag names should be clear and intuitive (as far as possible)
  • Help text should be descriptive.
  • Flag names should use dashes (-) as word separators rather than underscores (_).

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow should be required, the maintainer team should be notified.

Bug fixes

  • There should be at least one unit or end-to-end test.
  • The Pull Request description should include a link to an issue that describes the bug.

Non-trivial changes

  • There should be some code comments as to why things are implemented the way they are.

New/Existing features

  • Should be documented, either by modifying the existing documentation or creating new documentation.
  • New features should have a link to a feature request issue or an RFC that documents the use cases, corner cases and test cases.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • vtctl command output order should be stable and awk-able.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from VTop, if used there.

@systay systay added Type: Internal Cleanup Component: Query Serving Skip CI Skip CI actions from running NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says labels Mar 29, 2023
systay added 3 commits March 29, 2023 09:33
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay systay removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work Skip CI Skip CI actions from running labels Mar 29, 2023
Signed-off-by: Andres Taylor <andres@planetscale.com>
@systay systay force-pushed the move-more-horizon branch from b8e8882 to e97f05e Compare March 29, 2023 14:29
@systay systay marked this pull request as ready for review March 29, 2023 14:29
@systay systay changed the title Move more horizon [gen4 planner] Move more horizon planning to operators Mar 29, 2023
Signed-off-by: Andres Taylor <andres@planetscale.com>
Copy link
Copy Markdown
Member

@frouioui frouioui left a comment

Choose a reason for hiding this comment

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

Left some comments and question, otherwise it looks good to me! This is a great progress 🙏🏻

Comment on lines +69 to +72
if vterr, ok := err.(*vterrors.VitessError); ok && vterr.ID == "VT13001" {
// we encountered a bug. let's try to back out
return nil, errNotHorizonPlanned
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice

Comment on lines +104 to +105
case qp.NeedsAggregation() || sel.Having != nil || sel.Limit != nil || isDerived || needsOrdering || qp.NeedsDistinct():
return nil, errNotHorizonPlanned
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

so this is some of the cases we do not handle in the Horizon Planning Operator today?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

exactly

Signed-off-by: Andres Taylor <andres@planetscale.com>
Comment on lines +132 to +133
// CopyDependencies copies the dependencies from one expression into the other
func (st *SemTable) Cloned(from, to sqlparser.SQLNode) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The name of the function doesn't match the comment.

Predicates []sqlparser.Expr

// FinalPredicate is the evalengine expression that will finally be used.
// It contains the ANDed predicates in Predicates, with ColName:s replaced by Offset:s
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does Colname:s mean? Also Offest:s?

@systay systay merged commit a2057ba into vitessio:main Mar 30, 2023
@systay systay deleted the move-more-horizon branch March 30, 2023 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants