org.apache.hadoop.hive.common
Class FileUtils

java.lang.Object
  extended by org.apache.hadoop.hive.common.FileUtils

public final class FileUtils
extends Object

Collection of file manipulation utilities common across Hive.


Method Summary
static String escapePathName(String path)
           
static String escapePathName(String path, String defaultPath)
          Escapes a path name.
static void listStatusRecursively(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.FileStatus fileStatus, List<org.apache.hadoop.fs.FileStatus> results)
          Recursively lists status for all files starting from a particular directory (or individual file as base case).
static String makeDefaultListBucketingDirName(List<String> skewedCols, org.apache.hadoop.conf.Configuration hconf)
          default directory will have the same depth as number of skewed columns this will make future operation easy like DML merge, concatenate merge
static String makePartName(List<String> partCols, List<String> vals)
           
static String makePartName(List<String> partCols, List<String> vals, String defaultStr)
          Makes a valid partition name.
static org.apache.hadoop.fs.Path makeQualified(org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf)
          Variant of Path.makeQualified that qualifies the input path against the default file system indicated by the configuration This does not require a FileSystem handle in most cases - only requires the Filesystem URI.
static String unescapePathName(String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

makeQualified

public static org.apache.hadoop.fs.Path makeQualified(org.apache.hadoop.fs.Path path,
                                                      org.apache.hadoop.conf.Configuration conf)
                                               throws IOException
Variant of Path.makeQualified that qualifies the input path against the default file system indicated by the configuration This does not require a FileSystem handle in most cases - only requires the Filesystem URI. This saves the cost of opening the Filesystem - which can involve RPCs - as well as cause errors

Parameters:
path - path to be fully qualified
conf - Configuration file
Returns:
path qualified relative to default file system
Throws:
IOException

makePartName

public static String makePartName(List<String> partCols,
                                  List<String> vals)

makePartName

public static String makePartName(List<String> partCols,
                                  List<String> vals,
                                  String defaultStr)
Makes a valid partition name.

Parameters:
partCols - The partition keys' names
vals - The partition values
defaultStr - The default name given to a partition value if the respective value is empty or null.
Returns:
An escaped, valid partition name.

escapePathName

public static String escapePathName(String path)

escapePathName

public static String escapePathName(String path,
                                    String defaultPath)
Escapes a path name.

Parameters:
path - The path to escape.
defaultPath - The default name for the path, if the given path is empty or null.
Returns:
An escaped path name.

unescapePathName

public static String unescapePathName(String path)

listStatusRecursively

public static void listStatusRecursively(org.apache.hadoop.fs.FileSystem fs,
                                         org.apache.hadoop.fs.FileStatus fileStatus,
                                         List<org.apache.hadoop.fs.FileStatus> results)
                                  throws IOException
Recursively lists status for all files starting from a particular directory (or individual file as base case).

Parameters:
fs - file system
fileStatus - starting point in file system
results - receives enumeration of all files found
Throws:
IOException

makeDefaultListBucketingDirName

public static String makeDefaultListBucketingDirName(List<String> skewedCols,
                                                     org.apache.hadoop.conf.Configuration hconf)
default directory will have the same depth as number of skewed columns this will make future operation easy like DML merge, concatenate merge

Parameters:
skewedCols -
hconf -
Returns:


Copyright © 2013 The Apache Software Foundation