Skip to content

Commit 3f9a502

Browse files
committed
up
1 parent 429f107 commit 3f9a502

File tree

7 files changed

+67
-2
lines changed

7 files changed

+67
-2
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ local_data
1111
.settings
1212
.cache
1313

14+
# intellij related
15+
.idea
16+
*.iml
17+
1418
# user defined ignore
1519
**/*_ignore
1620

pom.xml

+7
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@
8282
<artifactId>spark-core_2.10</artifactId>
8383
<version>1.2.0-cdh5.3.2</version>
8484
</dependency>
85+
86+
<dependency>
87+
<groupId>org.scalanlp</groupId>
88+
<artifactId>breeze_2.10</artifactId>
89+
<version>0.10</version>
90+
</dependency>
91+
8592
<dependency>
8693
<groupId>junit</groupId>
8794
<artifactId>junit</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2015
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package sparkfun.breezetest
17+
18+
import breeze.linalg.{sum, DenseVector}
19+
20+
/**
21+
* @author Steffen Remus
22+
*
23+
*/
24+
object test {
25+
26+
def main(args: Array[String]): Unit = {
27+
val s = DenseVector(0,1,2,3);
28+
val t = s + DenseVector(1,1,1,1);
29+
val z = t.foldLeft("")((x,y) => x + "\t" + y.toString());
30+
31+
println(sum(t(0,2)))
32+
println(sum(t))
33+
println("a b c".split(" ", 5).toList)
34+
}
35+
36+
}

src/main/java/sparkfun/wc/AppJ8.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public static void main(String[] args) {
3838
System.exit(1);
3939
}
4040

41-
SparkConf sparkConf = new SparkConf().setAppName("JavaWordCountJ8");
41+
SparkConf sparkConf = new SparkConf().setAppName("JavaWordCountJ8").setMaster("local[2]").set("spark.io.compression.codec","org.apache.spark.io.LZ4CompressionCodec");
42+
//sparkConf.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer");
4243
JavaSparkContext ctx = new JavaSparkContext(sparkConf); // "local[1]","test",
4344
JavaRDD<String> lines = ctx.textFile(args[0], 1);
4445

src/main/java/sparkfun/wc/AppSc.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ object AppSc {
1818
}
1919

2020

21-
val conf = new SparkConf().setAppName("ScalaWordCount");
21+
val conf = new SparkConf().setAppName("ScalaWordCount").setMaster("local[2]").set("spark.io.compression.codec","org.apache.spark.io.LZ4CompressionCodec");
2222
val sc = new SparkContext(conf);
2323

2424
val lines = sc.textFile(args(0));

src/test/files/artifical-ct.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
1 a b 3 1 0 6
2+
1 a c 4 0 6 0
3+
1 b c 3 0 7 0
4+
2 b c 2 1 0 12
5+
2 b d 1 2 9 3
6+
2 c d 5 2 5 3

src/test/files/artifical-test.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
a b 5
2+
a c 25
3+
b a 735
4+
b c 8
5+
b d 4345
6+
b e 73
7+
c d 253
8+
c e 13
9+
d a 5345
10+
d b 45
11+
d c 176

0 commit comments

Comments
 (0)