xudong963 opened a new issue #1228:
URL: https://github.com/apache/arrow-datafusion/issues/1228


   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   During I try to implement `Select (subquery)` , I add ` 
Select(Box<LogicalPlan>)` in `Expr`. Because `Expr` derives `PartialEq, 
PartialOrd`, but `LogicalPlan` not, I try to derive `PartialEq, PartialOrd` for 
`LogicalPlan`. Unfortunately, I got an error, because some logical plan 
contains traits, such as `TableScan`, which contains the `TableProvider` trait. 
   
   **Describe the solution you'd like**
   In order to achieve better scalability, I think we can extract logical plans 
in LogicalPlan as independent structs. For example
   ```rust
   pub enum LogicalPlan {
      ...
       TableScan {
           /// The name of the table
           table_name: String,
           /// The source of the table
           source: Arc<dyn TableProvider>,
           /// Optional column indices to use as a projection
           projection: Option<Vec<usize>>,
           /// The schema description of the output
           projected_schema: DFSchemaRef,
           /// Optional expressions to be used as filters by the table provider
           filters: Vec<Expr>,
           /// Optional limit to skip reading
           limit: Option<usize>,
       },
      ...
   }
   ```
   ```rust
   pub struct TableScanPlan {
       /// The name of the table
       table_name: String,
       /// The source of the table
       source: Arc<dyn TableProvider>,
       /// Optional column indices to use as a projection
       projection: Option<Vec<usize>>,
       /// The schema description of the output
       projected_schema: DFSchemaRef,
       /// Optional expressions to be used as filters by the table provider
       filters: Vec<Expr>,
       /// Optional limit to skip reading
       limit: Option<usize>,
   }
   
   pub enum LogicalPlan {
     ...
     TableScan(TableScanPlan),
     ...
   }
   
   ```
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features 
you've considered.
   
   **Additional context**
   Add any other context or screenshots about the feature request here.
   


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