Skip to content

Commit 3670ee1

Browse files
committed
fix
1 parent 87ffa7d commit 3670ee1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/query/service/src/pipelines/processors/transforms/sort/sort_builder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ impl Build<'_> {
357357
self.output.clone(),
358358
self.schema().clone(),
359359
self.params.block_size,
360-
self.params.limit,
361360
!self.params.output_order_col,
362361
)?))
363362
}

src/query/service/src/pipelines/processors/transforms/sort/sort_merge_stream.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ where A: SortAlgorithm
4141
output: Arc<OutputPort>,
4242
schema: DataSchemaRef,
4343
block_size: usize,
44-
limit: Option<usize>,
4544

4645
output_data: Option<DataBlock>,
4746
cur_index: u32,
@@ -56,7 +55,6 @@ where A: SortAlgorithm
5655
output: Arc<OutputPort>,
5756
schema: DataSchemaRef,
5857
block_size: usize,
59-
limit: Option<usize>,
6058
remove_order_col: bool,
6159
) -> Result<Self> {
6260
let streams = inputs
@@ -76,7 +74,6 @@ where A: SortAlgorithm
7674
output,
7775
schema,
7876
block_size,
79-
limit,
8077
output_data: None,
8178
cur_index: 0,
8279
inner: Err(streams),
@@ -145,11 +142,12 @@ where A: SortAlgorithm + 'static
145142
Err(streams) => streams,
146143
};
147144

148-
if streams.iter().all(|stream| stream.input.is_finished()) {
145+
if streams.iter().all(|stream| stream.is_finished()) {
149146
self.output.finish();
150147
return Ok(Event::Finished);
151148
}
152149

150+
log::debug!("create merger cur_index {}", self.cur_index);
153151
for stream in streams.iter_mut() {
154152
stream.update_bound_index(self.cur_index);
155153
}
@@ -158,7 +156,7 @@ where A: SortAlgorithm + 'static
158156
self.schema.clone(),
159157
std::mem::take(streams),
160158
self.block_size,
161-
self.limit,
159+
None,
162160
));
163161
Ok(Event::Sync)
164162
}
@@ -211,8 +209,7 @@ impl<R: Rows> BoundedInputStream<R> {
211209
return Ok(false);
212210
}
213211

214-
if self.input.has_data() {
215-
let block = self.input.pull_data().unwrap()?;
212+
if let Some(block) = self.input.pull_data().transpose()? {
216213
self.input.set_need_data();
217214
self.data = Some(block);
218215
Ok(false)
@@ -254,6 +251,10 @@ impl<R: Rows> BoundedInputStream<R> {
254251
more: true,
255252
});
256253
}
254+
255+
fn is_finished(&self) -> bool {
256+
self.input.is_finished() && self.data.is_none()
257+
}
257258
}
258259

259260
#[cfg(test)]

0 commit comments

Comments
 (0)