tustvold commented on a change in pull request #9926:
URL: https://github.com/apache/arrow/pull/9926#discussion_r608677327



##########
File path: rust/datafusion/src/physical_plan/limit.rs
##########
@@ -236,23 +245,29 @@ impl Stream for LimitStream {
         mut self: Pin<&mut Self>,
         cx: &mut Context<'_>,
     ) -> Poll<Option<Self::Item>> {
-        self.input.poll_next_unpin(cx).map(|x| match x {
-            Some(Ok(batch)) => Ok(self.stream_limit(batch)).transpose(),
-            other => other,
-        })
+        match &mut self.input {

Review comment:
       Why not just compare `self.current_len == self.limit` and short-cirtcuit 
before polling the wrapped stream, instead of the Option plumbing?




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to