@@ -284,6 +284,7 @@ impl Query {
284284 let mut config = SessionConfig :: default ( )
285285 . with_parquet_pruning ( true )
286286 . with_prefer_existing_sort ( true )
287+ . with_collect_statistics ( true )
287288 //batch size has been made configurable via environment variable
288289 //default value is 20000
289290 . with_batch_size ( PARSEABLE . options . execution_batch_size )
@@ -296,6 +297,24 @@ impl Query {
296297 // Reorder filters allows DF to decide the order of filters minimizing the cost of filter evaluation
297298 config. options_mut ( ) . execution . parquet . reorder_filters = true ;
298299 config. options_mut ( ) . execution . parquet . binary_as_string = true ;
300+ // Allow unordered Parquet scans to split files into row-group morsels and let idle scan
301+ // partitions steal work. Ordered scans set FileScanConfig::preserve_order, which prevents
302+ // file reassignment while retaining their advertised output ordering.
303+ config
304+ . options_mut ( )
305+ . execution
306+ . enable_file_stream_work_stealing = true ;
307+ config. options_mut ( ) . optimizer . repartition_file_scans = true ;
308+
309+ // Feed changing TopK / aggregate bounds into Parquet pruning. This is especially useful
310+ // for observability queries such as `ORDER BY p_timestamp DESC LIMIT N`.
311+ config
312+ . options_mut ( )
313+ . optimizer
314+ . enable_dynamic_filter_pushdown = true ;
315+ config. options_mut ( ) . optimizer . enable_topk_aggregation = true ;
316+ config. options_mut ( ) . optimizer . enable_topk_repartition = true ;
317+ config. options_mut ( ) . optimizer . enable_sort_pushdown = true ;
299318 // Bump footer-read hint from the 512 KiB default. Streams with
300319 // many label columns + page-indexed value columns can have
301320 // parquet footers in the 1-2 MiB range; sizing the hint above
@@ -458,6 +477,7 @@ impl Query {
458477 LogicalPlan :: Explain ( Explain {
459478 explain_format : plan. explain_format ,
460479 verbose : plan. verbose ,
480+ show_statistics : plan. show_statistics ,
461481 stringified_plans : vec ! [
462482 transformed
463483 . data
0 commit comments