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

Add ids to logical plans #13525

Closed
wants to merge 1 commit into from
Closed

Add ids to logical plans #13525

wants to merge 1 commit into from

Conversation

mkleen
Copy link
Contributor

@mkleen mkleen commented Jan 25, 2023

This assigns to each logical plan node an id as part of the planning phase. This makes logical plans identifiable. This is useful for keeping track of changes on the logical operator node tree.

Main concepts:

  • Each newly created logical plan gets a new id
  • Id's of logical plans have to be unique within one planning phase
  • An incrementing int on the planner context is used to generate the ids

This is a pre-requisite for the iterative optimizer #13340

Summary of the changes / Why this improves CrateDB

Checklist

  • Added an entry in CHANGES.txt for user facing changes
  • Updated documentation & sql_features table for user facing changes
  • Touched code is covered by tests
  • CLA is signed
  • This does not contain breaking changes, or if it does:
    • It is released within a major release
    • It is recorded in CHANGES.txt
    • It was marked as deprecated in an earlier release if possible
    • You've thought about the consequences and other components are adapted
      (E.g. AdminUI)

@mkleen mkleen force-pushed the mkleen/logical-plan-ids branch 3 times, most recently from 58aa365 to 0cd5cda Compare January 26, 2023 13:35
@@ -43,11 +44,12 @@ public SubqueryPlanner(Function<SelectSymbol, LogicalPlan> planSubSelects) {

public record SubQueries(Map<LogicalPlan, SelectSymbol> uncorrelated, Map<SelectSymbol, LogicalPlan> correlated) {

public LogicalPlan applyCorrelatedJoin(LogicalPlan source) {
public LogicalPlan applyCorrelatedJoin(LogicalPlan source, IntSupplier ids) {
Copy link
Contributor Author

@mkleen mkleen Jan 26, 2023

Choose a reason for hiding this comment

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

I am trying to use IntSupplier () -> Int instead of the PlannerContext if possible, as it's simply much less hassle to build and to handle e.g. in tests.

LogicalPlan apply(T plan,
Captures captures,
TableStats tableStats,
TransactionContext txnCtx,
Copy link
Contributor Author

@mkleen mkleen Jan 26, 2023

Choose a reason for hiding this comment

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

We could introduce a RuleContext including TransactionContext, NodeContext and PlannerContext and TableStats.

@mkleen mkleen marked this pull request as ready for review January 26, 2023 13:50
This assigns to each logical plan node an id as part of the planning phase. This makes logical plans identifiable. This is useful for keeping track of changes on the logical operator node tree.

Main concepts:

 - Each newly created logical plan gets a new id
 - Id's of logical plans have to be unique within one planning phase
 - When a logical plan is modified e.g. by a rule transformation it will get a new id
 - An incrementing int on the planner context is used to generate the ids

This is a pre-requisite for the iterative optimizer #13340
@mkleen mkleen self-assigned this Jan 26, 2023
@mkleen
Copy link
Contributor Author

mkleen commented Jan 27, 2023

Converting back to draft. I would like to do one more iteration.

@mkleen mkleen marked this pull request as draft January 27, 2023 06:58
@mkleen mkleen closed this Jan 31, 2023
@mkleen mkleen mentioned this pull request Jul 5, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant