Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ object ColumnPruning extends Rule[LogicalPlan] {

Project(substitutedProjection, child)

case Project(projectList, Limit(exp, child)) =>
Limit(exp, Project(projectList, child))

// Eliminate no-op Projects
case Project(projectList, child) if child.output == projectList => child
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,23 @@ class FilterPushdownSuite extends PlanTest {

comparePlans(optimized, correctAnswer)
}

test("column pruning for Project(ne, Limit)") {
val originalQuery =
testRelation
.select('a,'b)
.limit(2)
.select('a)

val optimized = Optimize.execute(originalQuery.analyze)
val correctAnswer =
testRelation
.select('a)
.limit(2).analyze

comparePlans(optimized, correctAnswer)
}

// After this line is unimplemented.
test("simple push down") {
val originalQuery =
Expand Down