Handle the vals that never used
In XORShiftRandom.scala, use val "million" instead of constant "1e6.toInt". Delete vals that never used in other files. Author: WangTao <barneystinson@aliyun.com> Closes #565 from WangTaoTheTonic/master and squashes the following commits: 17cacfc [WangTao] Handle the unused assignment, method parameters and symbol inspected by Intellij IDEA 37b4090 [WangTao] Handle the vals that never used
This commit is contained in:
parent
b3d2ab6b35
commit
7025dda8fa
|
@ -106,7 +106,6 @@ private[spark] class SecurityMessage() extends Logging {
|
||||||
* @return BufferMessage
|
* @return BufferMessage
|
||||||
*/
|
*/
|
||||||
def toBufferMessage: BufferMessage = {
|
def toBufferMessage: BufferMessage = {
|
||||||
val startTime = System.currentTimeMillis
|
|
||||||
val buffers = new ArrayBuffer[ByteBuffer]()
|
val buffers = new ArrayBuffer[ByteBuffer]()
|
||||||
|
|
||||||
// 4 bytes for the length of the connectionId
|
// 4 bytes for the length of the connectionId
|
||||||
|
|
|
@ -61,7 +61,6 @@ private[spark] class GroupedMeanEvaluator[T](totalOutputs: Int, confidence: Doub
|
||||||
} else if (outputsMerged == 0) {
|
} else if (outputsMerged == 0) {
|
||||||
new HashMap[T, BoundedDouble]
|
new HashMap[T, BoundedDouble]
|
||||||
} else {
|
} else {
|
||||||
val p = outputsMerged.toDouble / totalOutputs
|
|
||||||
val studentTCacher = new StudentTCacher(confidence)
|
val studentTCacher = new StudentTCacher(confidence)
|
||||||
val result = new JHashMap[T, BoundedDouble](sums.size)
|
val result = new JHashMap[T, BoundedDouble](sums.size)
|
||||||
val iter = sums.entrySet.iterator()
|
val iter = sums.entrySet.iterator()
|
||||||
|
|
|
@ -118,11 +118,9 @@ object BlockFetcherIterator {
|
||||||
})
|
})
|
||||||
bytesInFlight += req.size
|
bytesInFlight += req.size
|
||||||
val sizeMap = req.blocks.toMap // so we can look up the size of each blockID
|
val sizeMap = req.blocks.toMap // so we can look up the size of each blockID
|
||||||
val fetchStart = System.currentTimeMillis()
|
|
||||||
val future = connectionManager.sendMessageReliably(cmId, blockMessageArray.toBufferMessage)
|
val future = connectionManager.sendMessageReliably(cmId, blockMessageArray.toBufferMessage)
|
||||||
future.onSuccess {
|
future.onSuccess {
|
||||||
case Some(message) => {
|
case Some(message) => {
|
||||||
val fetchDone = System.currentTimeMillis()
|
|
||||||
val bufferMessage = message.asInstanceOf[BufferMessage]
|
val bufferMessage = message.asInstanceOf[BufferMessage]
|
||||||
val blockMessageArray = BlockMessageArray.fromBufferMessage(bufferMessage)
|
val blockMessageArray = BlockMessageArray.fromBufferMessage(bufferMessage)
|
||||||
for (blockMessage <- blockMessageArray) {
|
for (blockMessage <- blockMessageArray) {
|
||||||
|
|
|
@ -91,7 +91,7 @@ private[spark] object XORShiftRandom {
|
||||||
val xorRand = new XORShiftRandom(seed)
|
val xorRand = new XORShiftRandom(seed)
|
||||||
|
|
||||||
// this is just to warm up the JIT - we're not timing anything
|
// this is just to warm up the JIT - we're not timing anything
|
||||||
timeIt(1e6.toInt) {
|
timeIt(million) {
|
||||||
javaRand.nextInt()
|
javaRand.nextInt()
|
||||||
xorRand.nextInt()
|
xorRand.nextInt()
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,6 @@ public final class JavaLogQuery {
|
||||||
|
|
||||||
public static Tuple3<String, String, String> extractKey(String line) {
|
public static Tuple3<String, String, String> extractKey(String line) {
|
||||||
Matcher m = apacheLogRegex.matcher(line);
|
Matcher m = apacheLogRegex.matcher(line);
|
||||||
List<String> key = Collections.emptyList();
|
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
String ip = m.group(1);
|
String ip = m.group(1);
|
||||||
String user = m.group(3);
|
String user = m.group(3);
|
||||||
|
|
|
@ -85,7 +85,7 @@ public final class JavaTC {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
long oldCount = 0;
|
long oldCount;
|
||||||
long nextCount = tc.count();
|
long nextCount = tc.count();
|
||||||
do {
|
do {
|
||||||
oldCount = nextCount;
|
oldCount = nextCount;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.List;
|
||||||
import org.apache.spark.api.java.JavaRDD;
|
import org.apache.spark.api.java.JavaRDD;
|
||||||
import org.apache.spark.api.java.JavaSparkContext;
|
import org.apache.spark.api.java.JavaSparkContext;
|
||||||
import org.apache.spark.api.java.function.Function;
|
import org.apache.spark.api.java.function.Function;
|
||||||
import org.apache.spark.api.java.function.VoidFunction;
|
|
||||||
|
|
||||||
import org.apache.spark.sql.api.java.JavaSQLContext;
|
import org.apache.spark.sql.api.java.JavaSQLContext;
|
||||||
import org.apache.spark.sql.api.java.JavaSchemaRDD;
|
import org.apache.spark.sql.api.java.JavaSchemaRDD;
|
||||||
|
|
Loading…
Reference in a new issue