pub struct FileReader {
pub object_reader: Arc<dyn Reader>,
/* private fields */
}
Expand description
Lance File Reader.
It reads arrow data from one data file.
Fields§
§object_reader: Arc<dyn Reader>
Implementations§
Source§impl FileReader
impl FileReader
Sourcepub async fn try_new_with_fragment_id(
object_store: &ObjectStore,
path: &Path,
schema: Schema,
fragment_id: u32,
field_id_offset: i32,
max_field_id: i32,
session: Option<&FileMetadataCache>,
) -> Result<Self>
pub async fn try_new_with_fragment_id( object_store: &ObjectStore, path: &Path, schema: Schema, fragment_id: u32, field_id_offset: i32, max_field_id: i32, session: Option<&FileMetadataCache>, ) -> Result<Self>
Open file reader
Open the file at the given path using the provided object store.
The passed fragment ID determines the first 32-bits of the row IDs.
If a manifest is passed in, it will be used to load the schema and dictionary. This is typically done if the file is part of a dataset fragment. If no manifest is passed in, then it is read from the file itself.
The session passed in is used to cache metadata about the file. If no session is passed in, there will be no caching.
pub async fn try_new_from_reader( path: &Path, object_reader: Arc<dyn Reader>, metadata: Option<Arc<Metadata>>, schema: Schema, fragment_id: u32, field_id_offset: i32, max_field_id: i32, session: Option<&FileMetadataCache>, ) -> Result<Self>
pub async fn read_metadata( object_reader: &dyn Reader, cache: Option<&FileMetadataCache>, ) -> Result<Arc<Metadata>>
Sourcepub async fn try_new(
object_store: &ObjectStore,
path: &Path,
schema: Schema,
) -> Result<Self>
pub async fn try_new( object_store: &ObjectStore, path: &Path, schema: Schema, ) -> Result<Self>
Open one Lance data file for read.
Sourcepub fn schema(&self) -> &Schema
pub fn schema(&self) -> &Schema
Requested projection of the data in this file, excluding the row id column.
pub fn num_batches(&self) -> usize
Sourcepub fn num_rows_in_batch(&self, batch_id: i32) -> usize
pub fn num_rows_in_batch(&self, batch_id: i32) -> usize
Get the number of rows in this batch
pub fn is_empty(&self) -> bool
Sourcepub async fn read_batch(
&self,
batch_id: i32,
params: impl Into<ReadBatchParams>,
projection: &Schema,
) -> Result<RecordBatch>
pub async fn read_batch( &self, batch_id: i32, params: impl Into<ReadBatchParams>, projection: &Schema, ) -> Result<RecordBatch>
Read a batch of data from the file.
The schema of the returned RecordBatch is set by FileReader::schema()
.
Sourcepub async fn read_range(
&self,
range: Range<usize>,
projection: &Schema,
) -> Result<RecordBatch>
pub async fn read_range( &self, range: Range<usize>, projection: &Schema, ) -> Result<RecordBatch>
Read a range of records into one batch.
Note that it might call concat if the range is crossing multiple batches, which
makes it less efficient than FileReader::read_batch()
.
Sourcepub async fn take(
&self,
indices: &[u32],
projection: &Schema,
) -> Result<RecordBatch>
pub async fn take( &self, indices: &[u32], projection: &Schema, ) -> Result<RecordBatch>
Take by records by indices within the file.
The indices must be sorted.
Sourcepub fn page_stats_schema(&self, field_ids: &[i32]) -> Option<Schema>
pub fn page_stats_schema(&self, field_ids: &[i32]) -> Option<Schema>
Get the schema of the statistics page table, for the given data field ids.
Sourcepub async fn read_page_stats(
&self,
field_ids: &[i32],
) -> Result<Option<RecordBatch>>
pub async fn read_page_stats( &self, field_ids: &[i32], ) -> Result<Option<RecordBatch>>
Get the page statistics for the given data field ids.
Trait Implementations§
Source§impl Clone for FileReader
impl Clone for FileReader
Source§fn clone(&self) -> FileReader
fn clone(&self) -> FileReader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FileReader
impl Debug for FileReader
Source§impl DeepSizeOf for FileReader
impl DeepSizeOf for FileReader
Source§fn deep_size_of_children(&self, context: &mut Context) -> usize
fn deep_size_of_children(&self, context: &mut Context) -> usize
Source§fn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
Auto Trait Implementations§
impl Freeze for FileReader
impl !RefUnwindSafe for FileReader
impl Send for FileReader
impl Sync for FileReader
impl Unpin for FileReader
impl !UnwindSafe for FileReader
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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