You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/12/28 07:33:57 UTC

[GitHub] [arrow-datafusion] ygf11 opened a new issue, #4754: SimplifyExpressions will fail when rebuild equijoin with alias

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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb closed issue #4754: SimplifyExpressions will fail when rebuild equijoin with alias

Posted by GitBox <gi...@apache.org>.
alamb closed issue #4754: SimplifyExpressions will fail when rebuild equijoin with alias
URL: https://github.com/apache/arrow-datafusion/issues/4754


-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org