-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Remove unnecessary projection in logical plan optimization phase #747
Conversation
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good -- thank you @waynexia
@@ -496,6 +506,60 @@ mod tests { | |||
Ok(()) | |||
} | |||
|
|||
#[test] | |||
fn redundunt_project() -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn redundunt_project() -> Result<()> { | |
fn redundant_project() -> Result<()> { |
} | ||
|
||
#[test] | ||
fn noncontiguous_redundunt_projection() -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn noncontiguous_redundunt_projection() -> Result<()> { | |
fn noncontiguous_redundant_projection() -> Result<()> { |
Which issue does this PR close?
Related to #277 .
What changes are included in this PR?
This PR adds an optimization rule to remove unnecessary projection plans.
We'll consider a projection as "unnecessary" if it only reorders columns (requires the same columns against its sub-plan) and is not the first projection.
For the case where the sub-plan of a projection is a table scan, projection will be pushed down into the table scan plan as a
Vec<usize>
array. From the documentation, this array should be ordered. So I keep the projection in this situation (test casereorder_projection()
).