friendlymatthew commented on code in PR #17242:
URL: https://github.com/apache/datafusion/pull/17242#discussion_r2301595761


##########
datafusion/datasource/src/source.rs:
##########
@@ -465,18 +468,9 @@ impl DataSourceExec {
     ///
     /// Returns `None` if
     /// 1. the datasource is not scanning files (`FileScanConfig`)
-    /// 2. The [`FileScanConfig::file_source`] is not of type `T`
-    pub fn downcast_to_file_source<T: 'static>(&self) -> 
Option<(&FileScanConfig, &T)> {
-        self.data_source()
-            .as_any()
-            .downcast_ref::<FileScanConfig>()
-            .and_then(|file_scan_conf| {
-                file_scan_conf
-                    .file_source()
-                    .as_any()
-                    .downcast_ref::<T>()
-                    .map(|source| (file_scan_conf, source))
-            })
+    /// 2. the file source is not of type `T`
+    pub fn downcast_to_file_source<T: FileSource + 'static>(&self) -> 
Option<&T> {
+        self.data_source().as_any().downcast_ref::<T>()
     }

Review Comment:
   I don't think this is necessarily a bad code smell. It's used whenever we 
need to downcast to a `FileSource`. It just reduces the # LOC



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

Reply via email to