ygf11 commented on code in PR #4760:
URL: https://github.com/apache/arrow-datafusion/pull/4760#discussion_r1058870767
##########
datafusion/optimizer/src/extract_equijoin_predicate.rs:
##########
@@ -387,4 +357,33 @@ mod tests {
assert_plan_eq(&plan, expected)
}
+
+ #[test]
+ fn join_with_alias_filter() -> Result<()> {
+ let t1 = test_table_scan_with_name("t1")?;
+ let t2 = test_table_scan_with_name("t2")?;
+
+ let t1_schema = t1.schema().clone();
+ let t2_schema = t2.schema().clone();
+
+ // filter: t1.a + CAST(Int64(1), UInt32) = t2.a + CAST(Int64(2),
UInt32) as t1.a + 1 = t2.a + 2
+ let filter = Expr::eq(
+ col("t1.a") + lit(1i64).cast_to(&DataType::UInt32, &t1_schema)?,
+ col("t2.a") + lit(2i32).cast_to(&DataType::UInt32, &t2_schema)?,
+ )
+ .alias("t1.a + 1 = t2.a + 2");
+ let plan = LogicalPlanBuilder::from(t1)
Review Comment:
The `split_conjunction` will unalias the expr.
--
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]