-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24529][Build][test-maven] Add spotbugs into maven build process #21542
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
Changes from 4 commits
4075f6f
4441499
02bbeb1
86ef42c
f79e542
1330fa6
8ffd23b
1250a92
b027d62
191f135
6b747c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -369,7 +369,7 @@ private[spark] class ExternalSorter[K, V, C]( | |
| type Iter = BufferedIterator[Product2[K, C]] | ||
| val heap = new mutable.PriorityQueue[Iter]()(new Ordering[Iter] { | ||
| // Use the reverse of comparator.compare because PriorityQueue dequeues the max | ||
| override def compare(x: Iter, y: Iter): Int = -comparator.compare(x.head._1, y.head._1) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the comment as we don't use the reverse of |
||
| override def compare(x: Iter, y: Iter): Int = comparator.compare(y.head._1, x.head._1) | ||
| }) | ||
| heap.enqueue(bufferedIters: _*) // Will contain only the iterators with hasNext = true | ||
| new Iterator[Product2[K, C]] { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,9 +42,11 @@ private object RecursiveFlag { | |
| val old = Option(hadoopConf.get(flagName)) | ||
| hadoopConf.set(flagName, value.toString) | ||
| try f finally { | ||
| old match { | ||
| case Some(v) => hadoopConf.set(flagName, v) | ||
| case None => hadoopConf.unset(flagName) | ||
| // avoid false positive of DLS_DEAD_LOCAL_STORE_IN_RETURN by SpotBugs | ||
|
||
| if (old.isDefined) { | ||
| hadoopConf.set(flagName, old.get) | ||
| } else { | ||
| hadoopConf.unset(flagName) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2606,6 +2606,35 @@ | |
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>com.github.spotbugs</groupId> | ||
| <artifactId>spotbugs-maven-plugin</artifactId> | ||
| <version>3.1.3</version> | ||
| <configuration> | ||
| <classFilesDirectory>${basedir}/target/scala-2.11/classes</classFilesDirectory> | ||
|
||
| <testClassFilesDirectory>${basedir}/target/scala-2.11/test-classes</testClassFilesDirectory> | ||
| <effort>Max</effort> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kiszk, btw do you roughly know how much time this PR increases in the build?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not see large difference of maven's user time with and w/o with without
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eh, how much does it increase the Maven build time by this whole PR then roughly? |
||
| <threshold>Low</threshold> | ||
| <xmlOutput>true</xmlOutput> | ||
| <visitors>FindPuzzlers</visitors> | ||
| <fork>false</fork> | ||
| </configuration> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.github.spotbugs</groupId> | ||
| <artifactId>spotbugs</artifactId> | ||
| <version>3.1.3</version> | ||
|
||
| </dependency> | ||
| </dependencies> | ||
| <executions> | ||
| <execution> | ||
| <goals> | ||
| <goal>check</goal> | ||
| </goals> | ||
| <phase>compile</phase> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -294,7 +294,8 @@ object CaseWhen { | |
| case cond :: value :: Nil => Some((cond, value)) | ||
| case value :: Nil => None | ||
| }.toArray.toSeq // force materialization to make the seq serializable | ||
| val elseValue = if (branches.size % 2 == 1) Some(branches.last) else None | ||
| // avoid false positive of IM_BAD_CHECK_FOR_ODD by SpotBugs | ||
|
||
| val elseValue = if (branches.size % 2 != 0) Some(branches.last) else None | ||
| CaseWhen(cases, elseValue) | ||
| } | ||
| } | ||
|
|
@@ -309,7 +310,8 @@ object CaseKeyWhen { | |
| case Seq(cond, value) => Some((EqualTo(key, cond), value)) | ||
| case Seq(value) => None | ||
| }.toArray.toSeq // force materialization to make the seq serializable | ||
| val elseValue = if (branches.size % 2 == 1) Some(branches.last) else None | ||
| // avoid false positive of IM_BAD_CHECK_FOR_ODD by SpotBugs | ||
| val elseValue = if (branches.size % 2 != 0) Some(branches.last) else None | ||
| CaseWhen(cases, elseValue) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1507,7 +1507,8 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef] with Logging | |
| case "TIMESTAMP" => | ||
| Literal(Timestamp.valueOf(value)) | ||
| case "X" => | ||
| val padding = if (value.length % 2 == 1) "0" else "" | ||
| // avoid false positive of IM_BAD_CHECK_FOR_ODD by SpotBugs | ||
|
||
| val padding = if (value.length % 2 != 0) "0" else "" | ||
| Literal(DatatypeConverter.parseHexBinary(padding + value)) | ||
| case other => | ||
| throw new ParseException(s"Literals of type '$other' are currently not supported.", ctx) | ||
|
|
||
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.
shall we keep this comment? we still use reverse order here.
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.
Maybe:
Use the reverse order because PriorityQueue dequeues the max.