File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -1458,13 +1458,11 @@ object PushPredicateThroughJoin extends Rule[LogicalPlan] with PredicateHelper {
1458
1458
*/
1459
1459
object EliminateLimits extends Rule [LogicalPlan ] {
1460
1460
private def canEliminate (limitExpr : Expression , childMaxRow : Option [Long ]): Boolean = {
1461
- limitExpr.foldable &&
1462
- childMaxRow.isDefined &&
1463
- childMaxRow.get <= limitExpr.eval().toString.toInt
1461
+ limitExpr.foldable && childMaxRow.exists { _ <= limitExpr.eval().toString.toInt }
1464
1462
}
1465
1463
1466
1464
def apply (plan : LogicalPlan ): LogicalPlan = plan transformDown {
1467
- case GlobalLimit (l, child) if canEliminate(l, child.maxRows) =>
1465
+ case Limit (l, child) if canEliminate(l, child.maxRows) =>
1468
1466
child
1469
1467
case LocalLimit (l, child) if canEliminate(l, child.maxRows) =>
1470
1468
child
You can’t perform that action at this time.
0 commit comments