clickhouse.rs icon indicating copy to clipboard operation
clickhouse.rs copied to clipboard

add way to check if a RowCursor has more rows already available

Open droundy opened this issue 2 years ago • 1 comments

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

droundy avatar Jun 09 '23 12:06 droundy

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.

loyd avatar Jul 04 '23 11:07 loyd