korowa commented on code in PR #13788:
URL: https://github.com/apache/datafusion/pull/13788#discussion_r1885702224


##########
datafusion/core/src/datasource/listing/table.rs:
##########
@@ -843,8 +843,16 @@ impl TableProvider for ListingTable {
             });
         // TODO (https://github.com/apache/datafusion/issues/11600) remove 
downcast_ref from here?
         let session_state = 
state.as_any().downcast_ref::<SessionState>().unwrap();
+
+        // We should not limit the number of partitioned files to scan if 
there are filters and limit
+        // at the same time. This is because the limit should be applied after 
the filters are applied.
+        let mut statistic_file_limit = limit;

Review Comment:
   When running filter + limit query without 
`datafusion.execution.parquet.pushdown_filters = false` I can observe that 
limit = None in this function call, which means that there should be either 
planner or, more likely, and optimizer rule which controls if the limit should 
be pushed down to scan depending on filters.
   
   If so, maybe this logic should be applied there? Otherwise it may be a bit 
painful to have multiple places controlling limit pushdown.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to