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