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

Extract Explain, Analyze, Extension in LogicalPlan as independent struct #1317

Merged
merged 1 commit into from
Nov 17, 2021

Conversation

xudong963
Copy link
Member

Which issue does this PR close?

Closes #1307

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added ballista datafusion Changes in the datafusion crate sql SQL Planner labels Nov 16, 2021
@@ -973,24 +973,24 @@ impl TryInto<protobuf::LogicalPlanNode> for &LogicalPlan {
)),
})
}
LogicalPlan::Analyze { verbose, input, .. } => {
let input: protobuf::LogicalPlanNode = input.as_ref().try_into()?;
LogicalPlan::Analyze(a) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to import the Analyze struct and use this code style

LogicalPlan::Analyze(Aanlyze{
 verbose, input,....
})

Copy link
Member Author

@xudong963 xudong963 Nov 17, 2021

Choose a reason for hiding this comment

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

In fact, I don't have a strong desire which is better. When the struct has many variables, I'd like to use StructVar(s) => {s.v1, s.v2 ...} to keep code concise. If there are a few variables, it doesn't matter, both styles make sense to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree either style seems fine to me

} = plan
{
let mut stringified_plans = stringified_plans.clone();
if let LogicalPlan::Explain(e) = plan {
Copy link
Contributor

Choose a reason for hiding this comment

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

same comments like above.

@@ -696,21 +698,21 @@ impl LogicalPlanBuilder {
let schema = schema.to_dfschema_ref()?;

if analyze {
Ok(Self::from(LogicalPlan::Analyze {
Ok(Self::from(LogicalPlan::Analyze(AnalyzePlan {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this code style is better than above style.
This is same with this pull request #1290

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.

LGTM -- thanks @xudong963 and @liukun4515

I also merged apache/master into this branch locally to test for logical conflicts and things look good 👍

@alamb alamb merged commit bcd1258 into apache:master Nov 17, 2021
@xudong963 xudong963 deleted the extract_plan branch November 17, 2021 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datafusion Changes in the datafusion crate sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extract Explain, Analyze, Extension in LogicalPlan as independent struct
3 participants