You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/31 18:06:49 UTC

[GitHub] [arrow-datafusion] nevi-me commented on issue #2644: [Question] Converting TableSource to custom TableProvider

nevi-me commented on issue #2644:
URL: https://github.com/apache/arrow-datafusion/issues/2644#issuecomment-1142452283

   > Hi @nevi-me where do you create the logical plan in this repo? Can you create a DefaultTableSource wrapping your provider?
   
   If I understand your question correctly, I don't construct any `LogicalPlan` with the provider/source.
   I register all DB tables in the catalog, and the `TableProvider` is used by the default planner to create a `LogicalPlan::TableScan` with my table provider (now table source).
   
   Then when I'm optimizing the plan, I would rewrite the table scan to an extension (https://github.com/nevi-me/datafusion-rdbms-ext/blob/main/src/optimizer.rs#L65)
   
   Before the `TableSource` change, I would downcast `dyn TableProvider` to my `PostgresTableProvider` in `plan_extension()` https://github.com/nevi-me/datafusion-rdbms-ext/blob/main/src/physical_plan.rs#L209-L219.
   
   So now I get the table source back, but because it's created with the default `provider_as_source`, I can't retrieve my custom table provider, which has SQL connection details.


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org