pub struct SetBatchIterator { /* private fields */ }Expand description
Iterator for scanning Redis sets in batches as Arrow RecordBatches.
This iterator fetches set keys matching a pattern and retrieves their members, converting them to Arrow RecordBatches for use with Polars. Each member becomes a row in the output.
§Example
ⓘ
use polars_redis::{SetBatchIterator, SetSchema, BatchConfig};
let schema = SetSchema::new().with_key(true);
let config = BatchConfig::new("tags:*").with_batch_size(1000);
let mut iterator = SetBatchIterator::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 set member value (Utf8)
Implementations§
Source§impl SetBatchIterator
impl SetBatchIterator
Sourcepub fn new(url: &str, schema: SetSchema, config: BatchConfig) -> Result<Self>
pub fn new(url: &str, schema: SetSchema, config: BatchConfig) -> Result<Self>
Create a new SetBatchIterator.
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 SetBatchIterator
impl !RefUnwindSafe for SetBatchIterator
impl Send for SetBatchIterator
impl Sync for SetBatchIterator
impl Unpin for SetBatchIterator
impl !UnwindSafe for SetBatchIterator
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