Skip to content

Commit

Permalink
polish MemoryStream related code (#14537)
Browse files Browse the repository at this point in the history
  • Loading branch information
zjregee authored Feb 7, 2025
1 parent a9fb58c commit c0d4ae7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions datafusion/physical-plan/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ pub struct MemoryStream {
projection: Option<Vec<usize>>,
/// Index into the data
index: usize,
/// The remaining number of rows to return
/// The remaining number of rows to return. If None, all rows are returned
fetch: Option<usize>,
}

Expand Down Expand Up @@ -778,11 +778,9 @@ impl Stream for MemoryStream {
None => batch.clone(),
};

if self.fetch.is_none() {
let Some(&fetch) = self.fetch.as_ref() else {
return Poll::Ready(Some(Ok(batch)));
}

let fetch = self.fetch.unwrap();
};
if fetch == 0 {
return Poll::Ready(None);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ statement ok
drop table test_substr_base;

statement ok
drop table test_datetime_base;
drop table test_datetime_base;
2 changes: 1 addition & 1 deletion datafusion/sqllogictest/test_files/string/large_string.slt
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ statement ok
drop table test_substr_base;

statement ok
drop table test_datetime_base;
drop table test_datetime_base;

0 comments on commit c0d4ae7

Please sign in to comment.