ming535 commented on code in PR #2823:
URL: https://github.com/apache/arrow-datafusion/pull/2823#discussion_r913473583
##########
datafusion/optimizer/src/eliminate_limit.rs:
##########
@@ -35,35 +39,98 @@ impl EliminateLimit {
}
}
+/// Ancestor indicates the current ancestor in the LogicalPlan tree
+/// when traversing down related to "eliminate limit".
+enum Ancestor {
+ /// Limit
+ FromLimit { skip: Option<usize> },
+ /// Other nodes that don't affect the adjustment of "Limit"
+ NotRelevant,
+}
+
+/// replaces LIMIT 0 with an [LogicalPlan::EmptyRelation]
+/// replaces LIMIT node whose ancestor LIMIT's skip is greater than or equal
to current's fetch
+/// with an [LogicalPlan::EmptyRelation]
+fn eliminate_limit(
+ _optimizer: &EliminateLimit,
+ ancestor: &Ancestor,
+ plan: &LogicalPlan,
+ _optimizer_config: &OptimizerConfig,
+) -> Result<LogicalPlan> {
+ match plan {
Review Comment:
How about
```
match plan {
LogicalPlan::Limit(Limit {skip, Some(fetch), input, ..}})...
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]