incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Fixed BLUR-303
Date Wed, 20 Nov 2013 14:43:59 GMT
Updated Branches:
  refs/heads/apache-blur-0.2 32733114c -> fe7f3915a


Fixed BLUR-303


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/fe7f3915
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/fe7f3915
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/fe7f3915

Branch: refs/heads/apache-blur-0.2
Commit: fe7f3915a0581e849b09ec82f478e4cd2dc5b132
Parents: 3273311
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Wed Nov 20 09:43:38 2013 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Wed Nov 20 09:43:38 2013 -0500

----------------------------------------------------------------------
 .../apache/blur/mapreduce/lib/BlurOutputFormat.java |  8 ++++----
 .../blur/mapreduce/lib/DefaultBlurReducer.java      | 16 +++++++++++++---
 2 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fe7f3915/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/BlurOutputFormat.java
----------------------------------------------------------------------
diff --git a/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/BlurOutputFormat.java
b/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/BlurOutputFormat.java
index caa3504..4644761 100644
--- a/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/BlurOutputFormat.java
+++ b/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/BlurOutputFormat.java
@@ -114,19 +114,19 @@ public class BlurOutputFormat extends OutputFormat<Text, BlurMutate>
{
   private static ThreadLocal<Progressable> _progressable = new ThreadLocal<Progressable>();
   private static ThreadLocal<GetCounter> _getCounter = new ThreadLocal<GetCounter>();
 
-  static void setProgressable(Progressable progressable) {
+  public static void setProgressable(Progressable progressable) {
     _progressable.set(progressable);
   }
 
-  static Progressable getProgressable() {
+  public static Progressable getProgressable() {
     return _progressable.get();
   }
 
-  static void setGetCounter(GetCounter getCounter) {
+  public static void setGetCounter(GetCounter getCounter) {
     _getCounter.set(getCounter);
   }
 
-  static GetCounter getGetCounter() {
+  public static GetCounter getGetCounter() {
     return _getCounter.get();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/fe7f3915/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/DefaultBlurReducer.java
----------------------------------------------------------------------
diff --git a/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/DefaultBlurReducer.java
b/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/DefaultBlurReducer.java
index 016fb51..99f2ac5 100644
--- a/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/DefaultBlurReducer.java
+++ b/blur-mapred/src/main/java/org/apache/blur/mapreduce/lib/DefaultBlurReducer.java
@@ -19,6 +19,7 @@ package org.apache.blur.mapreduce.lib;
 import java.io.IOException;
 
 import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.mapreduce.Counter;
 import org.apache.hadoop.mapreduce.Reducer;
 
@@ -56,7 +57,7 @@ import org.apache.hadoop.mapreduce.Reducer;
  * 
  * 
  */
-public class DefaultBlurReducer extends Reducer<Text, BlurMutate, Text, BlurMutate>
{
+public class DefaultBlurReducer extends Reducer<Writable, BlurMutate, Writable, BlurMutate>
{
 
   @Override
   protected void setup(final Context context) throws IOException, InterruptedException {
@@ -70,10 +71,19 @@ public class DefaultBlurReducer extends Reducer<Text, BlurMutate, Text,
BlurMuta
   }
 
   @Override
-  protected void reduce(Text key, Iterable<BlurMutate> values, Context context) throws
IOException,
+  protected void reduce(Writable key, Iterable<BlurMutate> values, Context context)
throws IOException,
       InterruptedException {
+    Text textKey = getTextKey(key);
     for (BlurMutate value : values) {
-      context.write(key, value);
+      context.write(textKey, value);
     }
   }
+
+  protected Text getTextKey(Writable key) {
+    if (key instanceof Text) {
+      return (Text) key;
+    }
+    throw new IllegalArgumentException("Key is not of type Text, you will need to "
+        + "override DefaultBlurReducer and implement \"getTextKey\" method.");
+  }
 }


Mime
View raw message