File tree Expand file tree Collapse file tree
datafusion/core/src/datasource/physical_plan/parquet Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -301,10 +301,19 @@ fn size_of_columns(
301301/// columns are sorted. Sorted columns may be queried more efficiently in the presence of
302302/// a PageIndex.
303303fn columns_sorted (
304- _columns : & BTreeSet < usize > ,
305- _metadata : & ParquetMetaData ,
304+ columns : & BTreeSet < usize > ,
305+ metadata : & ParquetMetaData ,
306306) -> Result < bool > {
307- // TODO How do we know this?
307+ // For now we only set sorted with single col with pageIndex
308+ if columns. len ( ) == 1 && metadata. column_index ( ) . is_some ( ) {
309+ for row_group_num in 0 ..metadata. num_row_groups ( ) {
310+ if !metadata. column_index ( ) . unwrap ( ) [ row_group_num] [ * columns. get ( & 0 ) . unwrap ( ) ] . is_sorted ( ) {
311+ // If any Row Group is not sorted we can't assume we can use the PageIndex.
312+ return Ok ( false ) ;
313+ }
314+ }
315+ return Ok ( true ) ;
316+ }
308317 Ok ( false )
309318}
310319
You can’t perform that action at this time.
0 commit comments