jayzhan211 commented on PR #11516:
URL: https://github.com/apache/datafusion/pull/11516#issuecomment-2239052594
I think there is clear dependency something close to
`Catalog` -> `Schema` -> `Table` -> `FileFormat` -> `QueryPlanner`.
They all have trait and trait implementation and we can easily downcast the
trait to actual struct in the lower crate.
```rust
// queryplanner crate
trait QueryPlanner {}
impl QueryPlanner for DefaultPlanner {}
// fileformat crate
trait FileFormat {}
impl FileFormat for DefaultFile {
fn get_planner(&self, plan) -> Arc<QueryPlanner> { // able to downcast to
planner }
}
// Table crate
trait TableProvider {}
impl TableProvider for DefaultTable {
// arguments are all higher level trait without circular dependency
fn get_file(&self, plan) -> Arc<QueryPlanner> { // able to downcast to
actual planner }
fn get_planner(&self, fileformat) -> Arc<FileFormat> { // able to
downcast to actual format}
}
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]