zhuqi-lucas commented on code in PR #13788: URL: https://github.com/apache/datafusion/pull/13788#discussion_r1885718222
########## 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; + if !filters.is_empty() { + statistic_file_limit = None; + } Review Comment: Good suggestion @korowa ! -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org