pub type ParquetRecordBatchReaderBuilder<T> = ArrowReaderBuilder<SyncReader<T>>;Expand description
Creates ParquetRecordBatchReader for reading Parquet files into Arrow [RecordBatch]es
§See Also
crate::arrow::async_reader::ParquetRecordBatchStreamBuilderfor an async APIcrate::arrow::push_decoder::ParquetPushDecoderBuilderfor a SansIO decoder APIArrowReaderBuilderfor additional member functions
Aliased Type§
pub struct ParquetRecordBatchReaderBuilder<T> {Show 13 fields
pub(crate) input: SyncReader<T>,
pub(crate) metadata: Arc<ParquetMetaData>,
pub(crate) schema: Arc<Schema>,
pub(crate) fields: Option<Arc<ParquetField>>,
pub(crate) batch_size: usize,
pub(crate) row_group_plan: RowGroupPlan,
pub(crate) projection: ProjectionMask,
pub(crate) filter: Option<RowFilter>,
pub(crate) row_selection_policy: RowSelectionPolicy,
pub(crate) limit: Option<usize>,
pub(crate) offset: Option<usize>,
pub(crate) metrics: ArrowReaderMetrics,
pub(crate) max_predicate_cache_size: usize,
}Fields§
§input: SyncReader<T>The “input” to read parquet data from.
Note in the case of the ParquetPushDecoderBuilder there is no
underlying reader; the input is instead PushDecoderInput, the buffer that
caller-pushed bytes accumulate in.
metadata: Arc<ParquetMetaData>§schema: Arc<Schema>§fields: Option<Arc<ParquetField>>§batch_size: usize§row_group_plan: RowGroupPlan§projection: ProjectionMask§filter: Option<RowFilter>§row_selection_policy: RowSelectionPolicy§limit: Option<usize>§offset: Option<usize>§metrics: ArrowReaderMetrics§max_predicate_cache_size: usizeImplementations§
Source§impl<T: ChunkReader + 'static> ParquetRecordBatchReaderBuilder<T>
impl<T: ChunkReader + 'static> ParquetRecordBatchReaderBuilder<T>
Sourcepub fn try_new(reader: T) -> Result<Self>
pub fn try_new(reader: T) -> Result<Self>
Create a new ParquetRecordBatchReaderBuilder
// Build the reader from anything that implements `ChunkReader`
// such as a `File`, or `Bytes`
let mut builder = ParquetRecordBatchReaderBuilder::try_new(file).unwrap();
// The builder has access to ParquetMetaData such
// as the number and layout of row groups
assert_eq!(builder.metadata().num_row_groups(), 1);
// Call build to create the reader
let mut reader: ParquetRecordBatchReader = builder.build().unwrap();
// Read data
while let Some(batch) = reader.next().transpose()? {
println!("Read {} rows", batch.num_rows());
}Sourcepub fn try_new_with_options(
reader: T,
options: ArrowReaderOptions,
) -> Result<Self>
pub fn try_new_with_options( reader: T, options: ArrowReaderOptions, ) -> Result<Self>
Create a new ParquetRecordBatchReaderBuilder with ArrowReaderOptions
Use this method if you want to control the options for reading the
ParquetMetaData
Sourcepub fn new_with_metadata(input: T, metadata: ArrowReaderMetadata) -> Self
pub fn new_with_metadata(input: T, metadata: ArrowReaderMetadata) -> Self
Create a ParquetRecordBatchReaderBuilder from the provided ArrowReaderMetadata
Use this method if you already have ParquetMetaData for a file.
This interface allows:
-
Loading metadata once and using it to create multiple builders with potentially different settings or run on different threads
-
Using a cached copy of the metadata rather than re-reading it from the file each time a reader is constructed.
See the docs on ArrowReaderMetadata for more details
§Example
let metadata = ArrowReaderMetadata::load(&file, Default::default()).unwrap();
let mut a = ParquetRecordBatchReaderBuilder::new_with_metadata(file.clone(), metadata.clone()).build().unwrap();
let mut b = ParquetRecordBatchReaderBuilder::new_with_metadata(file, metadata).build().unwrap();
// Should be able to read from both in parallel
assert_eq!(a.next().unwrap().unwrap(), b.next().unwrap().unwrap());Sourcepub fn get_row_group_column_bloom_filter(
&self,
row_group_idx: usize,
column_idx: usize,
) -> Result<Option<Sbbf>>
pub fn get_row_group_column_bloom_filter( &self, row_group_idx: usize, column_idx: usize, ) -> Result<Option<Sbbf>>
Read bloom filter for a column in a row group
Returns None if the column does not have a bloom filter
We should call this function after other forms pruning, such as projection and predicate pushdown.
Sourcepub fn build(self) -> Result<ParquetRecordBatchReader>
pub fn build(self) -> Result<ParquetRecordBatchReader>
Build a ParquetRecordBatchReader
Note: this will eagerly evaluate any RowFilter before returning