You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SimplifyExpressions will fail when rebuild equijoin with alias #4754
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
After #4666, LogicalPlan::expressions() and from_plan will combine and rebuild the equijoin keys.
But the from_plan may fail when the SimplifyExpressions rule gives the expression an alias.
For example,a test case with SimplifyExpressions rule:
#[test]fnsimplify_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()?;// before simplify: t1.a + CAST(Int64(1), UInt32) = t2.a + CAST(Int64(2), UInt32)// after simplify: t1.a + UInt32(1) = t2.a + UInt32(2) AS t1.a + Int64(1) = t2.a + Int64(2)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.
Activity