You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bahir.apache.org by lr...@apache.org on 2016/06/10 15:24:14 UTC
[35/50] [abbrv] bahir git commit:
[SPARK-13423][WIP][CORE][SQL][STREAMING] Static analysis fixes for 2.x
[SPARK-13423][WIP][CORE][SQL][STREAMING] Static analysis fixes for 2.x
## What changes were proposed in this pull request?
Make some cross-cutting code improvements according to static analysis. These are individually up for discussion since they exist in separate commits that can be reverted. The changes are broadly:
- Inner class should be static
- Mismatched hashCode/equals
- Overflow in compareTo
- Unchecked warnings
- Misuse of assert, vs junit.assert
- get(a) + getOrElse(b) -> getOrElse(a,b)
- Array/String .size -> .length (occasionally, -> .isEmpty / .nonEmpty) to avoid implicit conversions
- Dead code
- tailrec
- exists(_ == ) -> contains find + nonEmpty -> exists filter + size -> count
- reduce(_+_) -> sum map + flatten -> map
The most controversial may be .size -> .length simply because of its size. It is intended to avoid implicits that might be expensive in some places.
## How was the this patch tested?
Existing Jenkins unit tests.
Author: Sean Owen <so...@cloudera.com>
Closes #11292 from srowen/SPARK-13423.
Project: http://git-wip-us.apache.org/repos/asf/bahir/repo
Commit: http://git-wip-us.apache.org/repos/asf/bahir/commit/a784af6c
Tree: http://git-wip-us.apache.org/repos/asf/bahir/tree/a784af6c
Diff: http://git-wip-us.apache.org/repos/asf/bahir/diff/a784af6c
Branch: refs/heads/master
Commit: a784af6c3e2de0e883cd04d445d7a14749dc8cfe
Parents: 8ad5ddd
Author: Sean Owen <so...@cloudera.com>
Authored: Thu Mar 3 09:54:09 2016 +0000
Committer: Sean Owen <so...@cloudera.com>
Committed: Thu Mar 3 09:54:09 2016 +0000
----------------------------------------------------------------------
.../apache/spark/examples/streaming/akka/JavaActorWordCount.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/bahir/blob/a784af6c/streaming-akka/examples/src/main/java/org/apache/spark/examples/streaming/akka/JavaActorWordCount.java
----------------------------------------------------------------------
diff --git a/streaming-akka/examples/src/main/java/org/apache/spark/examples/streaming/akka/JavaActorWordCount.java b/streaming-akka/examples/src/main/java/org/apache/spark/examples/streaming/akka/JavaActorWordCount.java
index cf77466..7bb70d0 100644
--- a/streaming-akka/examples/src/main/java/org/apache/spark/examples/streaming/akka/JavaActorWordCount.java
+++ b/streaming-akka/examples/src/main/java/org/apache/spark/examples/streaming/akka/JavaActorWordCount.java
@@ -60,7 +60,9 @@ class JavaSampleActorReceiver<T> extends JavaActorReceiver {
@Override
public void onReceive(Object msg) throws Exception {
- store((T) msg);
+ @SuppressWarnings("unchecked")
+ T msgT = (T) msg;
+ store(msgT);
}
@Override