cloud-fan commented on code in PR #45054:
URL: https://github.com/apache/spark/pull/45054#discussion_r1480902456
##########
sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala:
##########
@@ -1630,20 +1630,37 @@ class CachedTableSuite extends QueryTest with
SQLTestUtils
SQLConf.COALESCE_PARTITIONS_MIN_PARTITION_NUM.key -> "1",
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true") {
- var finalPlan = ""
+ var finalPlan: SparkPlanInfo = null
val listener = new SparkListener {
override def onOtherEvent(event: SparkListenerEvent): Unit = {
event match {
- case SparkListenerSQLAdaptiveExecutionUpdate(_, physicalPlanDesc,
sparkPlanInfo) =>
+ case SparkListenerSQLAdaptiveExecutionUpdate(_, _, sparkPlanInfo)
=>
if (sparkPlanInfo.simpleString.startsWith(
"AdaptiveSparkPlan isFinalPlan=true")) {
- finalPlan = physicalPlanDesc
+ finalPlan = sparkPlanInfo
}
case _ => // ignore other events
}
}
}
+ def findNodeInSparkPlanInfo(root: SparkPlanInfo, cond: SparkPlanInfo =>
Boolean):
+ Option[SparkPlanInfo] = {
+ if (cond(root)) {
+ Some(root)
+ } else {
+ root.children.flatMap(findNodeInSparkPlanInfo(_, cond)).headOption
+ }
+ }
+
+ def cachedFinalStageCoalesced(sparkPlanInfo: SparkPlanInfo): Boolean = {
+ val inMemoryScanNode = findNodeInSparkPlanInfo(sparkPlanInfo,
+ _.nodeName.contains("TableCacheQueryStage"))
+ val resultNode = findNodeInSparkPlanInfo(inMemoryScanNode.get,
+ _.nodeName.contains("ResultQueryStage"))
Review Comment:
there is no `ResultQueryStage` in Spark.
--
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]