You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "ulysses-you (via GitHub)" <gi...@apache.org> on 2024/03/01 04:07:50 UTC

Re: [PR] [SPARK-47177][SQL] Cached SQL plan do not display final AQE plan in explain string [spark]

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


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AdaptiveSparkPlanExec.scala:
##########
@@ -87,7 +87,7 @@ case class AdaptiveSparkPlanExec(
 
   // The logical plan optimizer for re-optimizing the current logical plan.
   @transient private val optimizer = new AQEOptimizer(conf,
-    session.sessionState.adaptiveRulesHolder.runtimeOptimizerRules)
+    context.session.sessionState.adaptiveRulesHolder.runtimeOptimizerRules)

Review Comment:
   I face an issue so change this
   ```
   py4j.protocol.Py4JJavaError: An error occurred while calling o6764.fit.
   : java.lang.NullPointerException: Cannot invoke "org.apache.spark.sql.SparkSession.sessionState()" because the return value of "org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanExec.session()" is null
   	at org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanExec.<init>(AdaptiveSparkPlanExec.scala:90)
   	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
   	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
   	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
   	at org.apache.spark.sql.catalyst.trees.TreeNode.$anonfun$makeCopy$6(TreeNode.scala:743)
   	at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(origin.scala:83)
   	at org.apache.spark.sql.catalyst.trees.TreeNode.makeCopy(TreeNode.scala:742)
   	at org.apache.spark.sql.catalyst.trees.TreeNode.clone(TreeNode.scala:798)
   	at org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanExec.clone(AdaptiveSparkPlanExec.scala:502)
   	at org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanExec.clone(AdaptiveSparkPlanExec.scala:67)
   	at org.apache.spark.sql.execution.columnar.InMemoryRelation.innerChildren(InMemoryRelation.scala:418)
   	at org.apache.spark.sql.catalyst.trees.TreeNode.generateTreeString(TreeNode.scala:1012)
   ```



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org