We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 20d3495 commit fca131aCopy full SHA for fca131a
datafusion/optimizer/src/push_down_limit.rs
@@ -136,8 +136,13 @@ impl OptimizerRule for PushDownLimit {
136
}
137
} else {
138
sort.fetch = new_fetch;
139
- limit.input = Arc::new(LogicalPlan::Sort(sort));
140
- Ok(Transformed::yes(LogicalPlan::Limit(limit)))
+ let new_plan = if skip > 0 {
+ limit.input = Arc::new(LogicalPlan::Sort(sort));
141
+ LogicalPlan::Limit(limit)
142
+ } else {
143
+ LogicalPlan::Sort(sort)
144
+ };
145
+ Ok(Transformed::yes(new_plan))
146
147
148
LogicalPlan::Projection(mut proj) => {
0 commit comments