Package com.senseidb.search.req.mapred

Examples of com.senseidb.search.req.mapred.SenseiMapReduce


      senseiRequest.setSelectList(senseiProtoRequest.getSelectListList());
    }

    if (senseiProtoRequest.hasMapReduce()) {

      SenseiMapReduce mapReduceFunction = convertMapReduce(senseiProtoRequest.getMapReduce());
      if (mapReduceFunction != null) {
        senseiRequest.setMapReduceFunction(mapReduceFunction);
        List<String> columns = senseiProtoRequest.getMapReduceColumnsList();
        JSONUtil.FastJSONObject jsonObject = new JSONUtil.FastJSONObject();
        try {
          jsonObject.put("column", columns.get(0));
          jsonObject.put("columns", columns.toArray(new String[]{}));
        } catch (JSONException e) {
          throw new IllegalStateException(e);
        }
        senseiRequest.getMapReduceFunction().init(jsonObject);
      } else {
        ByteString mapReduceBytes = senseiProtoRequest.getMapReduceBytes();

        Object object = null;
        try {
          ObjectInputStream ois = new ObjectInputStream(mapReduceBytes.newInput());
          object = ois.readObject();
        } catch (IOException ioException) {
          // Shouldn't happen.
          logger.error("IO Exception deserializing map reduce, ignoring mapreduce", ioException);
        } catch (ClassNotFoundException cnfe) {
          logger.error("Could not find class to deserialize to, ignoring mapreduce", cnfe);
        }

        if (object != null) {
          SenseiMapReduce mapReduce = (SenseiMapReduce) object;
          senseiRequest.setMapReduceFunction(mapReduce);
        }
      }
    }
View Full Code Here


      }
      //map reduce
      JSONObject mapReduceJson =  json.optJSONObject(RequestConverter2.MAP_REDUCE);
      if (mapReduceJson != null) {
        String key = mapReduceJson.getString(MAP_REDUCE_FUNCTION);
        SenseiMapReduce senseiMapReduce = MapReduceRegistry.get(key);
        senseiMapReduce.init(mapReduceJson.optJSONObject(MAP_REDUCE_PARAMETERS));
        req.setMapReduceFunction(senseiMapReduce);
      }
     // facets
      JSONObject facets = json.optJSONObject(RequestConverter2.FACETS);
      if (facets!=null){
View Full Code Here

TOP

Related Classes of com.senseidb.search.req.mapred.SenseiMapReduce

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.