Package org.rosuda.REngine

Examples of org.rosuda.REngine.REXP


         
          fs.copyToLocalFile(srcDel, src, dst);

          String dataFilePath = dst.toString();
       
          REXP eval = getConnection().eval(
              String.format("load(file=\"%s\")", dataFilePath));

        } catch (Exception e) {
          throw new HiveException(e);
        }
View Full Code Here


      if (i < (arguments.length - 2))
        argument.append(",");
    }

    REXP rdata = null;
    try {
      rdata = getConnection().eval(function_name + "(" + argument.toString() + ")");
    } catch (Exception e) {
      ByteArrayOutputStream output = new ByteArrayOutputStream();
      e.printStackTrace(new PrintStream(output));
      throw new HiveException(new String(output.toByteArray())
          + " -- fail to eval : " + function_name + "("
          + argument.toString() + ")");
    }

    if (rdata != null) {
      try {
        if (rdata instanceof REXPInteger) {
          return new IntWritable(rdata.asInteger());
        } else if (rdata instanceof REXPString) {
          return new Text(rdata.asString());
        } else if (rdata instanceof REXPDouble) {
          return new DoubleWritable(rdata.asDouble());
        } else {
          throw new HiveException(
              "only support integer, string and double");
        }
      } catch (Exception e) {
View Full Code Here

  private void loadExportedRScript(String export_name) throws HiveException {
    if (!funcSet.contains(export_name)) {

      try {
        REXP rhive_data = getConnection().eval(
            "Sys.getenv('RHIVE_DATA')");
        String srhive_data = null;

        if (rhive_data != null) {
          srhive_data = rhive_data.asString();
        }

        if (srhive_data == null || srhive_data == ""
            || srhive_data.length() == 0) {
View Full Code Here

     * @param cmd
     * @return
     */
    @Override
    public RExpressionServer eval(String cmd) {
        REXP ret = null;
        try {
            ret = rConnection.eval(cmd);
        } catch (RserveException ex) {
            Logger.getLogger(RServerConnector.class.getName()).log(Level.SEVERE, null, ex);
        }
View Full Code Here

TOP

Related Classes of org.rosuda.REngine.REXP

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.