File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments