Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions datafusion/expr/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2779,12 +2779,12 @@ mod tests {

assert_snapshot!(plan, @r"
Union
Cross Join:
Cross Join:
SubqueryAlias: left
Values: (Int32(1))
SubqueryAlias: right
Values: (Int32(1))
Cross Join:
Cross Join:
SubqueryAlias: left
Values: (Int32(1))
SubqueryAlias: right
Expand Down
17 changes: 10 additions & 7 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1973,13 +1973,16 @@ impl LogicalPlan {
};
match join_constraint {
JoinConstraint::On => {
write!(
f,
"{} Join: {}{}",
join_type,
join_expr.join(", "),
filter_expr
)
write!(f, "{join_type} Join:",)?;
if !join_expr.is_empty() || !filter_expr.is_empty() {
write!(
f,
" {}{}",
join_expr.join(", "),
filter_expr
)?;
}
Ok(())
}
JoinConstraint::Using => {
write!(
Expand Down
14 changes: 7 additions & 7 deletions datafusion/optimizer/src/eliminate_cross_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ mod tests {
plan,
@ r"
Filter: t1.a = t2.a OR t2.b = t1.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]
TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]
"
Expand Down Expand Up @@ -610,7 +610,7 @@ mod tests {
plan,
@ r"
Filter: t1.a = t2.a AND t2.c < UInt32(15) OR t1.b = t2.b AND t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]
TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]
"
Expand All @@ -636,7 +636,7 @@ mod tests {
plan,
@ r"
Filter: t1.a = t2.a AND t2.c < UInt32(15) OR t1.a = t2.a OR t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]
TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]
"
Expand Down Expand Up @@ -858,7 +858,7 @@ mod tests {
plan,
@ r"
Filter: t3.a = t1.a AND t4.c < UInt32(15) OR t3.a = t1.a OR t4.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Filter: t2.c < UInt32(15) OR t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Inner Join: t1.a = t2.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]
Expand Down Expand Up @@ -938,7 +938,7 @@ mod tests {
TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]
TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]
Filter: t3.a = t4.a AND t4.c < UInt32(15) OR t3.a = t4.a AND t3.c = UInt32(688) OR t3.a = t4.a OR t3.b = t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
TableScan: t3 [a:UInt32, b:UInt32, c:UInt32]
TableScan: t4 [a:UInt32, b:UInt32, c:UInt32]
"
Expand Down Expand Up @@ -1012,7 +1012,7 @@ mod tests {
Filter: t4.c < UInt32(15) OR t4.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Inner Join: t1.a = t3.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Filter: t1.a = t2.a OR t2.c < UInt32(15) OR t1.a = t2.a AND t2.c = UInt32(688) [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]
TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]
Filter: t4.c < UInt32(15) OR t3.c = UInt32(688) OR t3.b = t4.b [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Expand Down Expand Up @@ -1248,7 +1248,7 @@ mod tests {
plan,
@ r"
Filter: t1.a + UInt32(100) = t2.a * UInt32(2) OR t2.b = t1.a [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
Cross Join: [a:UInt32, b:UInt32, c:UInt32, a:UInt32, b:UInt32, c:UInt32]
TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]
TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]
"
Expand Down
4 changes: 2 additions & 2 deletions datafusion/optimizer/src/push_down_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,7 @@ mod tests {
plan,
@r"
Projection: test.a, test1.d
Cross Join:
Cross Join:
Projection: test.a, test.b, test.c
TableScan: test, full_filters=[test.a = Int32(1)]
Projection: test1.d, test1.e, test1.f
Expand Down Expand Up @@ -2362,7 +2362,7 @@ mod tests {
plan,
@r"
Projection: test.a, test1.a
Cross Join:
Cross Join:
Projection: test.a, test.b, test.c
TableScan: test, full_filters=[test.a = Int32(1)]
Projection: test1.a, test1.b, test1.c
Expand Down
4 changes: 2 additions & 2 deletions datafusion/optimizer/src/push_down_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ mod test {
plan,
@r"
Limit: skip=0, fetch=1000
Cross Join:
Cross Join:
Limit: skip=0, fetch=1000
TableScan: test, fetch=1000
Limit: skip=0, fetch=1000
Expand All @@ -1067,7 +1067,7 @@ mod test {
plan,
@r"
Limit: skip=1000, fetch=1000
Cross Join:
Cross Join:
Limit: skip=0, fetch=2000
TableScan: test, fetch=2000
Limit: skip=0, fetch=2000
Expand Down
2 changes: 1 addition & 1 deletion datafusion/sql/tests/cases/plan_to_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ fn roundtrip_crossjoin() -> Result<()> {
plan_roundtrip,
@r"
Projection: j1.j1_id, j2.j2_string
Cross Join:
Cross Join:
TableScan: j1
TableScan: j2
"
Expand Down
12 changes: 6 additions & 6 deletions datafusion/sql/tests/sql_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3395,8 +3395,8 @@ fn cross_join_not_to_inner_join() {
@r"
Projection: person.id
Filter: person.id = person.age
Cross Join:
Cross Join:
Cross Join:
Cross Join:
TableScan: person
TableScan: orders
TableScan: lineitem
Expand Down Expand Up @@ -3530,11 +3530,11 @@ fn exists_subquery_schema_outer_schema_overlap() {
Subquery:
Projection: person.first_name
Filter: person.id = p2.id AND person.last_name = outer_ref(p.last_name) AND person.state = outer_ref(p.state)
Cross Join:
Cross Join:
TableScan: person
SubqueryAlias: p2
TableScan: person
Cross Join:
Cross Join:
TableScan: person
SubqueryAlias: p
TableScan: person
Expand Down Expand Up @@ -3619,10 +3619,10 @@ fn scalar_subquery_reference_outer_field() {
Projection: count(*)
Aggregate: groupBy=[[]], aggr=[[count(*)]]
Filter: outer_ref(j2.j2_id) = j1.j1_id AND j1.j1_id = j3.j3_id
Cross Join:
Cross Join:
TableScan: j1
TableScan: j3
Cross Join:
Cross Join:
TableScan: j1
TableScan: j2
"
Expand Down
Loading