File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
main/scala/org/apache/spark/sql/catalyst/optimizer
test/scala/org/apache/spark/sql/catalyst/optimizer Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,9 @@ object ColumnPruning extends Rule[LogicalPlan] {
170
170
171
171
Project (substitutedProjection, child)
172
172
173
+ case Project (projectList, Limit (exp, child)) =>
174
+ Limit (exp, Project (projectList, child))
175
+
173
176
// Eliminate no-op Projects
174
177
case Project (projectList, child) if child.output == projectList => child
175
178
}
Original file line number Diff line number Diff line change @@ -90,7 +90,23 @@ class FilterPushdownSuite extends PlanTest {
90
90
91
91
comparePlans(optimized, correctAnswer)
92
92
}
93
+
94
+ test(" column pruning for Project(ne, Limit)" ) {
95
+ val originalQuery =
96
+ testRelation
97
+ .select(' a ,' b )
98
+ .limit(2 )
99
+ .select(' a )
100
+
101
+ val optimized = Optimize .execute(originalQuery.analyze)
102
+ val correctAnswer =
103
+ testRelation
104
+ .select(' a )
105
+ .limit(2 ).analyze
93
106
107
+ comparePlans(optimized, correctAnswer)
108
+ }
109
+
94
110
// After this line is unimplemented.
95
111
test(" simple push down" ) {
96
112
val originalQuery =
You can’t perform that action at this time.
0 commit comments