Skip to content

Conversation

@viirya
Copy link
Member

@viirya viirya commented Mar 9, 2016

JIRA: https://issues.apache.org/jira/browse/SPARK-13771

What changes were proposed in this pull request?

This is a corner case that a `Project` node can have no references to its child. E.g.,
val input = LocalRelation('key.int, 'value.string)
Project(Literal(1).as("1") :: Nil, input)

We can actually replace the input with a dummy OneRowRelation.

This PR is inspired by #11599. The test case is slightly modified from #11599 too.

How was this patch tested?

ColumnPruningSuite.

@gatorsmile
Copy link
Member

LGTM : )

}

// Eliminate the child from the Projects with no references to its child
case p @ Project(projectList, child) if p.references.intersect(child.outputSet).isEmpty =>
Copy link
Contributor

Choose a reason for hiding this comment

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

But this will change the number of rows right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea. I think it is changed to 1 row. Indeed this causes problem.

@cloud-fan
Copy link
Contributor

This is an optimizable case, but I think we need a new relation that can produce n empty rows.

@gatorsmile
Copy link
Member

You are right.

@SparkQA
Copy link

SparkQA commented Mar 9, 2016

Test build #52735 has finished for PR 11602 at commit 9500b46.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

And looks like our data source can handle this case, they will take an empty array as requestedColumns and scan no data but only row counts(not verified yet).

@viirya viirya changed the title [SPARK-13771][SQL] Eliminate child from project if the project with no references to its child [SPARK-13771][SQL][WIP] Eliminate child columns from project if the project with no references to its child Mar 9, 2016
@viirya
Copy link
Member Author

viirya commented Mar 9, 2016

I will change this later. Marked it as WIP now.

@viirya
Copy link
Member Author

viirya commented Mar 10, 2016

Rethink about this. I would like to close it for now.

@viirya viirya closed this Mar 10, 2016
@viirya viirya deleted the eliminate-no-use branch December 27, 2023 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants