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

refactor code about query -> plan for subqueries #4559

Merged
merged 1 commit into from
Dec 9, 2022

Conversation

jackwener
Copy link
Member

@jackwener jackwener commented Dec 8, 2022

Which issue does this PR close?

Closes #.

Rationale for this change

After #4484 #4141 , we remove the alias in query_to_plan(), so we can remove it.

What's more, we can find just subquery_to_plan need to pass outer_schema.

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the sql SQL Planner label Dec 8, 2022
Comment on lines -455 to -460
let logical_plan = self.query_to_plan_with_alias(
*cte.query,
None,
&mut planner_context.clone(),
outer_query_schema,
)?;
Copy link
Member Author

Choose a reason for hiding this comment

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

just subquery -> plan need to pass outer_query_schema.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Very nice change @jackwener

&self,
query: Query,
alias: Option<String>,
planner_context: &mut PlannerContext,
outer_query_schema: Option<&DFSchema>,
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

}

/// Generate a logic plan from an SQL query with optional alias
pub fn query_to_plan_with_alias(
/// Generate a logic plan from an SQL query.
Copy link
Contributor

Choose a reason for hiding this comment

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

This API makes a lot of sense -- thank you @jackwener

@alamb alamb changed the title refactor code about query -> plan refactor code about query -> plan for subqueries Dec 9, 2022
@alamb alamb merged commit 36c3861 into apache:master Dec 9, 2022
@jackwener jackwener deleted the remove_alias branch December 9, 2022 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants