cloud-fan commented on a change in pull request #23303: [SPARK-26352][SQL]
ReorderJoin should not change the order of columns
URL: https://github.com/apache/spark/pull/23303#discussion_r241258137
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/joins.scala
##########
@@ -99,6 +99,14 @@ object ReorderJoin extends Rule[LogicalPlan] with
PredicateHelper {
} else {
createOrderedJoin(input, conditions)
}
+
+ if (p.sameOutput(reordered)) {
+ reordered
+ } else {
+ // Reordering the joins have changed the order of the columns.
+ // Inject a projection to make sure we restore to the expected
ordering.
+ Project(p.output, reordered)
Review comment:
just for curiosity, we only need this for top-level join? I feel it's ok to
change the columnar order for intermedia joins.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]