tanelk commented on a change in pull request #29871:
URL: https://github.com/apache/spark/pull/29871#discussion_r495117673



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/CostBasedJoinReorder.scala
##########
@@ -342,7 +347,10 @@ object JoinReorderDP extends PredicateHelper with Logging {
     /** Get the cost of the root node of this plan tree. */
     def rootCost(conf: SQLConf): Cost = {
       if (itemIds.size > 1) {
-        val rootStats = plan.stats
+        val rootStats = (plan transform {
+          // The OrderedJoin does not propagate stats
+          case OrderedJoin(left, right, jt, cond) => Join(left, right, jt, 
cond, JoinHint.NONE)
+        }).stats

Review comment:
       This is an unfortunate consequence of starting the reordering from the 
bottom. If anybody has suggestions on how to avoid this, I would happily hear 
you. 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to