nevi-me opened a new issue, #2644:
URL: https://github.com/apache/arrow-datafusion/issues/2644

   When registering a custom `TableProvider`, the provider gets converted to a 
`dyn TableSource` during logical planning. When executing the plan, the source 
is cast back to a provider using `source_to_provider`.
   
   ```rust
   /// Attempt to downcast a TableSource to DefaultTableSource and access the
   /// TableProvider. This will only work with a TableSource created by 
DataFusion.
   pub fn source_as_provider(
       source: &Arc<dyn TableSource>,
   ) -> datafusion_common::Result<Arc<dyn TableProvider>> {
       match source
           .as_ref()
           .as_any()
           .downcast_ref::<DefaultTableSource>()
       {
           Some(source) => Ok(source.table_provider.clone()),
           _ => Err(DataFusionError::Internal(
               "TableSource was not DefaultTableSource".to_string(),
           )),
       }
   }
   ```
   
   It's unclear how I can avoid this by replacing with a custom call that'd 
return my custom table provider. How can I achieve this?
   
   For context, I have the repo https://github.com/nevi-me/datafusion-rdbms-ext 
which has a `PostgresTableProvider`. It used to work before the recent changes 
to add a `TableSource`, but now I'm stuck and I can't figure out an upgrade 
path.
   
   CC @andygrove re the `TableSource` change.


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

Reply via email to