incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [4/5] git commit: Adding a mapred common library. This should allow a single project for the mapred code. The next step will be to remove the blur-mapred-hadoop1 and 2 projects.
Date Sun, 12 Apr 2015 13:26:38 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/CsvBlurDriver.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/CsvBlurDriver.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/CsvBlurDriver.java
deleted file mode 100644
index ae8f602..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/CsvBlurDriver.java
+++ /dev/null
@@ -1,446 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.blur.thrift.BlurClient;
-import org.apache.blur.thrift.generated.Blur.Iface;
-import org.apache.blur.thrift.generated.TableDescriptor;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.commons.cli.PosixParser;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.compress.BZip2Codec;
-import org.apache.hadoop.io.compress.CompressionCodec;
-import org.apache.hadoop.io.compress.DefaultCodec;
-import org.apache.hadoop.io.compress.GzipCodec;
-import org.apache.hadoop.io.compress.SnappyCodec;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.Job;
-import org.apache.hadoop.mapreduce.RecordReader;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.apache.hadoop.mapreduce.lib.input.CombineFileInputFormat;
-import org.apache.hadoop.mapreduce.lib.input.CombineFileRecordReader;
-import org.apache.hadoop.mapreduce.lib.input.CombineFileSplit;
-import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
-import org.apache.hadoop.mapreduce.lib.input.FileSplit;
-import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat;
-import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.util.GenericOptionsParser;
-
-import com.google.common.base.Splitter;
-
-@SuppressWarnings("static-access")
-public class CsvBlurDriver {
-
-  public static final String CSVLOADER = "csvloader";
-  public static final String MAPRED_COMPRESS_MAP_OUTPUT = "mapred.compress.map.output";
-  public static final String MAPRED_MAP_OUTPUT_COMPRESSION_CODEC = "mapred.map.output.compression.codec";
-  public static final int DEFAULT_WIDTH = 100;
-  public static final String HEADER = "The \""
-      + CSVLOADER
-      + "\" command is used to load delimited into a Blur table.\nThe required options are \"-c\", \"-t\", \"-d\". The "
-      + "standard format for the contents of a file is:\"rowid,recordid,family,col1,col2,...\". However there are "
-      + "several options, such as the rowid and recordid can be generated based on the data in the record via the "
-      + "\"-A\" and \"-a\" options. The family can assigned based on the path via the \"-I\" option. The column "
-      + "name order can be mapped via the \"-d\" option. Also you can set the input "
-      + "format to either sequence files vie the \"-S\" option or leave the default text files.";
-
-  enum COMPRESSION {
-    SNAPPY(SnappyCodec.class), GZIP(GzipCodec.class), BZIP(BZip2Codec.class), DEFAULT(DefaultCodec.class);
-
-    private final String className;
-
-    private COMPRESSION(Class<? extends CompressionCodec> clazz) {
-      className = clazz.getName();
-    }
-
-    public String getClassName() {
-      return className;
-    }
-  }
-
-  interface ControllerPool {
-    Iface getClient(String controllerConnectionStr);
-  }
-
-  public static void main(String... args) throws Exception {
-    Configuration configuration = new Configuration();
-    String[] otherArgs = new GenericOptionsParser(configuration, args).getRemainingArgs();
-    AtomicReference<Callable<Void>> ref = new AtomicReference<Callable<Void>>();
-    Job job = setupJob(configuration, new ControllerPool() {
-      @Override
-      public Iface getClient(String controllerConnectionStr) {
-        return BlurClient.getClient(controllerConnectionStr);
-      }
-    }, ref, otherArgs);
-    if (job == null) {
-      System.exit(1);
-    }
-    boolean waitForCompletion = job.waitForCompletion(true);
-    if (waitForCompletion) {
-      Callable<Void> callable = ref.get();
-      if (callable != null) {
-        callable.call();
-      }
-    }
-    System.exit(waitForCompletion ? 0 : 1);
-  }
-
-  public static Job setupJob(Configuration configuration, ControllerPool controllerPool,
-      AtomicReference<Callable<Void>> ref, String... otherArgs) throws Exception {
-    CommandLine cmd = parse(otherArgs);
-    if (cmd == null) {
-      return null;
-    }
-
-    final String controllerConnectionStr = cmd.getOptionValue("c");
-    final String tableName = cmd.getOptionValue("t");
-
-    final Iface client = controllerPool.getClient(controllerConnectionStr);
-    TableDescriptor tableDescriptor = client.describe(tableName);
-
-    Job job = new Job(configuration, "Blur indexer [" + tableName + "]");
-    job.setJarByClass(CsvBlurDriver.class);
-    job.setMapperClass(CsvBlurMapper.class);
-
-    if (cmd.hasOption("p")) {
-      job.getConfiguration().set(MAPRED_COMPRESS_MAP_OUTPUT, "true");
-      String codecStr = cmd.getOptionValue("p");
-      COMPRESSION compression;
-      try {
-        compression = COMPRESSION.valueOf(codecStr.trim().toUpperCase());
-      } catch (IllegalArgumentException e) {
-        compression = null;
-      }
-      if (compression == null) {
-        job.getConfiguration().set(MAPRED_MAP_OUTPUT_COMPRESSION_CODEC, codecStr.trim());
-      } else {
-        job.getConfiguration().set(MAPRED_MAP_OUTPUT_COMPRESSION_CODEC, compression.getClassName());
-      }
-    }
-    if (cmd.hasOption("a")) {
-      CsvBlurMapper.setAutoGenerateRecordIdAsHashOfData(job, true);
-    }
-    if (cmd.hasOption("A")) {
-      CsvBlurMapper.setAutoGenerateRowIdAsHashOfData(job, true);
-    }
-    if (cmd.hasOption("S")) {
-      job.setInputFormatClass(SequenceFileInputFormat.class);
-    } else {
-      job.setInputFormatClass(TextInputFormat.class);
-    }
-
-    if (cmd.hasOption("C")) {
-      if (cmd.hasOption("S")) {
-        String[] optionValues = cmd.getOptionValues("C");
-        job.setInputFormatClass(CsvBlurCombineSequenceFileInputFormat.class);
-        CombineFileInputFormat.setMinInputSplitSize(job, Long.parseLong(optionValues[0]));
-        CombineFileInputFormat.setMaxInputSplitSize(job, Long.parseLong(optionValues[1]));
-      } else {
-        System.err.println("'C' can only be used with option 'S'");
-        return null;
-      }
-    }
-
-    if (cmd.hasOption("i")) {
-      for (String input : cmd.getOptionValues("i")) {
-        Path path = new Path(input);
-        Set<Path> pathSet = recurisvelyGetPathesContainingFiles(path, job.getConfiguration());
-        if (pathSet.isEmpty()) {
-          FileInputFormat.addInputPath(job, path);
-        } else {
-          for (Path p : pathSet) {
-            FileInputFormat.addInputPath(job, p);
-          }
-        }
-      }
-    }
-    // processing the 'I' option
-    if (cmd.hasOption("I")) {
-      if (cmd.hasOption("C")) {
-        System.err.println("'I' and 'C' both parameters can not be used together.");
-        return null;
-      }
-      Option[] options = cmd.getOptions();
-      for (Option option : options) {
-        if (option.getOpt().equals("I")) {
-          String[] values = option.getValues();
-          if (values.length < 2) {
-            System.err.println("'I' parameter missing minimum args of (family path*)");
-            return null;
-          }
-          for (String p : getSubArray(values, 1)) {
-            Path path = new Path(p);
-            CsvBlurMapper.addFamilyPath(job, values[0], path);
-            FileInputFormat.addInputPath(job, path);
-          }
-        }
-      }
-    }
-
-    if (cmd.hasOption("s")) {
-      CsvBlurMapper.setSeparator(job, StringEscapeUtils.unescapeJava(cmd.getOptionValue("s")));
-    }
-    if (cmd.hasOption("o")) {
-      BlurOutputFormat.setOptimizeInFlight(job, false);
-    }
-    if (cmd.hasOption("l")) {
-      BlurOutputFormat.setIndexLocally(job, false);
-    }
-    if (cmd.hasOption("b")) {
-      int maxDocumentBufferSize = Integer.parseInt(cmd.getOptionValue("b"));
-      BlurOutputFormat.setMaxDocumentBufferSize(job, maxDocumentBufferSize);
-    }
-    // processing the 'd' option
-    Option[] options = cmd.getOptions();
-    for (Option option : options) {
-      if (option.getOpt().equals("d")) {
-        String[] values = option.getValues();
-        if (values.length < 2) {
-          System.err.println("'d' parameter missing minimum args of (family columname*)");
-          return null;
-        }
-        CsvBlurMapper.addColumns(job, values[0], getSubArray(values, 1));
-      }
-    }
-    BlurOutputFormat.setupJob(job, tableDescriptor);
-    BlurMapReduceUtil.addDependencyJars(job.getConfiguration(), Splitter.class);
-    if (cmd.hasOption("r")) {
-      int reducerMultiplier = Integer.parseInt(cmd.getOptionValue("r"));
-      BlurOutputFormat.setReducerMultiplier(job, reducerMultiplier);
-    }
-    final Path output;
-    if (cmd.hasOption("out")) {
-      output = new Path(cmd.getOptionValue("out"));
-    } else {
-      UserGroupInformation currentUser = UserGroupInformation.getCurrentUser();
-      String userName = currentUser.getUserName();
-      output = new Path("/user/" + userName + "/.blur-" + System.currentTimeMillis());
-    }
-    BlurOutputFormat.setOutputPath(job, output);
-    if (cmd.hasOption("import")) {
-      ref.set(new Callable<Void>() {
-        @Override
-        public Void call() throws Exception {
-          client.loadData(tableName, output.toUri().toString());
-          return null;
-        }
-      });
-    }
-    return job;
-  }
-
-  private static String[] getSubArray(String[] array, int starting) {
-    String[] result = new String[array.length - starting];
-    System.arraycopy(array, starting, result, 0, result.length);
-    return result;
-  }
-
-  private static Set<Path> recurisvelyGetPathesContainingFiles(Path path, Configuration configuration)
-      throws IOException {
-    Set<Path> pathSet = new HashSet<Path>();
-    FileSystem fileSystem = path.getFileSystem(configuration);
-    FileStatus[] listStatus = fileSystem.listStatus(path);
-    for (FileStatus status : listStatus) {
-      if (status.isDir()) {
-        pathSet.addAll(recurisvelyGetPathesContainingFiles(status.getPath(), configuration));
-      } else {
-        pathSet.add(status.getPath().getParent());
-      }
-    }
-    return pathSet;
-  }
-
-  private static CommandLine parse(String... otherArgs) throws ParseException {
-    Options options = new Options();
-    options.addOption(OptionBuilder.withArgName("controller*").hasArgs().isRequired(true)
-        .withDescription("* Thrift controller connection string. (host1:40010 host2:40010 ...)").create("c"));
-    options.addOption(OptionBuilder.withArgName("tablename").hasArg().isRequired(true)
-        .withDescription("* Blur table name.").create("t"));
-    options.addOption(OptionBuilder.withArgName("family column*").hasArgs().isRequired(true)
-        .withDescription("* Define the mapping of fields in the CSV file to column names. (family col1 col2 col3 ...)")
-        .create("d"));
-    options.addOption(OptionBuilder
-        .withArgName("delimiter")
-        .hasArg()
-        .withDescription(
-            "The file delimiter to be used. (default value ',')  NOTE: For special "
-                + "charactors like the default hadoop separator of ASCII value 1, you can use standard "
-                + "java escaping (\\u0001)").create("s"));
-    options
-        .addOption(OptionBuilder
-            .withArgName("path*")
-            .hasArg()
-            .withDescription(
-                "The directory to index, the family name is assumed to BE present in the file contents. (hdfs://namenode/input/in1)")
-            .create("i"));
-    options
-        .addOption(OptionBuilder
-            .withArgName("family path*")
-            .hasArgs()
-            .withDescription(
-                "The directory to index with a family name, the family name is assumed to NOT be present in the file contents. (family hdfs://namenode/input/in1)")
-            .create("I"));
-    options
-        .addOption(OptionBuilder
-            .withArgName("auto generate record ids")
-            .withDescription(
-                "No Record Ids - Automatically generate record ids for each record based on a MD5 has of the data within the record.")
-            .create("a"));
-    options
-        .addOption(OptionBuilder
-            .withArgName("auto generate row ids")
-            .withDescription(
-                "No Row Ids - Automatically generate row ids for each record based on a MD5 has of the data within the record.")
-            .create("A"));
-    options.addOption(OptionBuilder.withArgName("disable optimize indexes during copy")
-        .withDescription("Disable optimize indexes during copy, this has very little overhead. (enabled by default)")
-        .create("o"));
-    options.addOption(OptionBuilder
-        .withArgName("disable index locally")
-        .withDescription(
-            "Disable the use storage local on the server that is running the reducing "
-                + "task and copy to Blur table once complete. (enabled by default)").create("l"));
-    options.addOption(OptionBuilder.withArgName("sequence files inputs")
-        .withDescription("The input files are sequence files.").create("S"));
-    options.addOption(OptionBuilder
-        .withArgName("size")
-        .hasArg()
-        .withDescription(
-            "The maximum number of Lucene documents to buffer in the reducer for a single "
-                + "row before spilling over to disk. (default 1000)").create("b"));
-    options.addOption(OptionBuilder
-        .withArgName("multiplier")
-        .hasArg()
-        .withDescription(
-            "The reducer multipler allows for an increase in the number of reducers per "
-                + "shard in the given table.  For example if the table has 128 shards and the "
-                + "reducer multiplier is 4 the total number of reducers will be 512, 4 reducers "
-                + "per shard. (default 1)").create("r"));
-    options.addOption(OptionBuilder
-        .withArgName("minimum maximum")
-        .hasArgs(2)
-        .withDescription(
-            "Enables a combine file input to help deal with many small files as the input. Provide "
-                + "the minimum and maximum size per mapper.  For a minimum of 1GB and a maximum of "
-                + "2.5GB: (1000000000 2500000000)").create("C"));
-    options.addOption(OptionBuilder
-        .withArgName("codec")
-        .hasArgs(1)
-        .withDescription(
-            "Sets the compression codec for the map compress output setting. (SNAPPY,GZIP,BZIP,DEFAULT, or classname)")
-        .create("p"));
-
-    CommandLineParser parser = new PosixParser();
-    CommandLine cmd = null;
-    try {
-      cmd = parser.parse(options, otherArgs);
-    } catch (ParseException e) {
-      System.err.println(e.getMessage());
-      HelpFormatter formatter = new HelpFormatter();
-      PrintWriter pw = new PrintWriter(System.err, true);
-      formatter.printHelp(pw, DEFAULT_WIDTH, CSVLOADER, HEADER, options, HelpFormatter.DEFAULT_LEFT_PAD,
-          HelpFormatter.DEFAULT_DESC_PAD, null, false);
-      return null;
-    }
-
-    if (!(cmd.hasOption("I") || cmd.hasOption("i"))) {
-      System.err.println("Missing input directory, see options 'i' and 'I'.");
-      HelpFormatter formatter = new HelpFormatter();
-      PrintWriter pw = new PrintWriter(System.err, true);
-      formatter.printHelp(pw, DEFAULT_WIDTH, CSVLOADER, HEADER, options, HelpFormatter.DEFAULT_LEFT_PAD,
-          HelpFormatter.DEFAULT_DESC_PAD, null, false);
-      return null;
-    }
-    return cmd;
-  }
-
-  public static class CsvBlurCombineSequenceFileInputFormat extends CombineFileInputFormat<Writable, Text> {
-
-    private static class SequenceFileRecordReaderWrapper extends RecordReader<Writable, Text> {
-
-      private final RecordReader<Writable, Text> delegate;
-      private final FileSplit fileSplit;
-
-      @SuppressWarnings("unused")
-      public SequenceFileRecordReaderWrapper(CombineFileSplit split, TaskAttemptContext context, Integer index)
-          throws IOException {
-        fileSplit = new FileSplit(split.getPath(index), split.getOffset(index), split.getLength(index),
-            split.getLocations());
-        delegate = new SequenceFileInputFormat<Writable, Text>().createRecordReader(fileSplit, context);
-      }
-
-      @Override
-      public float getProgress() throws IOException, InterruptedException {
-        return delegate.getProgress();
-      }
-
-      @Override
-      public Writable getCurrentKey() throws IOException, InterruptedException {
-        return delegate.getCurrentKey();
-      }
-
-      @Override
-      public Text getCurrentValue() throws IOException, InterruptedException {
-        return delegate.getCurrentValue();
-      }
-
-      @Override
-      public void initialize(InputSplit arg0, TaskAttemptContext context) throws IOException, InterruptedException {
-        delegate.initialize(fileSplit, context);
-      }
-
-      @Override
-      public boolean nextKeyValue() throws IOException, InterruptedException {
-        return delegate.nextKeyValue();
-      }
-
-      @Override
-      public void close() throws IOException {
-        delegate.close();
-      }
-
-    }
-
-    @Override
-    public RecordReader<Writable, Text> createRecordReader(InputSplit split, TaskAttemptContext context)
-        throws IOException {
-      return new CombineFileRecordReader<Writable, Text>((CombineFileSplit) split, context,
-          SequenceFileRecordReaderWrapper.class);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/CsvBlurMapper.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/CsvBlurMapper.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/CsvBlurMapper.java
deleted file mode 100644
index 8f59e31..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/CsvBlurMapper.java
+++ /dev/null
@@ -1,487 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeSet;
-
-import org.apache.blur.mapreduce.lib.BlurMutate.MUTATE_TYPE;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.Job;
-import org.apache.hadoop.mapreduce.lib.input.FileSplit;
-
-import com.google.common.base.Splitter;
-
-/**
- * This will parse a standard csv file into a {@link BlurMutate} object. Use the
- * static addColumns, and setSeparator methods to configure the class.
- */
-public class CsvBlurMapper extends BaseBlurMapper<Writable, Text> {
-
-  public static final String UTF_8 = "UTF-8";
-  public static final String BLUR_CSV_AUTO_GENERATE_RECORD_ID_AS_HASH_OF_DATA = "blur.csv.auto.generate.record.id.as.hash.of.data";
-  public static final String BLUR_CSV_AUTO_GENERATE_ROW_ID_AS_HASH_OF_DATA = "blur.csv.auto.generate.row.id.as.hash.of.data";
-  public static final String BLUR_CSV_FAMILY_PATH_MAPPINGS_FAMILIES = "blur.csv.family.path.mappings.families";
-  public static final String BLUR_CSV_FAMILY_PATH_MAPPINGS_FAMILY_PREFIX = "blur.csv.family.path.mappings.family.";
-  public static final String BLUR_CSV_SEPARATOR_BASE64 = "blur.csv.separator.base64";
-  public static final String BLUR_CSV_FAMILY_COLUMN_PREFIX = "blur.csv.family.";
-  public static final String BLUR_CSV_FAMILIES = "blur.csv.families";
-  public static final String HIVE_NULL = "\\N";
-
-  protected Map<String, List<String>> _columnNameMap;
-  protected String _separator = Base64.encodeBase64String(",".getBytes());
-  protected Splitter _splitter;
-  protected boolean _familyNotInFile;
-  protected String _familyFromPath;
-  protected boolean _autoGenerateRecordIdAsHashOfData;
-  protected MessageDigest _digest;
-  protected boolean _autoGenerateRowIdAsHashOfData;
-
-  /**
-   * Add a mapping for a family to a path. This is to be used when an entire
-   * path is to be processed as a single family and the data itself does not
-   * contain the family.<br/>
-   * <br/>
-   * 
-   * NOTE: the familyNotInFile property must be set before this method can be
-   * called.
-   * 
-   * @param job
-   *          the job to setup.
-   * @param family
-   *          the family.
-   * @param path
-   *          the path.
-   */
-  public static void addFamilyPath(Job job, String family, Path path) {
-    addFamilyPath(job.getConfiguration(), family, path);
-  }
-
-  /**
-   * Add a mapping for a family to a path. This is to be used when an entire
-   * path is to be processed as a single family and the data itself does not
-   * contain the family.<br/>
-   * <br/>
-   * 
-   * NOTE: the familyNotInFile property must be set before this method can be
-   * called.
-   * 
-   * @param configuration
-   *          the configuration to setup.
-   * @param family
-   *          the family.
-   * @param path
-   *          the path.
-   */
-  public static void addFamilyPath(Configuration configuration, String family, Path path) {
-    append(configuration, BLUR_CSV_FAMILY_PATH_MAPPINGS_FAMILIES, family);
-    append(configuration, BLUR_CSV_FAMILY_PATH_MAPPINGS_FAMILY_PREFIX + family, path.toString());
-  }
-
-  protected static void append(Configuration configuration, String name, String value) {
-    Collection<String> set = configuration.getStringCollection(name);
-    if (set == null) {
-      set = new TreeSet<String>();
-    }
-    set.add(value);
-    configuration.setStrings(name, set.toArray(new String[set.size()]));
-  }
-
-  /**
-   * If set to true the record id will be automatically generated as a hash of
-   * the data that the record contains.
-   * 
-   * @param job
-   *          the job to setup.
-   * @param autoGenerateRecordIdAsHashOfData
-   *          boolean.
-   */
-  public static void setAutoGenerateRecordIdAsHashOfData(Job job, boolean autoGenerateRecordIdAsHashOfData) {
-    setAutoGenerateRecordIdAsHashOfData(job.getConfiguration(), autoGenerateRecordIdAsHashOfData);
-  }
-
-  /**
-   * If set to true the record id will be automatically generated as a hash of
-   * the data that the record contains.
-   * 
-   * @param configuration
-   *          the configuration to setup.
-   * @param autoGenerateRecordIdAsHashOfData
-   *          boolean.
-   */
-  public static void setAutoGenerateRecordIdAsHashOfData(Configuration configuration,
-      boolean autoGenerateRecordIdAsHashOfData) {
-    configuration.setBoolean(BLUR_CSV_AUTO_GENERATE_RECORD_ID_AS_HASH_OF_DATA, autoGenerateRecordIdAsHashOfData);
-  }
-
-  /**
-   * Gets whether or not to generate a recordid for the record based on the
-   * data.
-   * 
-   * @param configuration
-   *          the configuration.
-   * @return boolean.
-   */
-  public static boolean isAutoGenerateRecordIdAsHashOfData(Configuration configuration) {
-    return configuration.getBoolean(BLUR_CSV_AUTO_GENERATE_RECORD_ID_AS_HASH_OF_DATA, false);
-  }
-
-  /**
-   * If set to true the record id will be automatically generated as a hash of
-   * the data that the record contains.
-   * 
-   * @param job
-   *          the job to setup.
-   * @param autoGenerateRecordIdAsHashOfData
-   *          boolean.
-   */
-  public static void setAutoGenerateRowIdAsHashOfData(Job job, boolean autoGenerateRowIdAsHashOfData) {
-    setAutoGenerateRowIdAsHashOfData(job.getConfiguration(), autoGenerateRowIdAsHashOfData);
-  }
-
-  /**
-   * If set to true the record id will be automatically generated as a hash of
-   * the data that the record contains.
-   * 
-   * @param configuration
-   *          the configuration to setup.
-   * @param autoGenerateRecordIdAsHashOfData
-   *          boolean.
-   */
-  public static void setAutoGenerateRowIdAsHashOfData(Configuration configuration, boolean autoGenerateRowIdAsHashOfData) {
-    configuration.setBoolean(BLUR_CSV_AUTO_GENERATE_ROW_ID_AS_HASH_OF_DATA, autoGenerateRowIdAsHashOfData);
-  }
-
-  /**
-   * Gets whether or not to generate a recordid for the record based on the
-   * data.
-   * 
-   * @param configuration
-   *          the configuration.
-   * @return boolean.
-   */
-  public static boolean isAutoGenerateRowIdAsHashOfData(Configuration configuration) {
-    return configuration.getBoolean(BLUR_CSV_AUTO_GENERATE_ROW_ID_AS_HASH_OF_DATA, false);
-  }
-
-  /**
-   * Sets all the family and column definitions.
-   * 
-   * @param job
-   *          the job to setup.
-   * @param strDefinition
-   *          the string definition. <br/>
-   * <br/>
-   *          Example:<br/>
-   *          "cf1:col1,col2,col3|cf2:col1,col2,col3"<br/>
-   *          Where "cf1" is a family name that contains columns "col1", "col2"
-   *          and "col3" and a second family of "cf2" with columns "col1",
-   *          "col2", and "col3".
-   */
-  public static void setColumns(Job job, String strDefinition) {
-    setColumns(job.getConfiguration(), strDefinition);
-  }
-
-  /**
-   * Sets all the family and column definitions.
-   * 
-   * @param configuration
-   *          the configuration to setup.
-   * @param strDefinition
-   *          the string definition. <br/>
-   * <br/>
-   *          Example:<br/>
-   *          "cf1:col1,col2,col3|cf2:col1,col2,col3"<br/>
-   *          Where "cf1" is a family name that contains columns "col1", "col2"
-   *          and "col3" and a second family of "cf2" with columns "col1",
-   *          "col2", and "col3".
-   */
-  public static void setColumns(Configuration configuration, String strDefinition) {
-    Iterable<String> familyDefs = Splitter.on('|').split(strDefinition);
-    for (String familyDef : familyDefs) {
-      int indexOf = familyDef.indexOf(':');
-      if (indexOf < 0) {
-        throwMalformedDefinition(strDefinition);
-      }
-      String family = familyDef.substring(0, indexOf);
-      Iterable<String> cols = Splitter.on(',').split(familyDef.substring(indexOf + 1));
-      List<String> colnames = new ArrayList<String>();
-      for (String columnName : cols) {
-        colnames.add(columnName);
-      }
-      if (family.trim().isEmpty() || colnames.isEmpty()) {
-        throwMalformedDefinition(strDefinition);
-      }
-      addColumns(configuration, family, colnames.toArray(new String[colnames.size()]));
-    }
-  }
-
-  protected static void throwMalformedDefinition(String strDefinition) {
-    throw new RuntimeException("Family and column definition string not valid [" + strDefinition
-        + "] should look like \"family1:colname1,colname2|family2:colname1,colname2,colname3\"");
-  }
-
-  /**
-   * Adds the column layout for the given family.
-   * 
-   * @param job
-   *          the job to apply the layout.
-   * @param family
-   *          the family name.
-   * @param columns
-   *          the column names.
-   */
-  public static void addColumns(Job job, String family, String... columns) {
-    addColumns(job.getConfiguration(), family, columns);
-  }
-
-  /**
-   * Adds the column layout for the given family.
-   * 
-   * @param configuration
-   *          the configuration to apply the layout.
-   * @param family
-   *          the family name.
-   * @param columns
-   *          the column names.
-   */
-  public static void addColumns(Configuration configuration, String family, String... columns) {
-    Collection<String> families = new TreeSet<String>(configuration.getStringCollection(BLUR_CSV_FAMILIES));
-    families.add(family);
-    configuration.setStrings(BLUR_CSV_FAMILIES, families.toArray(new String[] {}));
-    configuration.setStrings(BLUR_CSV_FAMILY_COLUMN_PREFIX + family, columns);
-  }
-
-  public static Collection<String> getFamilyNames(Configuration configuration) {
-    return configuration.getStringCollection(BLUR_CSV_FAMILIES);
-  }
-
-  public static Map<String, List<String>> getFamilyAndColumnNameMap(Configuration configuration) {
-    Map<String, List<String>> columnNameMap = new HashMap<String, List<String>>();
-    for (String family : getFamilyNames(configuration)) {
-      String[] columnsNames = configuration.getStrings(BLUR_CSV_FAMILY_COLUMN_PREFIX + family);
-      columnNameMap.put(family, Arrays.asList(columnsNames));
-    }
-    return columnNameMap;
-  }
-
-  /**
-   * Sets the separator of the file, by default it is ",".
-   * 
-   * @param job
-   *          the job to apply the separator change.
-   * @param separator
-   *          the separator.
-   */
-  public static void setSeparator(Job job, String separator) {
-    setSeparator(job.getConfiguration(), separator);
-  }
-
-  /**
-   * Sets the separator of the file, by default it is ",".
-   * 
-   * @param configuration
-   *          the configuration to apply the separator change.
-   * @param separator
-   *          the separator.
-   */
-  public static void setSeparator(Configuration configuration, String separator) {
-    try {
-      configuration.set(BLUR_CSV_SEPARATOR_BASE64, Base64.encodeBase64String(separator.getBytes(UTF_8)));
-    } catch (UnsupportedEncodingException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override
-  protected void setup(Context context) throws IOException, InterruptedException {
-    super.setup(context);
-    Configuration configuration = context.getConfiguration();
-    _autoGenerateRecordIdAsHashOfData = isAutoGenerateRecordIdAsHashOfData(configuration);
-    _autoGenerateRowIdAsHashOfData = isAutoGenerateRowIdAsHashOfData(configuration);
-    if (_autoGenerateRecordIdAsHashOfData || _autoGenerateRowIdAsHashOfData) {
-      try {
-        _digest = MessageDigest.getInstance("MD5");
-      } catch (NoSuchAlgorithmException e) {
-        throw new IOException(e);
-      }
-    }
-    _columnNameMap = getFamilyAndColumnNameMap(configuration);
-    _separator = new String(Base64.decodeBase64(configuration.get(BLUR_CSV_SEPARATOR_BASE64, _separator)), UTF_8);
-    _splitter = Splitter.on(_separator);
-    Path fileCurrentlyProcessing = getCurrentFile(context);
-    Collection<String> families = configuration.getStringCollection(BLUR_CSV_FAMILY_PATH_MAPPINGS_FAMILIES);
-    OUTER: for (String family : families) {
-      Collection<String> pathStrCollection = configuration
-          .getStringCollection(BLUR_CSV_FAMILY_PATH_MAPPINGS_FAMILY_PREFIX + family);
-      for (String pathStr : pathStrCollection) {
-        Path path = new Path(pathStr);
-        path = path.makeQualified(path.getFileSystem(configuration));
-        if (isParent(path, fileCurrentlyProcessing)) {
-          _familyFromPath = family;
-          _familyNotInFile = true;
-          break OUTER;
-        }
-      }
-    }
-  }
-
-  protected boolean isParent(Path possibleParent, Path child) {
-    if (child == null) {
-      return false;
-    }
-    if (possibleParent.equals(child.getParent())) {
-      return true;
-    }
-    return isParent(possibleParent, child.getParent());
-  }
-
-  protected Path getCurrentFile(Context context) throws IOException {
-    InputSplit split = context.getInputSplit();
-    if (split != null && split instanceof FileSplit) {
-      FileSplit inputSplit = (FileSplit) split;
-      Path path = inputSplit.getPath();
-      return path.makeQualified(path.getFileSystem(context.getConfiguration()));
-    }
-    return null;
-  }
-
-  @Override
-  protected void map(Writable k, Text value, Context context) throws IOException, InterruptedException {
-    BlurRecord record = _mutate.getRecord();
-    record.clearColumns();
-    String str = value.toString();
-
-    Iterable<String> split = _splitter.split(str);
-    List<String> list = toList(split);
-
-    int offset = 0;
-    boolean gen = false;
-    if (!_autoGenerateRowIdAsHashOfData) {
-      record.setRowId(list.get(offset++));
-    } else {
-      _digest.reset();
-      byte[] bs = value.getBytes();
-      int length = value.getLength();
-      _digest.update(bs, 0, length);
-      record.setRowId(new BigInteger(_digest.digest()).toString(Character.MAX_RADIX));
-      gen = true;
-    }
-
-    if (!_autoGenerateRecordIdAsHashOfData) {
-      record.setRecordId(list.get(offset++));
-    } else {
-      if (gen) {
-        record.setRecordId(record.getRowId());
-      } else {
-        _digest.reset();
-        byte[] bs = value.getBytes();
-        int length = value.getLength();
-        _digest.update(bs, 0, length);
-        record.setRecordId(new BigInteger(_digest.digest()).toString(Character.MAX_RADIX));
-      }
-    }
-    String family;
-    if (_familyNotInFile) {
-      family = _familyFromPath;
-    } else {
-      family = list.get(offset++);
-    }
-    record.setFamily(family);
-
-    List<String> columnNames = _columnNameMap.get(family);
-    if (columnNames == null) {
-      throw new IOException("Family [" + family + "] is missing in the definition.");
-    }
-    if (list.size() - offset != columnNames.size()) {
-
-      String options = "";
-
-      if (!_autoGenerateRowIdAsHashOfData) {
-        options += "rowid,";
-      }
-      if (!_autoGenerateRecordIdAsHashOfData) {
-        options += "recordid,";
-      }
-      if (!_familyNotInFile) {
-        options += "family,";
-      }
-      String msg = "Record [" + str + "] does not match defined record [" + options + getColumnNames(columnNames)
-          + "].";
-      throw new IOException(msg);
-    }
-
-    for (int i = 0; i < columnNames.size(); i++) {
-      String val = handleHiveNulls(list.get(i + offset));
-      if (val != null) {
-        record.addColumn(columnNames.get(i), val);
-        _columnCounter.increment(1);
-      }
-    }
-    _key.set(record.getRowId());
-    _mutate.setMutateType(MUTATE_TYPE.REPLACE);
-    context.write(_key, _mutate);
-    _recordCounter.increment(1);
-    context.progress();
-  }
-
-  protected String handleHiveNulls(String value) {
-    if (value.equals(HIVE_NULL)) {
-      return null;
-    }
-    return value;
-  }
-
-  public void setFamilyFromPath(String familyFromPath) {
-    this._familyFromPath = familyFromPath;
-  }
-
-  protected String getColumnNames(List<String> columnNames) {
-    StringBuilder builder = new StringBuilder();
-    for (String c : columnNames) {
-      if (builder.length() != 0) {
-        builder.append(',');
-      }
-      builder.append(c);
-    }
-    return builder.toString();
-  }
-
-  protected List<String> toList(Iterable<String> split) {
-    List<String> lst = new ArrayList<String>();
-    for (String s : split) {
-      lst.add(s);
-    }
-    return lst;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DefaultBlurReducer.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DefaultBlurReducer.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DefaultBlurReducer.java
deleted file mode 100644
index 99f2ac5..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DefaultBlurReducer.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-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;
-
-/**
- * This class is to be used in conjunction with {@link BlurOutputFormat}
- * .</br></br>
- * 
- * Here is a basic example of how to use both the {@link BlurOutputFormat} and
- * the {@link DefaultBlurReducer} together to build indexes.</br></br>
- * 
- * Once this job has successfully completed the indexes will be imported by the
- * running shard servers and be placed online. This is a polling mechicism in
- * the shard servers and by default they poll every 10 seconds.
- * 
- * 
- * </br></br>
- * 
- * Job job = new Job(conf, "blur index");</br>
- * job.setJarByClass(BlurOutputFormatTest.class);</br>
- * job.setMapperClass(CsvBlurMapper.class);</br>
- * job.setReducerClass(DefaultBlurReducer.class);</br>
- * job.setNumReduceTasks(1);</br>
- * job.setInputFormatClass(TrackingTextInputFormat.class);</br>
- * job.setOutputKeyClass(Text.class);
- * </br>job.setOutputValueClass(BlurMutate.class);</br>
- * job.setOutputFormatClass(BlurOutputFormat.class);</br> </br>
- * FileInputFormat.addInputPath(job, new Path(TEST_ROOT_DIR + "/in"));</br>
- * CsvBlurMapper.addColumns(job, "cf1", "col");</br> </br> TableDescriptor
- * tableDescriptor = new TableDescriptor();</br>
- * tableDescriptor.setShardCount(1)
- * ;</br>tableDescriptor.setAnalyzerDefinition(new
- * AnalyzerDefinition());</br>tableDescriptor.setTableUri(new Path(TEST_ROOT_DIR
- * + "/out").toString());</br>BlurOutputFormat.setTableDescriptor(job,
- * tableDescriptor);</br>
- * 
- * 
- */
-public class DefaultBlurReducer extends Reducer<Writable, BlurMutate, Writable, BlurMutate> {
-
-  @Override
-  protected void setup(final Context context) throws IOException, InterruptedException {
-    BlurOutputFormat.setProgressable(context);
-    BlurOutputFormat.setGetCounter(new GetCounter() {
-      @Override
-      public Counter getCounter(Enum<?> counterName) {
-        return context.getCounter(counterName);
-      }
-    });
-  }
-
-  @Override
-  protected void reduce(Writable key, Iterable<BlurMutate> values, Context context) throws IOException,
-      InterruptedException {
-    Text textKey = getTextKey(key);
-    for (BlurMutate value : values) {
-      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.");
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategy.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategy.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategy.java
deleted file mode 100644
index 8b6f255..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.lucene.document.Field;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-public abstract class DocumentBufferStrategy {
-
-  protected final Map<String, List<Field>> _documents = new TreeMap<String, List<Field>>();
-
-  public DocumentBufferStrategy(Configuration configuration) {
-    
-  }
-  
-  public abstract boolean isFull();
-
-  protected abstract void newDocument(List<Field> document);
-
-  public List<Field> add(String recordId, List<Field> document) {
-    newDocument(document);
-    return _documents.put(recordId, document);
-  }
-
-  public List<List<Field>> getAndClearBuffer() {
-    List<List<Field>> docs = new ArrayList<List<Field>>(_documents.values());
-    _documents.clear();
-    return docs;
-  }
-
-  public boolean isEmpty() {
-    return _documents.isEmpty();
-  }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategyFixedSize.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategyFixedSize.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategyFixedSize.java
deleted file mode 100644
index 18a5f8e..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategyFixedSize.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-import java.util.List;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.lucene.document.Field;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-public class DocumentBufferStrategyFixedSize extends DocumentBufferStrategy {
-
-  private final int _maxDocumentBufferSize;
-
-  public DocumentBufferStrategyFixedSize(Configuration configuration) {
-    super(configuration);
-    _maxDocumentBufferSize = BlurOutputFormat.getMaxDocumentBufferSize(configuration);
-  }
-
-  @Override
-  public boolean isFull() {
-    return _documents.size() >= _maxDocumentBufferSize;
-  }
-
-  @Override
-  protected void newDocument(List<Field> document) {
-    // no op
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategyHeapSize.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategyHeapSize.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategyHeapSize.java
deleted file mode 100644
index 4e6b626..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentBufferStrategyHeapSize.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-import java.util.List;
-
-import org.apache.blur.utils.RamUsageEstimator;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.lucene.document.Field;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-public class DocumentBufferStrategyHeapSize extends DocumentBufferStrategy {
-
-  private final long _maxDocumentBufferHeapSize;
-  private long _currentHeapSize;
-
-  public DocumentBufferStrategyHeapSize(Configuration configuration) {
-    super(configuration);
-    _maxDocumentBufferHeapSize = BlurOutputFormat.getMaxDocumentBufferHeapSize(configuration);
-  }
-
-  @Override
-  public boolean isFull() {
-    return _currentHeapSize >= _maxDocumentBufferHeapSize;
-  }
-
-  @Override
-  protected void newDocument(List<Field> document) {
-    _currentHeapSize += RamUsageEstimator.sizeOf(document);
-  }
-
-  @Override
-  public List<List<Field>> getAndClearBuffer() {
-    List<List<Field>> docs = super.getAndClearBuffer();
-    _currentHeapSize = 0;
-    return docs;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentSizeOf.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentSizeOf.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentSizeOf.java
deleted file mode 100644
index 7914838..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/DocumentSizeOf.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-import java.util.List;
-
-import org.apache.blur.utils.RamUsageEstimator;
-import org.apache.lucene.document.Field;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class DocumentSizeOf {
-
-  public static long sizeOf(List<Field> fields) {
-    return RamUsageEstimator.sizeOf(fields);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/GenericBlurRecordWriter.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/GenericBlurRecordWriter.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/GenericBlurRecordWriter.java
deleted file mode 100644
index fcbe98e..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/GenericBlurRecordWriter.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.blur.mapreduce.lib;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.blur.analysis.FieldManager;
-import org.apache.blur.log.Log;
-import org.apache.blur.log.LogFactory;
-import org.apache.blur.lucene.LuceneVersionConstant;
-import org.apache.blur.lucene.codec.Blur024Codec;
-import org.apache.blur.mapreduce.lib.BlurMutate.MUTATE_TYPE;
-import org.apache.blur.server.TableContext;
-import org.apache.blur.store.hdfs.HdfsDirectory;
-import org.apache.blur.thrift.generated.Column;
-import org.apache.blur.thrift.generated.Record;
-import org.apache.blur.thrift.generated.TableDescriptor;
-import org.apache.blur.utils.BlurConstants;
-import org.apache.blur.utils.RowDocumentUtil;
-import org.apache.blur.utils.ShardUtil;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.mapreduce.Counter;
-import org.apache.hadoop.util.Progressable;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.document.StringField;
-import org.apache.lucene.index.AtomicReader;
-import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.SlowCompositeReaderWrapper;
-import org.apache.lucene.index.TieredMergePolicy;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.IOContext;
-import org.apache.lucene.store.NoLockFactory;
-import org.apache.lucene.store.SimpleFSDirectory;
-
-public class GenericBlurRecordWriter {
-
-  private static final Log LOG = LogFactory.getLog(GenericBlurRecordWriter.class);
-  private static final String JAVA_IO_TMPDIR = "java.io.tmpdir";
-  private static final Counter NULL_COUNTER = NullCounter.getNullCounter();
-
-  private final Text _prevKey = new Text();
-
-  private final IndexWriter _writer;
-  private final FieldManager _fieldManager;
-  private final Directory _finalDir;
-  private final Directory _localDir;
-  private final File _localPath;
-  // private final int _maxDocumentBufferSize;
-  private final IndexWriterConfig _conf;
-  private final IndexWriterConfig _overFlowConf;
-  private final Path _newIndex;
-  private final boolean _indexLocally;
-  private final boolean _optimizeInFlight;
-  private final DocumentBufferStrategy _documentBufferStrategy;
-  private Counter _columnCount = NULL_COUNTER;
-  private Counter _fieldCount = NULL_COUNTER;
-  private Counter _recordCount = NULL_COUNTER;
-  private Counter _rowCount = NULL_COUNTER;
-  private Counter _recordDuplicateCount = NULL_COUNTER;
-  private Counter _rowOverFlowCount = NULL_COUNTER;
-  private Counter _rowDeleteCount = NULL_COUNTER;
-  private RateCounter _recordRateCounter = new RateCounter(NULL_COUNTER);
-  private RateCounter _rowRateCounter = new RateCounter(NULL_COUNTER);
-  private RateCounter _copyRateCounter = new RateCounter(NULL_COUNTER);
-  private boolean _countersSetup = false;
-  private IndexWriter _localTmpWriter;
-  private boolean _usingLocalTmpindex;
-  private File _localTmpPath;
-  private ProgressableDirectory _localTmpDir;
-  private String _deletedRowId;
-  private Configuration _configuration;
-
-  public GenericBlurRecordWriter(Configuration configuration, int attemptId, String tmpDirName) throws IOException {
-    _configuration = configuration;
-    _documentBufferStrategy = BlurOutputFormat.getDocumentBufferStrategy(_configuration);
-    _indexLocally = BlurOutputFormat.isIndexLocally(_configuration);
-    _optimizeInFlight = BlurOutputFormat.isOptimizeInFlight(_configuration);
-
-    TableDescriptor tableDescriptor = BlurOutputFormat.getTableDescriptor(_configuration);
-    int shardCount = tableDescriptor.getShardCount();
-    int shardId = attemptId % shardCount;
-
-    Path tableOutput = BlurOutputFormat.getOutputPath(_configuration);
-    String shardName = ShardUtil.getShardName(BlurConstants.SHARD_PREFIX, shardId);
-    Path indexPath = new Path(tableOutput, shardName);
-    _newIndex = new Path(indexPath, tmpDirName);
-    _finalDir = new ProgressableDirectory(new HdfsDirectory(_configuration, _newIndex), getProgressable());
-    _finalDir.setLockFactory(NoLockFactory.getNoLockFactory());
-
-    TableContext tableContext = TableContext.create(tableDescriptor);
-    _fieldManager = tableContext.getFieldManager();
-    Analyzer analyzer = _fieldManager.getAnalyzerForIndex();
-
-    _conf = new IndexWriterConfig(LuceneVersionConstant.LUCENE_VERSION, analyzer);
-    _conf.setCodec(new Blur024Codec());
-    _conf.setSimilarity(tableContext.getSimilarity());
-    TieredMergePolicy mergePolicy = (TieredMergePolicy) _conf.getMergePolicy();
-    mergePolicy.setUseCompoundFile(false);
-
-    _overFlowConf = _conf.clone();
-
-    if (_indexLocally) {
-      String localDirPath = System.getProperty(JAVA_IO_TMPDIR);
-      _localPath = new File(localDirPath, UUID.randomUUID().toString() + ".tmp");
-      SimpleFSDirectory directory = new SimpleFSDirectory(_localPath);
-      _localDir = new ProgressableDirectory(directory, getProgressable());
-      _writer = new IndexWriter(_localDir, _conf.clone());
-    } else {
-      _localPath = null;
-      _localDir = null;
-      _writer = new IndexWriter(_finalDir, _conf.clone());
-    }
-  }
-
-  private Progressable getProgressable() {
-    final Progressable prg = BlurOutputFormat.getProgressable();
-    return new Progressable() {
-
-      private Progressable _progressable = prg;
-      private long _lastWarn = 0;
-      private boolean _progressSetupLogged = false;
-
-      @Override
-      public void progress() {
-        if (_progressable != null) {
-          _progressable.progress();
-          if (!_progressSetupLogged) {
-            LOG.info("Progress has been setup correctly.");
-            _progressSetupLogged = true;
-          }
-        } else {
-          Progressable progressable = BlurOutputFormat.getProgressable();
-          if (progressable != null) {
-            _progressable = progressable;
-          } else {
-            long now = System.nanoTime();
-            if (_lastWarn + TimeUnit.SECONDS.toNanos(10) < now) {
-              LOG.warn("Progress not being reported.");
-              _lastWarn = System.nanoTime();
-            }
-          }
-        }
-      }
-    };
-  }
-
-  public void write(Text key, BlurMutate value) throws IOException {
-    if (!_countersSetup) {
-      setupCounter();
-      _countersSetup = true;
-    }
-    if (!_prevKey.equals(key)) {
-      flush();
-      _prevKey.set(key);
-    }
-    add(value);
-  }
-
-  private void setupCounter() {
-    GetCounter getCounter = BlurOutputFormat.getGetCounter();
-    if (getCounter != null) {
-      _fieldCount = getCounter.getCounter(BlurCounters.LUCENE_FIELD_COUNT);
-      _columnCount = getCounter.getCounter(BlurCounters.COLUMN_COUNT);
-      _recordCount = getCounter.getCounter(BlurCounters.RECORD_COUNT);
-      _recordDuplicateCount = getCounter.getCounter(BlurCounters.RECORD_DUPLICATE_COUNT);
-      _rowCount = getCounter.getCounter(BlurCounters.ROW_COUNT);
-      _rowDeleteCount = getCounter.getCounter(BlurCounters.ROW_DELETE_COUNT);
-      _rowOverFlowCount = getCounter.getCounter(BlurCounters.ROW_OVERFLOW_COUNT);
-      _recordRateCounter = new RateCounter(getCounter.getCounter(BlurCounters.RECORD_RATE));
-      _rowRateCounter = new RateCounter(getCounter.getCounter(BlurCounters.ROW_RATE));
-      _copyRateCounter = new RateCounter(getCounter.getCounter(BlurCounters.COPY_RATE));
-    }
-  }
-
-  private void add(BlurMutate value) throws IOException {
-    BlurRecord blurRecord = value.getRecord();
-    Record record = getRecord(blurRecord);
-    String recordId = record.getRecordId();
-    if (value.getMutateType() == MUTATE_TYPE.DELETE) {
-      _deletedRowId = blurRecord.getRowId();
-      return;
-    }
-    if (_countersSetup) {
-      _columnCount.increment(record.getColumns().size());
-    }
-    List<Field> document = RowDocumentUtil.getDoc(_fieldManager, blurRecord.getRowId(), record);
-    List<Field> dup = _documentBufferStrategy.add(recordId, document);
-    if (_countersSetup) {
-      if (dup != null) {
-        _recordDuplicateCount.increment(1);
-      } else {
-        _fieldCount.increment(document.size());
-        _recordCount.increment(1);
-      }
-    }
-    flushToTmpIndexIfNeeded();
-  }
-
-  private void flushToTmpIndexIfNeeded() throws IOException {
-    if (_documentBufferStrategy.isFull()) {
-      LOG.info("Document Buffer is full overflow to disk.");
-      flushToTmpIndex();
-    }
-  }
-
-  private void flushToTmpIndex() throws IOException {
-    if (_documentBufferStrategy.isEmpty()) {
-      return;
-    }
-    _usingLocalTmpindex = true;
-    if (_localTmpWriter == null) {
-      String localDirPath = System.getProperty(JAVA_IO_TMPDIR);
-      _localTmpPath = new File(localDirPath, UUID.randomUUID().toString() + ".tmp");
-      SimpleFSDirectory directory = new SimpleFSDirectory(_localTmpPath);
-      _localTmpDir = new ProgressableDirectory(directory, getProgressable());
-      _localTmpWriter = new IndexWriter(_localTmpDir, _overFlowConf.clone());
-      // The local tmp writer has merging disabled so the first document in is
-      // going to be doc 0.
-      // Therefore the first document added is the prime doc
-      List<List<Field>> docs = _documentBufferStrategy.getAndClearBuffer();
-      for (List<Field> doc : docs) {
-        _localTmpWriter.addDocument(doc);
-      }
-    } else {
-      List<List<Field>> docs = _documentBufferStrategy.getAndClearBuffer();
-      for (List<Field> doc : docs) {
-        _localTmpWriter.addDocument(doc);
-      }
-    }
-  }
-
-  private void resetLocalTmp() {
-    _usingLocalTmpindex = false;
-    _localTmpWriter = null;
-    _localTmpDir = null;
-    rm(_localTmpPath);
-    _localTmpPath = null;
-  }
-
-  public static Record getRecord(BlurRecord value) {
-    Record record = new Record();
-    record.setRecordId(value.getRecordId());
-    record.setFamily(value.getFamily());
-    for (BlurColumn col : value.getColumns()) {
-      record.addToColumns(new Column(col.getName(), col.getValue()));
-    }
-    return record;
-  }
-
-  private void flush() throws CorruptIndexException, IOException {
-    if (_usingLocalTmpindex) {
-      // since we have flushed to disk then we do not need to index the
-      // delete.
-      flushToTmpIndex();
-      _localTmpWriter.close(false);
-      DirectoryReader reader = DirectoryReader.open(_localTmpDir);
-      AtomicReader atomicReader = SlowCompositeReaderWrapper.wrap(reader);
-      AtomicReader primeDocAtomicReader= PrimeDocOverFlowHelper.addPrimeDoc(atomicReader);
-      if (_countersSetup) {
-        _recordRateCounter.mark(reader.numDocs());
-      }
-      _writer.addIndexes(primeDocAtomicReader);
-      primeDocAtomicReader.close();
-      resetLocalTmp();
-      _writer.maybeMerge();
-      if (_countersSetup) {
-        _rowOverFlowCount.increment(1);
-      }
-    } else {
-      if (_documentBufferStrategy.isEmpty()) {
-        if (_deletedRowId != null) {
-          _writer.addDocument(getDeleteDoc());
-          if (_countersSetup) {
-            _rowDeleteCount.increment(1);
-          }
-        }
-      } else {
-        List<List<Field>> docs = _documentBufferStrategy.getAndClearBuffer();
-        docs.get(0).add(new StringField(BlurConstants.PRIME_DOC, BlurConstants.PRIME_DOC_VALUE, Store.NO));
-        _writer.addDocuments(docs);
-        if (_countersSetup) {
-          _recordRateCounter.mark(docs.size());
-        }
-      }
-    }
-    _deletedRowId = null;
-    if (_countersSetup) {
-      _rowRateCounter.mark();
-      _rowCount.increment(1);
-    }
-  }
-
-  private Document getDeleteDoc() {
-    Document document = new Document();
-    document.add(new StringField(BlurConstants.ROW_ID, _deletedRowId, Store.NO));
-    document.add(new StringField(BlurConstants.DELETE_MARKER, BlurConstants.DELETE_MARKER_VALUE, Store.NO));
-    return document;
-  }
-
-  public void close() throws IOException {
-    flush();
-    _writer.close();
-    if (_countersSetup) {
-      _recordRateCounter.close();
-      _rowRateCounter.close();
-    }
-    if (_indexLocally) {
-      if (_optimizeInFlight) {
-        copyAndOptimizeInFlightDir();
-      } else {
-        copyDir();
-      }
-    }
-    if (_countersSetup) {
-      _copyRateCounter.close();
-    }
-  }
-
-  private void copyAndOptimizeInFlightDir() throws IOException {
-    CopyRateDirectory copyRateDirectory = new CopyRateDirectory(_finalDir, _copyRateCounter);
-    copyRateDirectory.setLockFactory(NoLockFactory.getNoLockFactory());
-    DirectoryReader reader = DirectoryReader.open(_localDir);
-    IndexWriter writer = new IndexWriter(copyRateDirectory, _conf.clone());
-    writer.addIndexes(reader);
-    writer.close();
-    rm(_localPath);
-  }
-
-  private void copyDir() throws IOException {
-    CopyRateDirectory copyRateDirectory = new CopyRateDirectory(_finalDir, _copyRateCounter);
-    String[] fileNames = _localDir.listAll();
-    for (String fileName : fileNames) {
-      LOG.info("Copying [{0}] to [{1}]", fileName, _newIndex);
-      _localDir.copy(copyRateDirectory, fileName, fileName, IOContext.DEFAULT);
-    }
-    rm(_localPath);
-  }
-
-  private void rm(File file) {
-    if (!file.exists()) {
-      return;
-    }
-    if (file.isDirectory()) {
-      for (File f : file.listFiles()) {
-        rm(f);
-      }
-    }
-    file.delete();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/GetCounter.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/GetCounter.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/GetCounter.java
deleted file mode 100644
index 6814ac2..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/GetCounter.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-import org.apache.hadoop.mapreduce.Counter;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-/**
- * 
- */
-public interface GetCounter {
-  
-  Counter getCounter(Enum<?> counterName);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/IOUtil.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/IOUtil.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/IOUtil.java
deleted file mode 100644
index cf62cbc..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/IOUtil.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.blur.thrift.generated.Column;
-import org.apache.blur.thrift.generated.Record;
-
-public class IOUtil {
-
-  public static final String UTF_8 = "UTF-8";
-
-  public static String readString(DataInput input) throws IOException {
-    int length = readVInt(input);
-    byte[] buffer = new byte[length];
-    input.readFully(buffer);
-    return new String(buffer, UTF_8);
-  }
-
-  public static void writeString(DataOutput output, String s) throws IOException {
-    byte[] bs = s.getBytes(UTF_8);
-    writeVInt(output, bs.length);
-    output.write(bs);
-  }
-
-  public static int readVInt(DataInput input) throws IOException {
-    byte b = input.readByte();
-    int i = b & 0x7F;
-    for (int shift = 7; (b & 0x80) != 0; shift += 7) {
-      b = input.readByte();
-      i |= (b & 0x7F) << shift;
-    }
-    return i;
-  }
-
-  public static void writeVInt(DataOutput output, int i) throws IOException {
-    while ((i & ~0x7F) != 0) {
-      output.writeByte((byte) ((i & 0x7f) | 0x80));
-      i >>>= 7;
-    }
-    output.writeByte((byte) i);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/NullCounter.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/NullCounter.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/NullCounter.java
deleted file mode 100644
index 4b024d6..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/NullCounter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.apache.hadoop.mapreduce.Counter;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-public class NullCounter {
-
-  public static Counter getNullCounter() {
-    try {
-      // Try hadoop 2 version
-      Class<?> clazz1 = Class.forName("org.apache.hadoop.mapreduce.counters.GenericCounter");
-      return (Counter) clazz1.newInstance();
-    } catch (ClassNotFoundException e1) {
-      // Try hadoop 1 version
-      try {
-        Class<?> clazz2 = Class.forName("org.apache.hadoop.mapreduce.Counter");
-        Constructor<?> constructor = clazz2.getDeclaredConstructor(new Class[] {});
-        constructor.setAccessible(true);
-        return (Counter) constructor.newInstance(new Object[] {});
-      } catch (ClassNotFoundException e2) {
-        throw new RuntimeException(e2);
-      } catch (NoSuchMethodException e2) {
-        throw new RuntimeException(e2);
-      } catch (SecurityException e2) {
-        throw new RuntimeException(e2);
-      } catch (InstantiationException e2) {
-        throw new RuntimeException(e2);
-      } catch (IllegalAccessException e2) {
-        throw new RuntimeException(e2);
-      } catch (IllegalArgumentException e2) {
-        throw new RuntimeException(e2);
-      } catch (InvocationTargetException e2) {
-        throw new RuntimeException(e2);
-      }
-    } catch (InstantiationException e) {
-      throw new RuntimeException(e);
-    } catch (IllegalAccessException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/PrimeDocOverFlowHelper.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/PrimeDocOverFlowHelper.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/PrimeDocOverFlowHelper.java
deleted file mode 100644
index 672a1c1..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/PrimeDocOverFlowHelper.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.blur.mapreduce.lib;
-
-import java.io.IOException;
-
-import org.apache.blur.utils.BlurConstants;
-import org.apache.lucene.analysis.core.KeywordAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.document.StringField;
-import org.apache.lucene.index.AtomicReader;
-import org.apache.lucene.index.AtomicReaderContext;
-import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.FilterAtomicReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.ParallelAtomicReader;
-import org.apache.lucene.index.StoredFieldVisitor;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.Version;
-
-public class PrimeDocOverFlowHelper {
-
-  private static Directory _directory;
-
-  static {
-    try {
-      _directory = new RAMDirectory();
-      IndexWriter writer = new IndexWriter(_directory, new IndexWriterConfig(Version.LUCENE_43, new KeywordAnalyzer()));
-      Document document = new Document();
-      document.add(new StringField(BlurConstants.PRIME_DOC, BlurConstants.PRIME_DOC_VALUE, Store.NO));
-      writer.addDocument(document);
-      writer.close();
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public static AtomicReader addPrimeDoc(AtomicReader atomicReader) throws IOException {
-    AtomicReaderContext context = DirectoryReader.open(_directory).leaves().get(0);
-    return new ParallelAtomicReader(true, setDocSize(context.reader(), atomicReader.maxDoc()), atomicReader);
-  }
-
-  private static AtomicReader setDocSize(AtomicReader reader, final int count) {
-    return new FilterAtomicReader(reader) {
-      @Override
-      public Bits getLiveDocs() {
-        return new Bits() {
-          @Override
-          public boolean get(int index) {
-            return true;
-          }
-
-          @Override
-          public int length() {
-            return count;
-          }
-        };
-      }
-
-      @Override
-      public int numDocs() {
-        return count;
-      }
-
-      @Override
-      public int maxDoc() {
-        return count;
-      }
-
-      @Override
-      public void document(int docID, StoredFieldVisitor visitor) throws IOException {
-        // Do nothing
-      }
-    };
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/ProgressableDirectory.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/ProgressableDirectory.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/ProgressableDirectory.java
deleted file mode 100644
index 15700bc..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/ProgressableDirectory.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.blur.log.Log;
-import org.apache.blur.log.LogFactory;
-import org.apache.hadoop.util.Progressable;
-import org.apache.lucene.store.BufferedIndexInput;
-import org.apache.lucene.store.BufferedIndexOutput;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.IOContext;
-import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.store.Lock;
-import org.apache.lucene.store.LockFactory;
-
-/**
- * The {@link ProgressableDirectory} allows for progress to be recorded while
- * Lucene is blocked and merging. This prevents the Task from being killed after
- * not reporting progress because of the blocked merge.
- */
-public class ProgressableDirectory extends Directory {
-
-  private static final Log LOG = LogFactory.getLog(ProgressableDirectory.class);
-
-  private final Directory _directory;
-  private final Progressable _progressable;
-
-  public ProgressableDirectory(Directory directory, Progressable progressable) {
-    _directory = directory;
-    if (progressable == null) {
-      LOG.warn("Progressable is null.");
-      _progressable = new Progressable() {
-        @Override
-        public void progress() {
-
-        }
-      };
-    } else {
-      _progressable = progressable;
-    }
-  }
-
-  @Override
-  public void clearLock(String name) throws IOException {
-    _directory.clearLock(name);
-  }
-
-  @Override
-  public void close() throws IOException {
-    _directory.close();
-  }
-
-  private IndexInput wrapInput(String name, IndexInput openInput) {
-    return new ProgressableIndexInput(name, openInput, 16384, _progressable);
-  }
-
-  private IndexOutput wrapOutput(IndexOutput createOutput) {
-    return new ProgressableIndexOutput(createOutput, _progressable);
-  }
-
-  public IndexOutput createOutput(String name, IOContext context) throws IOException {
-    return wrapOutput(_directory.createOutput(name, context));
-  }
-
-  @Override
-  public void deleteFile(String name) throws IOException {
-    _directory.deleteFile(name);
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    return _directory.equals(obj);
-  }
-
-  @Override
-  public boolean fileExists(String name) throws IOException {
-    return _directory.fileExists(name);
-  }
-
-  @Override
-  public long fileLength(String name) throws IOException {
-    return _directory.fileLength(name);
-  }
-
-  @Override
-  public LockFactory getLockFactory() {
-    return _directory.getLockFactory();
-  }
-
-  @Override
-  public String getLockID() {
-    return _directory.getLockID();
-  }
-
-  @Override
-  public int hashCode() {
-    return _directory.hashCode();
-  }
-
-  @Override
-  public String[] listAll() throws IOException {
-    return _directory.listAll();
-  }
-
-  @Override
-  public Lock makeLock(String name) {
-    return _directory.makeLock(name);
-  }
-
-  @Override
-  public IndexInput openInput(String name, IOContext context) throws IOException {
-    return wrapInput(name, _directory.openInput(name, context));
-  }
-
-  @Override
-  public void setLockFactory(LockFactory lockFactory) throws IOException {
-    _directory.setLockFactory(lockFactory);
-  }
-
-  @Override
-  public void sync(Collection<String> names) throws IOException {
-    _directory.sync(names);
-  }
-
-  @Override
-  public String toString() {
-    return _directory.toString();
-  }
-
-  static class ProgressableIndexOutput extends BufferedIndexOutput {
-
-    private Progressable _progressable;
-    private IndexOutput _indexOutput;
-
-    public ProgressableIndexOutput(IndexOutput indexOutput, Progressable progressable) {
-      _indexOutput = indexOutput;
-      _progressable = progressable;
-    }
-
-    @Override
-    protected void flushBuffer(byte[] b, int offset, int len) throws IOException {
-      _indexOutput.writeBytes(b, offset, len);
-      _progressable.progress();
-    }
-
-    @Override
-    public long length() throws IOException {
-      return _indexOutput.length();
-    }
-
-    @Override
-    public void close() throws IOException {
-      super.close();
-      _indexOutput.close();
-      _progressable.progress();
-    }
-
-  }
-
-  static class ProgressableIndexInput extends BufferedIndexInput {
-
-    private IndexInput _indexInput;
-    private final long _length;
-    private Progressable _progressable;
-
-    ProgressableIndexInput(String name, IndexInput indexInput, int buffer, Progressable progressable) {
-      super("ProgressableIndexInput(" + indexInput.toString() + ")", buffer);
-      _indexInput = indexInput;
-      _length = indexInput.length();
-      _progressable = progressable;
-    }
-
-    @Override
-    protected void readInternal(byte[] b, int offset, int length) throws IOException {
-      long filePointer = getFilePointer();
-      if (filePointer != _indexInput.getFilePointer()) {
-        _indexInput.seek(filePointer);
-      }
-      _indexInput.readBytes(b, offset, length);
-      _progressable.progress();
-    }
-
-    @Override
-    protected void seekInternal(long pos) throws IOException {
-
-    }
-
-    @Override
-    public void close() throws IOException {
-      _indexInput.close();
-    }
-
-    @Override
-    public long length() {
-      return _length;
-    }
-
-    @Override
-    public ProgressableIndexInput clone() {
-      ProgressableIndexInput clone = (ProgressableIndexInput) super.clone();
-      clone._indexInput = (IndexInput) _indexInput.clone();
-      return clone;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8165b77/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/RateCounter.java
----------------------------------------------------------------------
diff --git a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/RateCounter.java b/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/RateCounter.java
deleted file mode 100644
index 777cb14..0000000
--- a/blur-mapred-hadoop1/src/main/java/org/apache/blur/mapreduce/lib/RateCounter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.apache.blur.mapreduce.lib;
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-import java.util.concurrent.TimeUnit;
-
-import org.apache.hadoop.mapreduce.Counter;
-
-/**
- * This turns a standard hadoop counter into a rate counter.
- */
-public class RateCounter {
-
-  private final Counter _counter;
-  private final long _reportTime;
-  private long _lastReport;
-  private long _count = 0;
-
-  public RateCounter(Counter counter) {
-    _counter = counter;
-    _lastReport = System.nanoTime();
-    _reportTime = TimeUnit.SECONDS.toNanos(5);
-  }
-
-  public void mark() {
-    mark(1l);
-  }
-
-  public void mark(long n) {
-    long now = System.nanoTime();
-    if (_lastReport + _reportTime < now) {
-      long seconds = TimeUnit.NANOSECONDS.toSeconds(now - _lastReport);
-      long rate = _count / seconds;
-      _counter.setValue(rate);
-      _lastReport = System.nanoTime();
-      _count = 0;
-    }
-    _count += n;
-  }
-
-  public void close() {
-    _counter.setValue(0);
-  }
-
-}


Mime
View raw message