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
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
impl ReadStatReader
Sourcepub fn from_path(path: impl AsRef<Path>) -> Result<Self, ReadStatError>
pub fn from_path(path: impl AsRef<Path>) -> Result<Self, ReadStatError>
Creates a reader for a filesystem path.
Sourcepub fn from_bytes(bytes: impl Into<Arc<[u8]>>) -> Self
pub fn from_bytes(bytes: impl Into<Arc<[u8]>>) -> Self
Creates a reader owning an in-memory SAS file.
Sourcepub fn from_mmap(path: impl Into<PathBuf>) -> Result<Self, ReadStatError>
pub fn from_mmap(path: impl Into<PathBuf>) -> Result<Self, ReadStatError>
Creates a reader which memory maps path for each parse.
fn new(source: Source) -> Self
Sourcepub fn rows(self, offset: u32, limit: Option<u32>) -> Self
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.
Sourcepub fn columns(
self,
columns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
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.
Sourcepub fn chunk_rows(self, rows: u32) -> Self
pub fn chunk_rows(self, rows: u32) -> Self
Sets rows per yielded chunk. Zero is rejected when reading.
Sourcepub fn progress(self, callback: Arc<dyn ProgressCallback>) -> Self
pub fn progress(self, callback: Arc<dyn ProgressCallback>) -> Self
Attaches a progress callback.
Sourcepub fn metadata(&self) -> Result<ReadStatMetadata, ReadStatError>
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.
fn plan(&self) -> Result<ReadPlan, ReadStatError>
Sourcepub fn visit(
&self,
visitor: impl FnMut(RecordBatch) -> Result<(), ReadStatError>,
) -> Result<(), ReadStatError>
pub fn visit( &self, visitor: impl FnMut(RecordBatch) -> Result<(), ReadStatError>, ) -> Result<(), ReadStatError>
Visits each batch without collecting previous chunks.
fn visit_with_plan( &self, plan: &ReadPlan, visitor: impl FnMut(RecordBatch) -> Result<(), ReadStatError>, ) -> Result<(), ReadStatError>
Sourcepub fn chunks(&self) -> Result<Vec<RecordBatch>, ReadStatError>
pub fn chunks(&self) -> Result<Vec<RecordBatch>, ReadStatError>
Collects all chunks.
Sourcepub fn read(&self) -> Result<RecordBatch, ReadStatError>
pub fn read(&self) -> Result<RecordBatch, ReadStatError>
Reads the selected rows into one batch.
Auto Trait Implementations§
impl !Freeze for ReadStatReader
impl !RefUnwindSafe for ReadStatReader
impl Send for ReadStatReader
impl Sync for ReadStatReader
impl Unpin for ReadStatReader
impl UnsafeUnpin for ReadStatReader
impl !UnwindSafe for ReadStatReader
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
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>
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>
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