You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jy...@apache.org on 2013/01/31 00:46:11 UTC
svn commit: r1440736 -
/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
Author: jyates
Date: Wed Jan 30 23:46:10 2013
New Revision: 1440736
URL: http://svn.apache.org/viewvc?rev=1440736&view=rev
Log:
HBASE-7702: Adding filtering to Import jobs - Forgot this bit...
Modified:
hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java?rev=1440736&r1=1440735&r2=1440736&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java Wed Jan 30 23:46:10 2013
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
@@ -339,6 +340,27 @@ public class Import {
conf.set(CF_RENAME_PROP, sb.toString());
}
+ /**
+ * Add a Filter to be instantiated on import
+ * @param conf Configuration to update (will be passed to the job)
+ * @param clazz {@link Filter} subclass to instantiate on the server.
+ * @param args List of arguments to pass to the filter on instantiation
+ */
+ public static void addFilterAndArguments(Configuration conf, Class<? extends Filter> clazz,
+ List<String> args) {
+ conf.set(Import.FILTER_CLASS_CONF_KEY, clazz.getName());
+
+ // build the param string for the key
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < args.size(); i++) {
+ String arg = args.get(i);
+ builder.append(arg);
+ if (i != args.size() - 1) {
+ builder.append(",");
+ }
+ }
+ conf.set(Import.FILTER_ARGS_CONF_KEY, builder.toString());
+ }
/**
* Sets up the actual job.