File tree Expand file tree Collapse file tree 2 files changed +476
-76
lines changed
datafusion/datasource-parquet/src Expand file tree Collapse file tree 2 files changed +476
-76
lines changed Original file line number Diff line number Diff line change @@ -384,13 +384,28 @@ impl FileOpener for ParquetOpener {
384384 // with that range can be skipped as well
385385 if enable_page_index && !access_plan. is_empty ( ) {
386386 if let Some ( p) = page_pruning_predicate {
387- access_plan = p. prune_plan_with_page_index (
388- access_plan,
389- & physical_file_schema,
390- builder. parquet_schema ( ) ,
391- file_metadata. as_ref ( ) ,
392- & file_metrics,
393- ) ;
387+ // Todo: only collect page_match_infos if limit is specified
388+ let ( new_access_plan, page_match_infos) = p
389+ . prune_plan_with_page_index (
390+ access_plan,
391+ & physical_file_schema,
392+ builder. parquet_schema ( ) ,
393+ file_metadata. as_ref ( ) ,
394+ & file_metrics,
395+ ) ;
396+
397+ access_plan = new_access_plan;
398+
399+ // Apply page-level limit pruning if limit is specified
400+ if let Some ( limit) = limit {
401+ access_plan = p. prune_by_limit (
402+ access_plan,
403+ limit,
404+ & page_match_infos,
405+ rg_metadata,
406+ & file_metrics,
407+ ) ;
408+ }
394409 }
395410 }
396411
You can’t perform that action at this time.
0 commit comments