Skip to content

Commit

Permalink
[SPARK-13423][HOTFIX] Static analysis fixes for 2.x / fixed for Scala…
Browse files Browse the repository at this point in the history
… 2.10

## What changes were proposed in this pull request?

Fixes compile problem due to inadvertent use of `Option.contains`, only in Scala 2.11. The change should have been to replace `Option.exists(_ == x)` with `== Some(x)`. Replacing exists with contains only makes sense for collections. Replacing use of `Option.exists` still makes sense though as it's misleading.

## How was this patch tested?

Jenkins tests / compilation

(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)

Author: Sean Owen <[email protected]>

Closes #11493 from srowen/SPARK-13423.2.
  • Loading branch information
srowen committed Mar 3, 2016
1 parent b5f02d6 commit 645c3a8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/ui/jobs/JobsTab.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private[ui] class JobsTab(parent: SparkUI) extends SparkUITab(parent, "jobs") {
val operationGraphListener = parent.operationGraphListener

def isFairScheduler: Boolean =
jobProgresslistener.schedulingMode.contains(SchedulingMode.FAIR)
jobProgresslistener.schedulingMode == Some(SchedulingMode.FAIR)

attachPage(new AllJobsPage(this))
attachPage(new JobPage(this))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private[ui] class StagesTab(parent: SparkUI) extends SparkUITab(parent, "stages"
attachPage(new StagePage(this))
attachPage(new PoolPage(this))

def isFairScheduler: Boolean = progressListener.schedulingMode.contains(SchedulingMode.FAIR)
def isFairScheduler: Boolean = progressListener.schedulingMode == Some(SchedulingMode.FAIR)

def handleKillRequest(request: HttpServletRequest): Unit = {
if (killEnabled && parent.securityManager.checkModifyPermissions(request.getRemoteUser)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private[spark] class SQLHistoryListener(conf: SparkConf, sparkUI: SparkUI)
taskEnd.taskInfo.accumulables.flatMap { a =>
// Filter out accumulators that are not SQL metrics
// For now we assume all SQL metrics are Long's that have been JSON serialized as String's
if (a.metadata.contains(SQLMetrics.ACCUM_IDENTIFIER)) {
if (a.metadata == Some(SQLMetrics.ACCUM_IDENTIFIER)) {
val newValue = new LongSQLMetricValue(a.update.map(_.toString.toLong).getOrElse(0L))
Some(a.copy(update = Some(newValue)))
} else {
Expand Down

0 comments on commit 645c3a8

Please sign in to comment.