Pajaraja commented on code in PR #51847: URL: https://github.com/apache/spark/pull/51847#discussion_r2318941768
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala: ########## @@ -4281,6 +4282,25 @@ object RemoveTempResolvedColumn extends Rule[LogicalPlan] { } } +object ApplyLimitAll extends Rule[LogicalPlan] { + def applyLimitAllToPlan(plan: LogicalPlan, isInLimitAll: Boolean = false): LogicalPlan = { + plan match { + case la: LimitAll => + applyLimitAllToPlan(la.child, isInLimitAll = true) + case cteRef: CTERelationRef if isInLimitAll => + cteRef.copy(isUnlimitedRecursion = Some(true)) + case other => Review Comment: I made an allowlist based on the LimitPushDown optimizer rule and added Filter. Is there any other nodes we should add? ########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala: ########## @@ -4281,6 +4282,25 @@ object RemoveTempResolvedColumn extends Rule[LogicalPlan] { } } +object ApplyLimitAll extends Rule[LogicalPlan] { + def applyLimitAllToPlan(plan: LogicalPlan, isInLimitAll: Boolean = false): LogicalPlan = { + plan match { + case la: LimitAll => + applyLimitAllToPlan(la.child, isInLimitAll = true) + case cteRef: CTERelationRef if isInLimitAll => + cteRef.copy(isUnlimitedRecursion = Some(true)) + case other => + other.withNewChildren(other.children + .map(child => applyLimitAllToPlan(child, isInLimitAll))) + } + } + + def apply(plan: LogicalPlan): LogicalPlan = { + val ret = applyLimitAllToPlan(plan) + ret Review Comment: changed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org