MCPcopy Create free account
hub / github.com/apache/datafusion / downcast_to_file_source

Method downcast_to_file_source

datafusion/datasource/src/source.rs:597–608  ·  view source on GitHub ↗

Downcast the `DataSourceExec`'s `data_source` to a specific file source Returns `None` if 1. the datasource is not scanning files (`FileScanConfig`) 2. The [`FileScanConfig::file_source`] is not of type `T`

(
        &self,
    )

Source from the content-addressed store, hash-verified

595 /// 1. the datasource is not scanning files (`FileScanConfig`)
596 /// 2. The [`FileScanConfig::file_source`] is not of type `T`
597 pub fn downcast_to_file_source<T: FileSource>(
598 &self,
599 ) -> Option<(&FileScanConfig, &T)> {
600 self.data_source()
601 .downcast_ref::<FileScanConfig>()
602 .and_then(|file_scan_conf| {
603 file_scan_conf
604 .file_source()
605 .downcast_ref::<T>()
606 .map(|source| (file_scan_conf, source))
607 })
608 }
609}
610
611/// Create a new `DataSourceExec` from a `DataSource`

Callers

nothing calls this directly

Calls 3

data_sourceMethod · 0.80
mapMethod · 0.45
file_sourceMethod · 0.45

Tested by

no test coverage detected