xudong963 commented on PR #4421:
URL:
https://github.com/apache/arrow-datafusion/pull/4421#issuecomment-1330411212
I think the more elegant way is to directly **Skip** current iterator to the
next iterator.
For example:
```rust
trait A {
fn execute() -> Result<Stream>;
}
Struct B {
input: C,
}
Struct C {
input: D
}
Struct D {
}
// All D, B, C have implemented trait A and trait Stream
// Each execute method will call its input's execute method
fn main {
let b = B::new();
let data_stream = b.execute();
while let Some(stream) = data_stream.next().await {
...
}
}
impl Stream for C {
type Item = ..;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Self::Item>> {
...
if !predicate(value) {
// Skip current iteration
}
}
}
```
But I don't find a proper way to implement it, `Stream` crate seems not to
provide related API. Any thoughts? @tustvold
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]