Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.Path.makeQualified()


      outputFile = new Path(path + "/chukwaTestFile.evt");
    } else {
      outputFile = new Path("chukwaTestFile.evt");
    }

    outputFile = outputFile.makeQualified(fs);
    if (fs.exists(outputFile)) {
      System.out.println("File already there, exit -1," + outputFile );
      System.exit(-1);
    }
    System.out.println("outputFile:" + outputFile);
View Full Code Here


  private static Path getTempPathOnHDFS(String fileName) throws IOException {
    Configuration conf = HBASE_TEST_UTILITY.getConfiguration();
    FileSystem fs = FileSystem.get(conf);
    Path result = new Path(TEMP_DIR, fileName);
    return result.makeQualified(fs);
  }

  private static long getWordCountFromTable(HTable table, String word) throws IOException {
    Get get = new Get(Bytes.toBytes(word));
    KeyValue keyValue = table.get(get).getColumnLatest(TEST_FAMILY, TEST_QUALIFIER);
View Full Code Here

    try {
      fs.close();
    } catch (IOException e) {
    }
    String file = path.makeQualified(fs).toString();
    // For compatibility with hadoop 0.17, change file:/a/b/c to file:///a/b/c
    if (StringUtils.startsWith(file, "file:/") && !StringUtils.startsWith(file, "file:///")) {
      file = "file:///" + file.substring("file:/".length());
    }
    return file;
View Full Code Here

        pr.setTableName(partition.getTable().getTableName());
        result.getPartitionsNotOnFs().add(pr);
      }

      for (int i = 0; i < partition.getSpec().size(); i++) {
        partPaths.add(partPath.makeQualified(fs));
        partPath = partPath.getParent();
      }
    }

    if (findUnknownPartitions) {
View Full Code Here

    try {
      fs.close();
    } catch(IOException e){};

    return (path.makeQualified(fs).toString());
  }

  public static List<String> mergeUniqElems(List<String> src, List<String> dest) {
    if (dest == null) return src;
    if (src == null) return dest;
View Full Code Here

        pr.setTableName(partition.getTable().getName());
        result.getPartitionsNotOnFs().add(pr);
      }

      for (int i = 0; i < partition.getSpec().size(); i++) {
        partPaths.add(partPath.makeQualified(fs));
        partPath = partPath.getParent();
      }
    }

    if(findUnknownPartitions) {
View Full Code Here

    if (!fs.exists(path)) {
      return null;
    }

    String file = path.makeQualified(fs).toString();
    // For compatibility with hadoop 0.17, change file:/a/b/c to file:///a/b/c
    if (StringUtils.startsWith(file, "file:/") && !StringUtils.startsWith(file, "file:///")) {
      file = "file:///" + file.substring("file:/".length());
    }
    return file;
View Full Code Here

  private Path getTaskOutputPath(JobConf conf) {
    Path p = new Path(conf.getOutputPath(), ("_" + taskId));
    try {
      FileSystem fs = p.getFileSystem(conf);
      return p.makeQualified(fs);
    } catch (IOException ie) {
      LOG.warn(StringUtils.stringifyException(ie));
      return p;
    }
  }
View Full Code Here

        //default to the local file system
        //check if the file exists or not first
        if (!localFs.exists(path)) {
          throw new FileNotFoundException("File " + tmp + " does not exist.");
        }
        finalPath = path.makeQualified(localFs).toString();
      }
      else {
        // check if the file exists in this file system
        // we need to recreate this filesystem object to copy
        // these files to the file system jobtracker is running
View Full Code Here

        // on.
        FileSystem fs = path.getFileSystem(conf);
        if (!fs.exists(path)) {
          throw new FileNotFoundException("File " + tmp + " does not exist.");
        }
        finalPath = path.makeQualified(fs).toString();
        try {
          fs.close();
        } catch(IOException e){};
      }
      finalArr[i] = finalPath;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.