public class HDFSTool extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DFS_BLOCKSIZE |
static String |
DFS_PERMISSIONS_ENABLED |
static String |
DFS_REPLICATION |
static String |
FS_DEFAULTFS |
static String |
IO_FILE_BUFFER_SIZE |
static String |
IO_SERIALIZATIONS |
static boolean |
USE_BINARYBLOCK_SERIALIZATION |
Constructor and Description |
---|
HDFSTool() |
Modifier and Type | Method and Description |
---|---|
static void |
addBinaryBlockSerializationFramework(org.apache.hadoop.conf.Configuration job) |
static void |
copyFileOnHDFS(String originalDir,
String newDir) |
static void |
createDirIfNotExistOnHDFS(org.apache.hadoop.fs.Path path,
String permissions) |
static void |
createDirIfNotExistOnHDFS(String dir,
String permissions) |
static void |
deleteFileIfExistOnHDFS(org.apache.hadoop.fs.Path outpath,
org.apache.hadoop.mapred.JobConf job) |
static void |
deleteFileIfExistOnHDFS(String dir) |
static void |
deleteFileIfExistOnLFS(org.apache.hadoop.fs.Path outpath,
org.apache.hadoop.mapred.JobConf job) |
static void |
deleteFileWithMTDIfExistOnHDFS(String fname) |
static long |
estimateNnzBasedOnFileSize(org.apache.hadoop.fs.Path path,
long rlen,
long clen,
int blen,
double factor) |
static boolean |
existsFileOnHDFS(String fname) |
static org.apache.hadoop.fs.FileStatus[] |
getDirectoryListing(String fname) |
static long |
getFilesizeOnHDFS(org.apache.hadoop.fs.Path path)
Returns the size of a file or directory on hdfs in bytes.
|
static org.apache.hadoop.fs.FSDataOutputStream |
getHDFSDataOutputStream(String filename,
boolean overwrite) |
static boolean |
isDirectory(String fname) |
static boolean |
isFileEmpty(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir) |
static boolean |
isHDFSFileEmpty(String dir) |
static void |
mergeIntoSingleFile(String originalDir,
String newFile) |
static String |
metaDataToString(Types.ValueType vt,
Types.ValueType[] schema,
Types.DataType dt,
DataCharacteristics dc,
Types.FileFormat fmt,
FileFormatProperties formatProperties,
PrivacyConstraint privacyConstraint) |
static boolean |
readBooleanFromHDFSFile(String filename) |
static double[] |
readColumnVectorFromHDFS(String dir,
Types.FileFormat fmt,
long rlen,
long clen,
int blen) |
static double |
readDoubleFromHDFSFile(String filename) |
static long |
readIntegerFromHDFSFile(String filename) |
static double[][] |
readMatrixFromHDFS(String dir,
Types.FileFormat fmt,
long rlen,
long clen,
int blen) |
static Object |
readObjectFromHDFSFile(String filename,
Types.ValueType vt) |
static String |
readStringFromHDFSFile(String filename) |
static void |
renameFileOnHDFS(String originalDir,
String newDir) |
static void |
writeBooleanToHDFS(boolean b,
String filename) |
static void |
writeDoubleToHDFS(double d,
String filename) |
static void |
writeIntToHDFS(long i,
String filename) |
static void |
writeMetaDataFile(String mtdfile,
Types.ValueType vt,
DataCharacteristics mc,
Types.FileFormat fmt) |
static void |
writeMetaDataFile(String mtdfile,
Types.ValueType vt,
DataCharacteristics dc,
Types.FileFormat fmt,
FileFormatProperties formatProperties) |
static void |
writeMetaDataFile(String mtdfile,
Types.ValueType vt,
DataCharacteristics dc,
Types.FileFormat fmt,
FileFormatProperties formatProperties,
PrivacyConstraint privacyConstraint) |
static void |
writeMetaDataFile(String mtdfile,
Types.ValueType vt,
DataCharacteristics mc,
Types.FileFormat fmt,
PrivacyConstraint privacyConstraint) |
static void |
writeMetaDataFile(String mtdfile,
Types.ValueType vt,
Types.ValueType[] schema,
Types.DataType dt,
DataCharacteristics mc,
Types.FileFormat fmt) |
static void |
writeMetaDataFile(String mtdfile,
Types.ValueType vt,
Types.ValueType[] schema,
Types.DataType dt,
DataCharacteristics dc,
Types.FileFormat fmt,
FileFormatProperties formatProperties) |
static void |
writeMetaDataFile(String mtdfile,
Types.ValueType vt,
Types.ValueType[] schema,
Types.DataType dt,
DataCharacteristics dc,
Types.FileFormat fmt,
FileFormatProperties formatProperties,
PrivacyConstraint privacyConstraint) |
static void |
writeMetaDataFile(String mtdfile,
Types.ValueType vt,
Types.ValueType[] schema,
Types.DataType dt,
DataCharacteristics mc,
Types.FileFormat fmt,
PrivacyConstraint privacyConstraint) |
static void |
writeObjectToHDFS(Object obj,
String filename) |
static void |
writeScalarMetaDataFile(String mtdfile,
Types.ValueType vt) |
static void |
writeScalarMetaDataFile(String mtdfile,
Types.ValueType vt,
PrivacyConstraint privacyConstraint) |
static void |
writeStringToHDFS(String s,
String filename) |
public static final String DFS_REPLICATION
public static final String IO_FILE_BUFFER_SIZE
public static final String IO_SERIALIZATIONS
public static final String DFS_BLOCKSIZE
public static final String DFS_PERMISSIONS_ENABLED
public static final String FS_DEFAULTFS
public static final boolean USE_BINARYBLOCK_SERIALIZATION
public static void addBinaryBlockSerializationFramework(org.apache.hadoop.conf.Configuration job)
public static boolean existsFileOnHDFS(String fname)
public static boolean isDirectory(String fname)
public static org.apache.hadoop.fs.FileStatus[] getDirectoryListing(String fname)
public static void deleteFileWithMTDIfExistOnHDFS(String fname) throws IOException
IOException
public static void deleteFileIfExistOnHDFS(String dir) throws IOException
IOException
public static void deleteFileIfExistOnHDFS(org.apache.hadoop.fs.Path outpath, org.apache.hadoop.mapred.JobConf job) throws IOException
IOException
public static void deleteFileIfExistOnLFS(org.apache.hadoop.fs.Path outpath, org.apache.hadoop.mapred.JobConf job) throws IOException
IOException
public static boolean isHDFSFileEmpty(String dir) throws IOException
IOException
public static boolean isFileEmpty(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir) throws IOException
IOException
public static void renameFileOnHDFS(String originalDir, String newDir) throws IOException
IOException
public static void mergeIntoSingleFile(String originalDir, String newFile) throws IOException
IOException
public static void copyFileOnHDFS(String originalDir, String newDir) throws IOException
IOException
public static long estimateNnzBasedOnFileSize(org.apache.hadoop.fs.Path path, long rlen, long clen, int blen, double factor) throws IOException
IOException
public static long getFilesizeOnHDFS(org.apache.hadoop.fs.Path path) throws IOException
path
- file system pathIOException
- if IOException occurspublic static double readDoubleFromHDFSFile(String filename) throws IOException
IOException
public static long readIntegerFromHDFSFile(String filename) throws IOException
IOException
public static boolean readBooleanFromHDFSFile(String filename) throws IOException
IOException
public static String readStringFromHDFSFile(String filename) throws IOException
IOException
public static Object readObjectFromHDFSFile(String filename, Types.ValueType vt) throws IOException
IOException
public static void writeDoubleToHDFS(double d, String filename) throws IOException
IOException
public static void writeIntToHDFS(long i, String filename) throws IOException
IOException
public static void writeBooleanToHDFS(boolean b, String filename) throws IOException
IOException
public static void writeStringToHDFS(String s, String filename) throws IOException
IOException
public static void writeObjectToHDFS(Object obj, String filename) throws IOException
IOException
public static void writeMetaDataFile(String mtdfile, Types.ValueType vt, DataCharacteristics mc, Types.FileFormat fmt) throws IOException
IOException
public static void writeMetaDataFile(String mtdfile, Types.ValueType vt, DataCharacteristics mc, Types.FileFormat fmt, PrivacyConstraint privacyConstraint) throws IOException
IOException
public static void writeMetaDataFile(String mtdfile, Types.ValueType vt, Types.ValueType[] schema, Types.DataType dt, DataCharacteristics mc, Types.FileFormat fmt) throws IOException
IOException
public static void writeMetaDataFile(String mtdfile, Types.ValueType vt, Types.ValueType[] schema, Types.DataType dt, DataCharacteristics mc, Types.FileFormat fmt, PrivacyConstraint privacyConstraint) throws IOException
IOException
public static void writeMetaDataFile(String mtdfile, Types.ValueType vt, DataCharacteristics dc, Types.FileFormat fmt, FileFormatProperties formatProperties) throws IOException
IOException
public static void writeMetaDataFile(String mtdfile, Types.ValueType vt, DataCharacteristics dc, Types.FileFormat fmt, FileFormatProperties formatProperties, PrivacyConstraint privacyConstraint) throws IOException
IOException
public static void writeMetaDataFile(String mtdfile, Types.ValueType vt, Types.ValueType[] schema, Types.DataType dt, DataCharacteristics dc, Types.FileFormat fmt, FileFormatProperties formatProperties) throws IOException
IOException
public static void writeMetaDataFile(String mtdfile, Types.ValueType vt, Types.ValueType[] schema, Types.DataType dt, DataCharacteristics dc, Types.FileFormat fmt, FileFormatProperties formatProperties, PrivacyConstraint privacyConstraint) throws IOException
IOException
public static void writeScalarMetaDataFile(String mtdfile, Types.ValueType vt) throws IOException
IOException
public static void writeScalarMetaDataFile(String mtdfile, Types.ValueType vt, PrivacyConstraint privacyConstraint) throws IOException
IOException
public static String metaDataToString(Types.ValueType vt, Types.ValueType[] schema, Types.DataType dt, DataCharacteristics dc, Types.FileFormat fmt, FileFormatProperties formatProperties, PrivacyConstraint privacyConstraint) throws org.apache.wink.json4j.JSONException, DMLRuntimeException
org.apache.wink.json4j.JSONException
DMLRuntimeException
public static double[][] readMatrixFromHDFS(String dir, Types.FileFormat fmt, long rlen, long clen, int blen) throws IOException, DMLRuntimeException
IOException
DMLRuntimeException
public static double[] readColumnVectorFromHDFS(String dir, Types.FileFormat fmt, long rlen, long clen, int blen) throws IOException, DMLRuntimeException
IOException
DMLRuntimeException
public static void createDirIfNotExistOnHDFS(String dir, String permissions) throws IOException
IOException
public static void createDirIfNotExistOnHDFS(org.apache.hadoop.fs.Path path, String permissions) throws IOException
IOException
public static org.apache.hadoop.fs.FSDataOutputStream getHDFSDataOutputStream(String filename, boolean overwrite) throws IOException
IOException
Copyright © 2020 The Apache Software Foundation. All rights reserved.