jchen5 commented on code in PR #39759:
URL: https://github.com/apache/spark/pull/39759#discussion_r1107634707
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/DecorrelateInnerQuery.scala:
##########
@@ -254,24 +255,104 @@ object DecorrelateInnerQuery extends PredicateHelper {
/**
* Rewrites a domain join cond so that it can be pushed to the right side of
a
* union/intersect/except operator.
+ *
+ * Example: Take a query like:
+ * select * from t0 join lateral (
+ * select a from t1 where b < t0.x
+ * union all
+ * select b from t2 where c < t0.y)
+ *
+ * We have outer table with attributes [x#1, y#2] and after introducing
DomainJoins the subquery
+ * is a Union where the left side has output [a#3, x#4, y#5] with DomainJoin
[x#4, y#5]
Review Comment:
All the x and y attributes are from t0. They just are different instances of
the attributes - they come from separate joins of the outer table - and have
different expression IDs. Will update the comment to explain that more.
--
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]