Skip to content

Commit 725e88c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into SPARK-2177
2 parents bb8bbef + 5ad5e34 commit 725e88c

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

core/src/main/scala/org/apache/spark/storage/BlockManager.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,13 @@ private[spark] class BlockManager(
363363
val info = blockInfo.get(blockId).orNull
364364
if (info != null) {
365365
info.synchronized {
366+
// Double check to make sure the block is still there, since removeBlock
367+
// method also synchronizes on BlockInfo object, so the block might have
368+
// been removed when we actually come here.
369+
if (blockInfo.get(blockId).isEmpty) {
370+
logDebug(s"Block $blockId had been removed")
371+
return None
372+
}
366373

367374
// If another thread is writing the block, wait for it to become ready.
368375
if (!info.waitForReady()) {

sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,8 @@ class SQLContext(@transient val sparkContext: SparkContext)
307307
lazy val optimizedPlan = optimizer(analyzed)
308308
// TODO: Don't just pick the first one...
309309
lazy val sparkPlan = planner(optimizedPlan).next()
310+
// executedPlan should not be used to initialize any SparkPlan. It should be
311+
// only used for execution.
310312
lazy val executedPlan: SparkPlan = prepareForExecution(sparkPlan)
311313

312314
/** Internal version of the RDD. Avoids copies and has no schema */

sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ private[sql] abstract class SparkStrategies extends QueryPlanner[SparkPlan] {
251251
case logical.SetCommand(key, value) =>
252252
Seq(execution.SetCommand(key, value, plan.output)(context))
253253
case logical.ExplainCommand(child) =>
254-
val executedPlan = context.executePlan(child).executedPlan
255-
Seq(execution.ExplainCommand(executedPlan, plan.output)(context))
254+
val sparkPlan = context.executePlan(child).sparkPlan
255+
Seq(execution.ExplainCommand(sparkPlan, plan.output)(context))
256256
case logical.CacheCommand(tableName, cache) =>
257257
Seq(execution.CacheCommand(tableName, cache)(context))
258258
case _ => Nil

0 commit comments

Comments
 (0)