gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [05/25] gora git commit: * map was not collecting the counts and it is fixed.
Date Thu, 03 Sep 2015 07:28:41 GMT
* map was not collecting the counts and it is fixed.


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/445edb12
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/445edb12
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/445edb12

Branch: refs/heads/master
Commit: 445edb12c35f867e7b81919ddfb509dd8c179ba3
Parents: 5644a21
Author: Furkan KAMACI <furkankamaci@gmail.com>
Authored: Mon Jun 29 02:26:41 2015 +0300
Committer: Furkan KAMACI <furkankamaci@gmail.com>
Committed: Mon Jun 29 02:26:41 2015 +0300

----------------------------------------------------------------------
 .../apache/gora/tutorial/log/LogAnalyticsSpark.java   | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/445edb12/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogAnalyticsSpark.java
----------------------------------------------------------------------
diff --git a/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogAnalyticsSpark.java
b/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogAnalyticsSpark.java
index 43acba0..0ad3e57 100644
--- a/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogAnalyticsSpark.java
+++ b/gora-tutorial/src/main/java/org/apache/gora/tutorial/log/LogAnalyticsSpark.java
@@ -40,12 +40,14 @@ public class LogAnalyticsSpark {
   private static final long DAY_MILIS = 1000 * 60 * 60 * 24;
 
   //todo _fk consider using Kyro serialization
-  private static Function<Pageview, Tuple2<String, Long>> s = new Function<Pageview,
Tuple2<String, Long>>() {
+  private static Function<Pageview, Tuple2<Tuple2<String, Long>, Long>>
s = new Function<Pageview, Tuple2<Tuple2<String, Long>, Long>> () {
     @Override
-    public Tuple2<String, Long> call(Pageview pageview) throws Exception {
-      String key = pageview.getUrl().toString();
-      Long value = getDay(pageview.getTimestamp());
-      return new Tuple2<>(key, value);
+    public Tuple2<Tuple2<String, Long>, Long> call(Pageview pageview) throws
Exception {
+      String url = pageview.getUrl().toString();
+      Long day = getDay(pageview.getTimestamp());
+      Tuple2<String, Long> keyTuple =new Tuple2<>(url, day);
+
+      return new Tuple2<>(keyTuple, 1L);
     }
   };
 
@@ -100,7 +102,7 @@ public class LogAnalyticsSpark {
     String firstOneURL = goraRDD.first()._2().getUrl().toString();
     System.out.println(firstOneURL);
 
-    JavaRDD<Tuple2<String, Long>> mappedGoraRdd = goraRDD.values().map(s);
+    JavaRDD<Tuple2<Tuple2<String, Long>, Long>> mappedGoraRdd = goraRDD.values().map(s);
 
     return 1;
   }


Mime
View raw message