Skip to content

Conversation

@waynexia
Copy link
Member

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 case reorder_projection()).

waynexia added 3 commits July 16, 2021 14:20
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
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.

Looks good -- thank you @waynexia

}

#[test]
fn redundunt_project() -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn redundunt_project() -> Result<()> {
fn redundant_project() -> Result<()> {

}

#[test]
fn noncontiguous_redundunt_projection() -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn noncontiguous_redundunt_projection() -> Result<()> {
fn noncontiguous_redundant_projection() -> Result<()> {

@alamb alamb merged commit b5e034b into apache:master Jul 19, 2021
@waynexia waynexia deleted the patch-1 branch July 19, 2021 16:44
@houqp houqp added the enhancement New feature or request label Jul 31, 2021
H0TB0X420 pushed a commit to H0TB0X420/datafusion that referenced this pull request Oct 7, 2025
* Add a search order when attempting to locate the appropriate window function

* Remove unnecessary markings

* Linting

* Code cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants