pub struct ZSetBatchIterator { /* private fields */ }Expand description
Iterator for scanning Redis sorted sets in batches as Arrow RecordBatches.
This iterator fetches sorted set keys matching a pattern and retrieves their members with scores, converting them to Arrow RecordBatches for use with Polars. Each member becomes a row in the output.
§Example
ⓘ
use polars_redis::{ZSetBatchIterator, ZSetSchema, BatchConfig};
let schema = ZSetSchema::new().with_key(true).with_rank(true);
let config = BatchConfig::new("leaderboard:*").with_batch_size(1000);
let mut iterator = ZSetBatchIterator::new(url, schema, config)?;
while let Some(batch) = iterator.next_batch()? {
println!("Got {} members", batch.num_rows());
}§Output Schema
_key(optional): The Redis keymember: The sorted set member value (Utf8)score: The member’s score (Float64)rank(optional): The member’s rank in the sorted set (Int64)
Implementations§
Source§impl ZSetBatchIterator
impl ZSetBatchIterator
Sourcepub fn new(url: &str, schema: ZSetSchema, config: BatchConfig) -> Result<Self>
pub fn new(url: &str, schema: ZSetSchema, config: BatchConfig) -> Result<Self>
Create a new ZSetBatchIterator.
Sourcepub fn next_batch(&mut self) -> Result<Option<RecordBatch>>
pub fn next_batch(&mut self) -> Result<Option<RecordBatch>>
Get the next batch of data as a RecordBatch.
Sourcepub fn rows_yielded(&self) -> usize
pub fn rows_yielded(&self) -> usize
Get the number of rows (members) yielded so far.
Auto Trait Implementations§
impl !Freeze for ZSetBatchIterator
impl !RefUnwindSafe for ZSetBatchIterator
impl Send for ZSetBatchIterator
impl Sync for ZSetBatchIterator
impl Unpin for ZSetBatchIterator
impl !UnwindSafe for ZSetBatchIterator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more