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 Projection, Filter, Window in LogicalPlan as independent struct #1309

Merged
merged 7 commits into from
Nov 22, 2021

Conversation

ic4y
Copy link
Contributor

@ic4y ic4y commented Nov 15, 2021

Closes #1302

Which issue does this PR close?

Related to #1228

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 labels Nov 15, 2021
@xudong963
Copy link
Member

@ic4y Thanks for your contribution. You need to fix the lint error, after fixing it, I'll start reviewing!

@ic4y
Copy link
Contributor Author

ic4y commented Nov 15, 2021

@xudong963
Thank you!I have fixed the error. please reviewing

Copy link
Member

@xudong963 xudong963 left a comment

Choose a reason for hiding this comment

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

Thanks, @ic4y, nice work.

@@ -777,9 +778,9 @@ impl TryInto<protobuf::LogicalPlanNode> for &LogicalPlan {
)))
}
}
LogicalPlan::Projection {
LogicalPlan::Projection(ProjectionPlan {
Copy link
Member

Choose a reason for hiding this comment

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

I think we can use the style, LogicalPlan::Projection(p) => {p.var1, p.var2, ...}.

FYI, #1228 (comment)

@@ -794,7 +795,7 @@ impl TryInto<protobuf::LogicalPlanNode> for &LogicalPlan {
},
))),
}),
LogicalPlan::Filter { predicate, input } => {
LogicalPlan::Filter(FilterPlan { predicate, input }) => {
Copy link
Member

Choose a reason for hiding this comment

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

ditto, you can also check other places.

/// The schema description of the window output
schema: DFSchemaRef,
},
/// the ProjectionPlan
Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need annotation here. cc @alamb

nit: It's good to start with an upper case, such as The projection plan.

Projection(ProjectionPlan),
/// the FilterPlan
Filter(FilterPlan),
/// the WindowPlan
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@xudong963
Copy link
Member

BTW, you need to solve conflicts.

@ic4y
Copy link
Contributor Author

ic4y commented Nov 19, 2021

@xudong963 Thanks, I will do it today

liuli added 3 commits November 19, 2021 21:54
# Conflicts:
#	datafusion/src/execution/context.rs
#	datafusion/src/logical_plan/builder.rs
#	datafusion/src/logical_plan/plan.rs
#	datafusion/src/optimizer/filter_push_down.rs
#	datafusion/src/optimizer/limit_push_down.rs
#	datafusion/src/optimizer/projection_push_down.rs
#	datafusion/src/optimizer/utils.rs
#	datafusion/src/physical_plan/planner.rs
#	datafusion/tests/custom_sources.rs
@xudong963
Copy link
Member

@ic4y After you finish it, ping me and I'll take a look

@ic4y
Copy link
Contributor Author

ic4y commented Nov 19, 2021

@xudong963 Thanks, I have finished.

@xudong963
Copy link
Member

LGTM!

…ct (#1302)

You can edit here correctly.


/// Window its input based on a set of window spec and window function (e.g. SUM or RANK)
#[derive(Clone)]
pub struct WindowPlan {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you @ic4y

I feel like these names are not consistent with the other structs in this file

How about renaming

ProjectionPlan --> Projection
FilterPlan --> Filter
WindowPlan --> Window

To be consistent with the naming of the model of CrossJoin (not CrossJoinPlan), Repartition (not RepartitonPlan), etc)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, thanks @alamb I will modify according to your suggestion.

LogicalPlan::Projection {
expr, input, alias, ..
} => Ok(protobuf::LogicalPlanNode {
LogicalPlan::Projection(projection_plan) => Ok(protobuf::LogicalPlanNode {
Copy link
Contributor

@liukun4515 liukun4515 Nov 20, 2021

Choose a reason for hiding this comment

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

Same comment in the pull request
@xudong963 how about make consistent like before?
If the changes is suffering for multi contributors, we can fill a follow up pull request to make consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liukun4515 My thoughts are the same as you, @xudong963 What you think?
I submit it first, and then modify it if necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

The modification looks good to me.

liuli added 2 commits November 21, 2021 01:09
# Conflicts:
#	ballista/rust/core/src/serde/logical_plan/to_proto.rs
#	datafusion/src/logical_plan/builder.rs
#	datafusion/src/logical_plan/plan.rs
#	datafusion/src/optimizer/limit_push_down.rs
#	datafusion/src/optimizer/utils.rs
#	datafusion/src/physical_plan/planner.rs
@houqp houqp requested a review from alamb November 22, 2021 03:03
Copy link
Member

@houqp houqp left a comment

Choose a reason for hiding this comment

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

LGTM

@houqp houqp added the api change Changes the API exposed to users of the crate label Nov 22, 2021
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.

Thanks @ic4y @liukun4515 and @xudong963 . Really appreciate your help and progress here

@alamb alamb merged commit a607861 into apache:master Nov 22, 2021
@alamb alamb removed the api change Changes the API exposed to users of the crate label Feb 10, 2022
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extract Projection, Filter, Window in LogicalPlan as independent struct
5 participants