add way to check if a RowCursor has more rows already available
Opened this issue · 1 comments
droundy commented
I'd like to be able to batch up rows for further processing as a group. I know clickhouse returns its results in blocks, and it would be nice to be able to consume all the rows the blocks that have currently been received, and then pass them on to the next stage before waiting for more.
One way to achieve this would be to have a non-async
imp<...>l RowCursor<R> {
/// Get the next row if it has already been buffered, otherwise return `None`. If it hasn't been buffered (or an error happened), you'll have to call `next()`.
fn next_if_ready(&mut self) -> <Option<T> { ... }
}
loyd commented
The reason it's not implemented yet is because I think it's better to provide another API for batch processing to avoid overhead on .await
point at all.
I mean, it's not too hard to provide try_next() -> Option<T>
right now, but the more performant dedicated API requires more time to design.