-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-20127][CORE] few warning have been fixed which Intellij IDEA reported Intellij IDEA #17458
Conversation
…eported Intellij IDEA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I brought forward some comments but everything else looks OK. I'd be OK accepting the other changes.
@@ -56,7 +56,7 @@ private[spark] class SparkUI private ( | |||
with Logging | |||
with UIRoot { | |||
|
|||
val killEnabled = sc.map(_.conf.getBoolean("spark.ui.killEnabled", true)).getOrElse(false) | |||
val killEnabled = sc.exists(_.conf.getBoolean("spark.ui.killEnabled", true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bringing forward some of my comments: I would probably not change this
def getTimeZoneOffset() : Int = | ||
TimeZone.getDefault().getOffset(System.currentTimeMillis()) / 1000 / 60 | ||
def getTimeZoneOffset(): Int = | ||
TimeZone.getDefault.getOffset(System.currentTimeMillis()) / 1000 / 60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also wouldn't remove the parens here (though the convention was always to use parens when calling no-arg Java methods?) or elsewhere. That really isn't done consistently at all anyway.
@@ -31,7 +31,7 @@ private[ui] class JobsTab(parent: SparkUI) extends SparkUITab(parent, "jobs") { | |||
val operationGraphListener = parent.operationGraphListener | |||
|
|||
def isFairScheduler: Boolean = | |||
jobProgresslistener.schedulingMode == Some(SchedulingMode.FAIR) | |||
jobProgresslistener.schedulingMode.contains(SchedulingMode.FAIR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise not sure about this change
@@ -290,7 +290,7 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") { | |||
val _taskTable = new TaskPagedTable( | |||
parent.conf, | |||
UIUtils.prependBaseUri(parent.basePath) + | |||
s"/stages/stage?id=${stageId}&attempt=${stageAttemptId}", | |||
s"/stages/stage?id=$stageId&attempt=$stageAttemptId", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree they can be omitted but not sure it helps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the change was reverted.
@@ -317,7 +317,7 @@ private[spark] object UIUtils extends Logging { | |||
def getHeaderContent(header: String): Seq[Node] = { | |||
if (newlinesInHeader) { | |||
<ul class="unstyled"> | |||
{ header.split("\n").map { case t => <li> {t} </li> } } | |||
{ header.split("\n").map(t => <li> {t} </li>)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we normally use {}
in this code, like map { t => xxx }
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That also works and gets rid of case
. I personally prefer not opening a scope if it's not needed, and it isn't here, but it's minor as it's just a question of () vs {} and would rarely have any other impact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed almost changes related to UI.
There're many changes related to UI part, actually we don't have many unit tests covered in this part, so I'm afraid these change may potentially introduce regression. |
@@ -35,7 +35,7 @@ private[ui] class StagesTab(parent: SparkUI) extends SparkUITab(parent, "stages" | |||
attachPage(new StagePage(this)) | |||
attachPage(new PoolPage(this)) | |||
|
|||
def isFairScheduler: Boolean = progressListener.schedulingMode == Some(SchedulingMode.FAIR) | |||
def isFairScheduler: Boolean = progressListener.schedulingMode.contains(SchedulingMode.FAIR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to my knowledge, contains
on Option
breaks Scala 2.10 build (see #15393). I guess we are going to drop the support but not yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that comment. I did not know that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, this was reverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems not reverted yet..
val executorOverhead = (metrics.executorDeserializeTime + | ||
metrics.resultSerializationTime) | ||
val executorOverhead = metrics.executorDeserializeTime + | ||
metrics.resultSerializationTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can make this inlined if more commits should be pushed.
Probably, I guess this might be fine. Just in my experience, IntelliJ's inspection was quite okay except the case of breaking Scala 2.10. It might be better if they can be manually tested via UI though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Folks, could you please go back to review? Looks like I reverted all my changes related to your comments.
They are suggestions in my point of view. it doesn't necessarily mean you should follow if there are some reasons. |
@HyukjinKwon could you please explain how to request to merge the PR? |
@@ -34,9 +34,9 @@ private[ui] class AllStagesPage(parent: StagesTab) extends WebUIPage("") { | |||
listener.synchronized { | |||
val activeStages = listener.activeStages.values.toSeq | |||
val pendingStages = listener.pendingStages.values.toSeq | |||
val completedStages = listener.completedStages.reverse.toSeq | |||
val completedStages = listener.completedStages.reverse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm neutral on this because Seq.toSeq is a no-op anyway and, theoretically, the type of completedStages could change and then this isn't a Seq, but, in practice, wont' matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's really matter, it's better to add type to val completedStages
, it describes your point much better then trying call no-op method. But it won't be consistent, so I would prefer to leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me not clear, do you request this change back or we can leave my changes.
@@ -103,7 +103,7 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") { | |||
val taskSortColumn = Option(parameterTaskSortColumn).map { sortColumn => | |||
UIUtils.decodeURLParameter(sortColumn) | |||
}.getOrElse("Index") | |||
val taskSortDesc = Option(parameterTaskSortDesc).map(_.toBoolean).getOrElse(false) | |||
val taskSortDesc = Option(parameterTaskSortDesc).exists(_.toBoolean) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not sure about whether this is clearer. I'm neutral. @HyukjinKwon is right about .contains
I think so I'd double check this existed in 2.10?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no Option.contains
call any more, it was in another place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I meant the question is whether .exists is in 2.10, but I am back at a desktop now and found it is, so no problem. That's not the issue, just, whether it's clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If my opinion can be helpful.. personally I prefer the previous one to explicitly show the default like the ones below. Actually, I intendedly use this pattern in several places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've reverted this back.
@@ -69,7 +69,7 @@ private[ui] class RDDPage(parent: StorageTab) extends WebUIPage("rdd") { | |||
} | |||
val blockTableHTML = try { | |||
val _blockTable = new BlockPagedTable( | |||
UIUtils.prependBaseUri(parent.basePath) + s"/storage/rdd/?id=${rddId}", | |||
UIUtils.prependBaseUri(parent.basePath) + s"/storage/rdd/?id=$rddId", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't this it's worth unbracing. The braces aren't hard to read and maybe prevent some misinterpretation one day after a refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one I've just reverted back.
…/apache/spark/ui/storage/RDDPage.scala
core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
Looks like all comments have been addressed. |
@srowen, @HyukjinKwon could you please merge the PR if it's ok of course? |
newTaskInfo.setAccumulables(taskInfo.accumulables.filter { | ||
accum => !accum.internal && accum.metadata != Some(AccumulatorContext.SQL_ACCUM_IDENTIFIER) | ||
newTaskInfo.setAccumulables(taskInfo.accumulables.filter { acc => | ||
!acc.internal && !acc.metadata.contains(AccumulatorContext.SQL_ACCUM_IDENTIFIER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should revert this one too for the same reason in https://github.com/apache/spark/pull/17458/files#r108432518
@@ -42,7 +42,7 @@ private[ui] class RDDPage(parent: StorageTab) extends WebUIPage("rdd") { | |||
|
|||
val blockPage = Option(parameterBlockPage).map(_.toInt).getOrElse(1) | |||
val blockSortColumn = Option(parameterBlockSortColumn).getOrElse("Block Name") | |||
val blockSortDesc = Option(parameterBlockSortDesc).map(_.toBoolean).getOrElse(false) | |||
val blockSortDesc = Option(parameterBlockSortDesc).exists(_.toBoolean) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also looks the same instance. Let's revert this change too.
@@ -116,15 +116,15 @@ private[spark] abstract class WebUI( | |||
* @param path Path in UI to unmount. | |||
*/ | |||
def removeStaticHandler(path: String): Unit = { | |||
handlers.find(_.getContextPath() == path).foreach(detachHandler) | |||
handlers.find(_.getContextPath == path).foreach(detachHandler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbolshak this still isn't addressing comments that have been made several times. You can appreciate why I don't think it's worth the time to make changes like this given how much discussion it takes. Here's another example. Please read all previous comments and address all of them or close this.
Corrected. |
It looks good to me too. |
Test build #3619 has finished for PR 17458 at commit
|
Merged to master |
What changes were proposed in this pull request?
Few changes related to Intellij IDEA inspection.
How was this patch tested?
Changes were tested by existing unit tests