JanKaul commented on issue #17719:
URL: https://github.com/apache/datafusion/issues/17719#issuecomment-3381144592

   Do you think it would make sense to create an API for LogicalPlans to also 
provide some statistics such as an cardinality estimate?
   
   Since this is probably also very use case dependent, it might make sense to 
also define an interface for it.
   
   I was thinking of something like this:
   
   ```rust
   trait LogicalStatisticsProvider: TreeNode {
     fn statistics(&self) -> Statistics;
   }
   ```
   One could then provide custom estimates:
   ```rust
   impl LogicalStatisticsProvider for LogicalPlan {
     fn statistics(&self) -> Statistics {
       match self {
         LogicalPlan::TableScan(scan) => scan.statistics(),
         LogicalPlan::Filter(filter) => {
           ... selectivity logic for filter column
         }
       }
   
   }
   ```
   
   This would provide the necessary information to do the Join Order 
optimization at the LogicalPlan level.


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

Reply via email to