cloud-fan commented on code in PR #58506:
URL: https://github.com/apache/spark/pull/58506#discussion_r4249117583
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/PropagateEmptyRelation.scala:
##########
@@ -123,6 +125,13 @@ abstract class PropagateEmptyRelationBase extends
Rule[LogicalPlan] with CastSup
Project(p.left.output ++ nullValueProjectList(p.right), p.left)
case RightOuter if isFalseCondition &&
canExecuteWithoutJoin(p.right) =>
Project(nullValueProjectList(p.left) ++ p.right.output, p.right)
+ // No row of either side can find a match, so the join degenerates
into both sides
+ // padded with nulls and concatenated.
+ case FullOuter if isFalseCondition && canExecuteWithoutJoin(p.left)
&&
+ canExecuteWithoutJoin(p.right) =>
+ Union(
+ Project(p.left.output ++ nullValueProjectList(p.right), p.left),
Review Comment:
**Non-blocking (P2):** The first Union branch synthesizes the right-side
columns with `nullValueProjectList`, whose aliases retain only the name and
ExprId. Because `Union.mergeChildOutputs` takes metadata and qualifiers from
the first branch, this rewrite drops those properties from the right-side
optimized output even though the original `FullOuter` output preserves them.
The new tests use metadata-free inputs or inspect the analyzed schema, so they
do not catch this regression.
**Verification:**
- **Regression:** Optimize a literal-false full outer join whose left and
right attributes carry distinct metadata and qualifiers, then assert that
optimized output matches the analyzed Join output for names, data types,
ExprIds, qualifiers, metadata, and widened nullability.
- **Behavior:** Execute representative standalone and generated MERGE
false-condition full outer plans and verify unchanged padded rows together with
Union execution and absence of the nested-loop join.
- **Compatibility:** Exercise the other outer-join simplifications that
share nullValueProjectList and verify preserving attribute properties does not
change their row results, output positions, or ExprIds.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]