== Parsed Logical Plan ==
'Project ['emp.id, 'emp.name, 'emp.email, 'emp2.name AS manager_name#68, 'dep.dep_name]
+- 'Join Inner, ('emp.dep_id = 'dep.dep_id)
:- 'Join LeftOuter, ('emp2.id = 'emp.manager_id)
: :- 'UnresolvedRelation `employee`, emp
: +- 'UnresolvedRelation `employee`, emp2
+- 'UnresolvedRelation `department`, dep
== Analyzed Logical Plan ==
id: bigint, name: string, email: string, manager_name: string, dep_name: string
Project [id#0L, name#1, email#2, name#80 AS manager_name#68, dep_name#13]
+- Join Inner, (dep_id#4L = dep_id#12L)
:- Join LeftOuter, (id#79L = manager_id#3L)
: :- SubqueryAlias emp
: : +- SubqueryAlias employee
: : +- LogicalRDD [id#0L, name#1, email#2, manager_id#3L, dep_id#4L]
: +- SubqueryAlias emp2
: +- SubqueryAlias employee
: +- LogicalRDD [id#79L, name#80, email#81, manager_id#82L, dep_id#83L]
+- SubqueryAlias dep
+- SubqueryAlias department
+- LogicalRDD [dep_id#12L, dep_name#13]
== Optimized Logical Plan ==
Project [id#0L, name#1, email#2, name#80 AS manager_name#68, dep_name#13]
+- Join Inner, (dep_id#4L = dep_id#12L)
:- Project [id#0L, name#1, email#2, dep_id#4L, name#80]
: +- Join LeftOuter, (id#79L = manager_id#3L)
: :- Filter isnotnull(dep_id#4L)
: : +- LogicalRDD [id#0L, name#1, email#2, manager_id#3L, dep_id#4L]
: +- Project [id#79L, name#80]
: +- LogicalRDD [id#79L, name#80, email#81, manager_id#82L, dep_id#83L]
+- Filter isnotnull(dep_id#12L)
+- LogicalRDD [dep_id#12L, dep_name#13]
== Physical Plan ==
*Project [id#0L, name#1, email#2, name#80 AS manager_name#68, dep_name#13]
+- *SortMergeJoin [dep_id#4L], [dep_id#12L], Inner
:- *Sort [dep_id#4L ASC], false, 0
: +- Exchange hashpartitioning(dep_id#4L, 200)
: +- *Project [id#0L, name#1, email#2, dep_id#4L, name#80]
: +- SortMergeJoin [manager_id#3L], [id#79L], LeftOuter
: :- *Sort [manager_id#3L ASC], false, 0
: : +- Exchange hashpartitioning(manager_id#3L, 200)
: : +- *Filter isnotnull(dep_id#4L)
: : +- Scan ExistingRDD[id#0L,name#1,email#2,manager_id#3L,dep_id#4L]
: +- *Sort [id#79L ASC], false, 0
: +- Exchange hashpartitioning(id#79L, 200)
: +- *Project [id#79L, name#80]
: +- Scan ExistingRDD[id#79L,name#80,email#81,manager_id#82L,dep_id#83L]
+- *Sort [dep_id#12L ASC], false, 0
+- Exchange hashpartitioning(dep_id#12L, 200)
+- *Filter isnotnull(dep_id#12L)
+- Scan ExistingRDD[dep_id#12L,dep_name#13]