Package com.browseengine.bobo.mapred

Examples of com.browseengine.bobo.mapred.MapReduceResult


    return builder.build();
  }

  private MapReduceResult convertMapReduceResult(SenseiProtos.MapReduceResult protoMapReduceResult) {
    MapReduceResult mapReduceResult = new MapReduceResult();

    if (protoMapReduceResult.hasReduceResult()) {
      Object reduceResult = javaDeserialize(protoMapReduceResult.getReduceResult());

      if (reduceResult != null)
        mapReduceResult.setReduceResult((Serializable) reduceResult);
    }

    if (protoMapReduceResult.getMapResultCount() > 0) {
      List mapResults = new ArrayList();
      for (ByteString protoMapResult : protoMapReduceResult.getMapResultList()) {
        Object mapResult = javaDeserialize(protoMapResult);

        if (mapResult != null)
          mapResults.add(mapResult);
      }
      mapReduceResult.setMapResults(mapResults);
    }
    return mapReduceResult;
  }
View Full Code Here


  private int docIdIndex = 0;
  public SenseiMapFunctionWrapper(SenseiMapReduce mapReduceStrategy, Set<SenseiFacetInfo> facetInfos) {
    super();
    this.mapReduceStrategy = mapReduceStrategy;  
    partialDocIds = new int[BUFFER_SIZE];
    result = new MapReduceResult();
    this.facetInfos = facetInfos;
  }
View Full Code Here

   * @param mapReduceFunction
   * @param results
   * @return
   */
  public static MapReduceResult combine(SenseiMapReduce mapReduceFunction, List<MapReduceResult> results) {
    MapReduceResult ret = null;
    if (results.isEmpty()) {
      return null;
    }
    ret =  results.get(0);
    for (int i = 1; i < results.size(); i++) {
      ret.getMapResults().addAll(results.get(i).getMapResults());
    }
    ret.setMapResults(new ArrayList(mapReduceFunction.combine(ret.getMapResults(), CombinerStage.nodeLevel)));
    return ret;
  }
View Full Code Here

   * @param mapReduceFunction
   * @param results
   * @return
   */
  public static MapReduceResult reduce(SenseiMapReduce mapReduceFunction, List<MapReduceResult> results) {
    MapReduceResult ret = null;
    if (results.isEmpty()) {
      return ret;
    }
    ret =  results.get(0);
    for (int i = 1; i < results.size(); i++) {
      ret.getMapResults().addAll(results.get(i).getMapResults());
    }   
    ret.setReduceResult(mapReduceFunction.reduce(ret.getMapResults())) ;
    ret.setMapResults(null);
    return ret;
  }
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.mapred.MapReduceResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.