Skip to content

Commit 7db4566

Browse files
committed
Update CombiningLimitsSuite.scala
1 parent e2a491d commit 7db4566

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CombiningLimitsSuite.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class CombiningLimitsSuite extends PlanTest {
2727

2828
object Optimize extends RuleExecutor[LogicalPlan] {
2929
val batches =
30+
Batch("Filter Pushdown", FixedPoint(100),
31+
ColumnPruning) ::
3032
Batch("Combine Limit", FixedPoint(10),
3133
CombineLimits) ::
3234
Batch("Constant Folding", FixedPoint(10),
@@ -69,4 +71,22 @@ class CombiningLimitsSuite extends PlanTest {
6971

7072
comparePlans(optimized, correctAnswer)
7173
}
74+
75+
test("limits: combines two limits after ColumnPruning") {
76+
val originalQuery =
77+
testRelation
78+
.select('a)
79+
.limit(2)
80+
.select('a)
81+
.limit(5)
82+
83+
val optimized = Optimize(originalQuery.analyze)
84+
val correctAnswer =
85+
testRelation
86+
.select('a)
87+
.limit(2).analyze
88+
89+
comparePlans(optimized, correctAnswer)
90+
}
91+
7292
}

0 commit comments

Comments
 (0)