コード例 #1
0
  @Override
  public void writeEmptyMatrixToHDFS(String fname, long rlen, long clen, int brlen, int bclen)
      throws IOException, DMLRuntimeException {
    Path path = new Path(fname);
    FileSystem fs = FileSystem.get(ConfigurationManager.getCachedJobConf());

    FSDataOutputStream writer = fs.create(path);
    writer.writeBytes("1 1 0");
    writer.close();
  }
コード例 #2
0
  @Override
  public void writeMatrixToHDFS(
      MatrixBlock src, String fname, long rlen, long clen, int brlen, int bclen, long nnz)
      throws IOException, DMLRuntimeException, DMLUnsupportedOperationException {
    // prepare file access
    JobConf job = new JobConf(ConfigurationManager.getCachedJobConf());
    Path path = new Path(fname);

    // if the file already exists on HDFS, remove it.
    MapReduceTool.deleteFileIfExistOnHDFS(fname);

    // core write
    writeTextCellMatrixToHDFS(path, job, src, rlen, clen);
  }