Skip to content

Commit 31a7040

Browse files
jianghanpwendell
jianghan
authored andcommitted
Fix example bug: compile error
Author: jianghan <jianghan@xiaomi.com> Closes scala#132 from pooorman/master and squashes the following commits: 54afbe0 [jianghan] Fix example bug: compile error
1 parent 9032f7c commit 31a7040

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

examples/src/main/java/org/apache/spark/examples/JavaLogQuery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public Stats call(Stats stats, Stats stats2) {
124124

125125
List<Tuple2<Tuple3<String, String, String>, Stats>> output = counts.collect();
126126
for (Tuple2<?,?> t : output) {
127-
System.out.println(t._1 + "\t" + t._2);
127+
System.out.println(t._1() + "\t" + t._2());
128128
}
129129
System.exit(0);
130130
}

examples/src/main/java/org/apache/spark/examples/JavaPageRank.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ public Double call(List<String> rs) {
9090
@Override
9191
public Iterable<Tuple2<String, Double>> call(Tuple2<List<String>, Double> s) {
9292
List<Tuple2<String, Double>> results = new ArrayList<Tuple2<String, Double>>();
93-
for (String n : s._1) {
94-
results.add(new Tuple2<String, Double>(n, s._2 / s._1.size()));
93+
for (String n : s._1()) {
94+
results.add(new Tuple2<String, Double>(n, s._2() / s._1().size()));
9595
}
9696
return results;
9797
}
@@ -109,7 +109,7 @@ public Double call(Double sum) {
109109
// Collects all URL ranks and dump them to console.
110110
List<Tuple2<String, Double>> output = ranks.collect();
111111
for (Tuple2<?,?> tuple : output) {
112-
System.out.println(tuple._1 + " has rank: " + tuple._2 + ".");
112+
System.out.println(tuple._1() + " has rank: " + tuple._2() + ".");
113113
}
114114

115115
System.exit(0);

examples/src/main/java/org/apache/spark/examples/JavaWordCount.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public Integer call(Integer i1, Integer i2) {
6565

6666
List<Tuple2<String, Integer>> output = counts.collect();
6767
for (Tuple2<?,?> tuple : output) {
68-
System.out.println(tuple._1 + ": " + tuple._2);
68+
System.out.println(tuple._1() + ": " + tuple._2());
6969
}
7070
System.exit(0);
7171
}

0 commit comments

Comments
 (0)