This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 3df74b6944 rm downcast (#15575)
3df74b6944 is described below

commit 3df74b6944b7e760ac10c01aefe07a7a825bf886
Author: Jay Zhan <[email protected]>
AuthorDate: Fri Apr 4 21:08:14 2025 +0800

    rm downcast (#15575)
---
 datafusion/core/src/datasource/listing/table.rs | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/datafusion/core/src/datasource/listing/table.rs 
b/datafusion/core/src/datasource/listing/table.rs
index 6049614f37..cfb1f49d47 100644
--- a/datafusion/core/src/datasource/listing/table.rs
+++ b/datafusion/core/src/datasource/listing/table.rs
@@ -875,15 +875,13 @@ impl TableProvider for ListingTable {
             filters.iter().cloned().partition(|filter| {
                 
can_be_evaluted_for_partition_pruning(&table_partition_col_names, filter)
             });
-        // 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 statistic_file_limit = if filters.is_empty() { limit } else { None 
};
 
         let (mut partitioned_file_lists, statistics) = self
-            .list_files_for_scan(session_state, &partition_filters, 
statistic_file_limit)
+            .list_files_for_scan(state, &partition_filters, 
statistic_file_limit)
             .await?;
 
         // if no files need to be read, return an `EmptyExec`
@@ -942,7 +940,7 @@ impl TableProvider for ListingTable {
         self.options
             .format
             .create_physical_plan(
-                session_state,
+                state,
                 FileScanConfigBuilder::new(
                     object_store_url,
                     Arc::clone(&self.file_schema),
@@ -1022,10 +1020,8 @@ impl TableProvider for ListingTable {
         // Get the object store for the table path.
         let store = state.runtime_env().object_store(table_path)?;
 
-        // TODO (https://github.com/apache/datafusion/issues/11600) remove 
downcast_ref from here?
-        let session_state = 
state.as_any().downcast_ref::<SessionState>().unwrap();
         let file_list_stream = pruned_partition_list(
-            session_state,
+            state,
             store.as_ref(),
             table_path,
             &[],
@@ -1073,7 +1069,7 @@ impl TableProvider for ListingTable {
 
         self.options()
             .format
-            .create_writer_physical_plan(input, session_state, config, 
order_requirements)
+            .create_writer_physical_plan(input, state, config, 
order_requirements)
             .await
     }
 


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

Reply via email to