Skip to content

Commit 7073270

Browse files
committed
fix
1 parent c41ae6c commit 7073270

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/query/sql/src/planner/optimizer/optimizers/rule/limit_rules/rule_merge_limit.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ impl Rule for RuleMergeLimit {
8585
// Calculate the effective limit by taking the minimum
8686
// When we have Limit(A, Limit(B, input)), the result should be Limit(min(A, B), input)
8787
let effective_limit = if let (Some(outer_count), Some(inner_count)) =
88-
(outer_limit.limit, inner_limit.limit) {
88+
(outer_limit.limit, inner_limit.limit)
89+
{
8990
outer_count.min(inner_count)
9091
} else {
9192
// If either limit is None, use the other one
@@ -104,13 +105,15 @@ impl Rule for RuleMergeLimit {
104105
before_exchange: outer_limit.before_exchange || inner_limit.before_exchange,
105106
limit: Some(effective_limit),
106107
offset: effective_offset,
107-
lazy_columns: outer_limit.lazy_columns.union(&inner_limit.lazy_columns).cloned().collect(),
108+
lazy_columns: outer_limit
109+
.lazy_columns
110+
.union(&inner_limit.lazy_columns)
111+
.cloned()
112+
.collect(),
108113
};
109114

110-
let merged_expr = SExpr::create_unary(
111-
Arc::new(merged_limit.into()),
112-
Arc::new(input.clone()),
113-
);
115+
let merged_expr =
116+
SExpr::create_unary(Arc::new(merged_limit.into()), Arc::new(input.clone()));
114117

115118
state.add_result(merged_expr);
116119
Ok(())

0 commit comments

Comments
 (0)