Ted-Jiang commented on code in PR #2335:
URL: https://github.com/apache/arrow-rs/pull/2335#discussion_r939546886
##########
parquet/src/arrow/arrow_reader/mod.rs:
##########
@@ -375,11 +340,36 @@ impl ParquetRecordBatchReader {
batch_size,
array_reader,
schema: Arc::new(schema),
- selection,
+ selection: selection.map(Into::into),
}
}
}
+/// Evaluates an [`ArrowPredicate`] returning the [`RowSelection`]
+///
+/// If this [`ParquetRecordBatchReader`] has a [`RowSelection`], the
+/// returned [`RowSelection`] will be the conjunction of this and
+/// the rows selected by `predicate`
+pub(crate) fn evaluate_predicate(
+ batch_size: usize,
+ array_reader: Box<dyn ArrayReader>,
+ selection: Option<RowSelection>,
+ predicate: &mut dyn ArrowPredicate,
+) -> Result<RowSelection> {
+ let reader =
+ ParquetRecordBatchReader::new(batch_size, array_reader,
selection.clone());
+ let mut filters = vec![];
+ for maybe_batch in reader {
+ filters.push(predicate.filter(maybe_batch?)?);
Review Comment:
I think here, we use the whole `project_mask` to generate batch, maybe we
can pass the 'filter' 's `project_mask` get better performance 🤔
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]