ulysses-you commented on code in PR #38176:
URL: https://github.com/apache/spark/pull/38176#discussion_r994485856


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/DynamicJoinSelection.scala:
##########
@@ -89,13 +111,19 @@ object DynamicJoinSelection extends Rule[LogicalPlan] with 
JoinSelectionHelper {
           false
         }
 
-        val preferShuffleHash = preferShuffledHashJoin(stage.mapStats.get)
+        val preferShuffleHash = streamedPlan match {
+          case LogicalQueryStage(_, streamedStage: ShuffleQueryStageExec)
+            if streamedStage.isMaterialized && 
streamedStage.mapStats.isDefined =>
+            preferShuffledHashJoin(stage.mapStats.get, 
streamedStage.mapStats.get)
+
+          case _ => false

Review Comment:
   this will be regression.. it prevents multi-join convert to shj, e.g.:
   
   ```
   SortMergejoin 2
     SortMergeJoin 1
       Shuffle 1
       Shuffle 2
     Shuffe 3
   ```
   The join 2 can not convert to shj even shuffle 3 is small



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

Reply via email to