This is an automated email from the ASF dual-hosted git repository.

beliefer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new eea141813068 [SPARK-54726][SQL] Improve a bit of performance for 
InsertAdaptiveSparkPlan
eea141813068 is described below

commit eea141813068c27db9f79653e6db120be074fb4c
Author: beliefer <[email protected]>
AuthorDate: Wed Dec 17 14:59:06 2025 +0800

    [SPARK-54726][SQL] Improve a bit of performance for InsertAdaptiveSparkPlan
    
    ### What changes were proposed in this pull request?
    This PR proposes to improve a bit of performance for 
`InsertAdaptiveSparkPlan` and simplify some code.
    
    ### Why are the changes needed?
    Improve a bit of performance for `InsertAdaptiveSparkPlan`
    
    ### Does this PR introduce _any_ user-facing change?
    'No'.
    Just inner change.
    
    ### How was this patch tested?
    GA tests.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    'No'.
    
    Closes #53498 from beliefer/SPARK-54726.
    
    Authored-by: beliefer <[email protected]>
    Signed-off-by: beliefer <[email protected]>
---
 .../spark/sql/execution/adaptive/InsertAdaptiveSparkPlan.scala     | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/InsertAdaptiveSparkPlan.scala
 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/InsertAdaptiveSparkPlan.scala
index 69dd4d68e48b..d8f850ab2189 100644
--- 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/InsertAdaptiveSparkPlan.scala
+++ 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/InsertAdaptiveSparkPlan.scala
@@ -111,17 +111,14 @@ case class InsertAdaptiveSparkPlan(
     conf.getConf(SQLConf.ADAPTIVE_EXECUTION_FORCE_APPLY) || isSubquery || {
       plan.exists {
         case _: Exchange => true
-        case p if !p.requiredChildDistribution.forall(_ == 
UnspecifiedDistribution) => true
+        case p if p.requiredChildDistribution.exists(_ != 
UnspecifiedDistribution) => true
         // AQE framework has a different way to update the query plan in the 
UI: it updates the plan
         // at the end of execution, while non-AQE updates the plan before 
execution. If the cached
         // plan is already AQEed, the current plan must be AQEed as well so 
that the UI can get plan
         // update correctly.
         case i: InMemoryTableScanExec
             if i.relation.cachedPlan.isInstanceOf[AdaptiveSparkPlanExec] => 
true
-        case p => p.expressions.exists(_.exists {
-          case _: SubqueryExpression => true
-          case _ => false
-        })
+        case p => 
p.expressions.exists(_.exists(_.isInstanceOf[SubqueryExpression]))
       }
     }
   }


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

Reply via email to