Ted-Jiang commented on code in PR #3780:
URL: https://github.com/apache/arrow-datafusion/pull/3780#discussion_r995554351
##########
datafusion/core/src/physical_plan/file_format/parquet.rs:
##########
@@ -785,6 +902,57 @@ impl<'a> PruningStatistics for
RowGroupPruningStatistics<'a> {
}
}
+impl<'a> PruningStatistics for PagesPruningStatistics<'a> {
+ fn min_values(&self, column: &Column) -> Option<ArrayRef> {
+ get_min_max_values_form_page_index!(self, column, min)
+ }
+
+ fn max_values(&self, column: &Column) -> Option<ArrayRef> {
+ get_min_max_values_form_page_index!(self, column, max)
+ }
+
+ fn num_containers(&self) -> usize {
+ self.offset_indexes.get(self.col_id).unwrap().len()
Review Comment:
Agree! as you mention:
>It also means that the "number of containers" in Column A will be "2" (as
it as pages 1 and 2) and the number of containers for Column B will be "3" (as
it has pages 3, 4, 5).
we should base on the *column identification* to return the number of
containers, but hard to do this base on this method
https://github.com/apache/arrow-datafusion/blob/e7edac5b66f8b929382a582021165f97392bd50c/datafusion/core/src/physical_optimizer/pruning.rs#L81-L83
I will modify this in following pr.
##########
datafusion/core/src/physical_plan/file_format/parquet.rs:
##########
@@ -460,6 +498,20 @@ impl FileOpener for ParquetOpener {
}
}
+// Check PruningPredicates just work on one column.
+fn check_page_index_push_down_valid(predicate: &Option<PruningPredicate>) ->
bool {
+ if let Some(predicate) = predicate {
+ // for now we only support pushDown on one col, because each col may
have different page numbers, its hard to get
+ // `num_containers` from `PruningStatistics`.
+ let cols = predicate.need_input_columns_ids();
+ //Todo more specific rules
Review Comment:
> So among other things, this implies we probably want to break the pruning
predicate down into conjuncts (aka split on AND) to try and isolate predicates
that refer only to a single column
Yes, i think it has been done in `FilterPushDownRule`, like break like
rewrite the filter-expr to CNF( I means top level `operator` are all `and`).
But after check the code, i am wrong there not any split logic in `logical
plan`, i think we should do this in logical plan optimizer like in `filter
pushdown` as early as possible and do it once🤔
--
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]