ygf11 opened a new issue, #4754:
URL: https://github.com/apache/arrow-datafusion/issues/4754

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   After #, `LogicalPlan::expressions()` and `from_plan` will combine and split 
equijoin keys.
   But the  `SimplifyExpressions` may make `from_plan` fail when it generate an 
alias
   
   For example,a test case with `SimplifyExpressions` rule:
   ```rust
   #[test]
   fn simplify_equijoin_predicate() -> Result<()> {
       let t1 = test_table_scan_with_name("t1")?;
       let t2 = test_table_scan_with_name("t2")?;
   
       let left_key = col("t1.a") + lit(1i64).cast_to(&DataType::UInt32, 
t1.schema())?;
       let right_key = col("t2.a") + lit(2i64).cast_to(&DataType::UInt32, 
t2.schema())?;
       let plan = LogicalPlanBuilder::from(t1)
           .join_with_expr_keys(
               t2,
               JoinType::Inner,
               (vec![left_key], vec![right_key]),
               None,
           )?
           .build()?;
   
       // t1.a + CAST(Int64(1), UInt32) = t2.a + CAST(Int64(1), UInt32) ==> 
t1.a + UInt32(1) = t2.a + UInt32(2) as xxx
       let rule = SimplifyExpressions::new();
       let _ = rule
           .try_optimize(&plan, &OptimizerContext::new())
           // this result is a Error
           .unwrap()
           .expect("failed to optimize plan");
       .....
       Ok(())
   }
   ```
   
   **Describe the solution you'd like**
   Add alias check for the given expression in from_plan.
   
   **Describe alternatives you've considered**
   
   **Additional context**
   


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