Skip to main content

ReadStatReader

Struct ReadStatReader 

Source
pub struct ReadStatReader {
    source: Source,
    metadata: Mutex<Option<ReadStatMetadata>>,
    offset: u32,
    limit: Option<u32>,
    columns: Option<Vec<String>>,
    chunk_rows: u32,
    progress: Option<Arc<dyn ProgressCallback>>,
}
Expand description

High-level, reusable SAS reader.

Configure row and column selection once, then use read, chunks, or visit. visit holds only the current chunk and is therefore the bounded-memory option.

Fields§

§source: Source§metadata: Mutex<Option<ReadStatMetadata>>§offset: u32§limit: Option<u32>§columns: Option<Vec<String>>§chunk_rows: u32§progress: Option<Arc<dyn ProgressCallback>>

Implementations§

Source§

impl ReadStatReader

Source

pub fn from_path(path: impl AsRef<Path>) -> Result<Self, ReadStatError>

Creates a reader for a filesystem path.

Source

pub fn from_bytes(bytes: impl Into<Arc<[u8]>>) -> Self

Creates a reader owning an in-memory SAS file.

Source

pub fn from_mmap(path: impl Into<PathBuf>) -> Result<Self, ReadStatError>

Creates a reader which memory maps path for each parse.

Source

fn new(source: Source) -> Self

Source

pub fn rows(self, offset: u32, limit: Option<u32>) -> Self

Selects the half-open row range beginning at offset, optionally limited to limit rows. The range is validated against metadata when reading.

Source

pub fn columns( self, columns: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Selects columns by name, preserving dataset order.

An empty selection deliberately produces a zero-column batch with the requested number of rows.

Source

pub fn chunk_rows(self, rows: u32) -> Self

Sets rows per yielded chunk. Zero is rejected when reading.

Source

pub fn progress(self, callback: Arc<dyn ProgressCallback>) -> Self

Attaches a progress callback.

Source

pub fn metadata(&self) -> Result<ReadStatMetadata, ReadStatError>

Reads and caches metadata transactionally.

Reusing the same reader for metadata and data uses one cached metadata snapshot for planning and avoids a second metadata parse. For path-backed sources, callers must still prevent the file from being replaced between metadata and data parsing, or between repeated reads with this reader.

Source

fn plan(&self) -> Result<ReadPlan, ReadStatError>

Source

pub fn visit( &self, visitor: impl FnMut(RecordBatch) -> Result<(), ReadStatError>, ) -> Result<(), ReadStatError>

Visits each batch without collecting previous chunks.

Source

fn visit_with_plan( &self, plan: &ReadPlan, visitor: impl FnMut(RecordBatch) -> Result<(), ReadStatError>, ) -> Result<(), ReadStatError>

Source

pub fn chunks(&self) -> Result<Vec<RecordBatch>, ReadStatError>

Collects all chunks.

Source

pub fn read(&self) -> Result<RecordBatch, ReadStatError>

Reads the selected rows into one batch.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,