wecharyu commented on code in PR #13092:
URL: https://github.com/apache/gluten/pull/13092#discussion_r4129374072


##########
gluten-substrait/src/main/scala/org/apache/spark/sql/execution/GlutenAutoAdjustStageResourceProfile.scala:
##########
@@ -269,16 +273,25 @@ object GlutenAutoAdjustStageResourceProfile extends 
Logging {
       taskResource: mutable.Map[String, TaskResourceRequest],
       rpManager: ResourceProfileManager,
       sparkConf: SparkConf): SparkPlan = {
-    val rp = new ResourceProfile(executorResource.toMap, taskResource.toMap)
-    val finalRP = getFinalResourceProfile(rpManager, rp)
-    updateResourceSetting(finalRP, sparkConf)
+    lazy val finalRP = {
+      val rp = new ResourceProfile(executorResource.toMap, taskResource.toMap)
+      val profile = getFinalResourceProfile(rpManager, rp)
+      updateResourceSetting(profile, sparkConf)
+      profile
+    }
 
     plan match {
       case shuffle: Exchange =>
         logInfo(s"Apply resource profile $finalRP for plan 
${shuffle.child.nodeName}")
         // Wrap the plan with ApplyResourceProfileExec so that we can apply 
new ResourceProfile
         val wrapperPlan = ApplyResourceProfileExec(shuffle.child, finalRP)
         shuffle.withNewChildren(Seq(wrapperPlan))
+      case command: DataWritingCommandExec =>
+        logInfo(s"Apply resource profile $finalRP for write input 
${command.child.nodeName}")
+        command.withNewChildren(Seq(ApplyResourceProfileExec(command.child, 
finalRP)))
+      case write: V2TableWriteExec =>
+        logInfo(s"Apply resource profile $finalRP for V2 write input 
${write.child.nodeName}")
+        write.withNewChildren(Seq(ApplyResourceProfileExec(write.child, 
finalRP)))

Review Comment:
   Addressed.



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