org.apache.hadoop.hive.metastore
Class Warehouse

java.lang.Object
  extended by org.apache.hadoop.hive.metastore.Warehouse

public class Warehouse
extends Object

This class represents a warehouse where data of Hive tables is stored


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
Warehouse(org.apache.hadoop.conf.Configuration conf)
           
 
Method Summary
static void closeFs(org.apache.hadoop.fs.FileSystem fs)
           
 boolean deleteDir(org.apache.hadoop.fs.Path f, boolean recursive)
           
 org.apache.hadoop.fs.Path getDefaultDatabasePath(String dbName)
           
 org.apache.hadoop.fs.Path getDefaultTablePath(String dbName, String tableName)
           
 org.apache.hadoop.fs.Path getDnsPath(org.apache.hadoop.fs.Path path)
          Hadoop File System reverse lookups paths with raw ip addresses The File System URI always contains the canonical DNS name of the Namenode.
 org.apache.hadoop.fs.FileSystem getFs(org.apache.hadoop.fs.Path f)
          Helper functions to convert IOException to MetaException
 org.apache.hadoop.fs.Path getPartitionPath(org.apache.hadoop.fs.Path tblPath, LinkedHashMap<String,String> pm)
           
 org.apache.hadoop.fs.Path getPartitionPath(String dbName, String tableName, LinkedHashMap<String,String> pm)
           
static List<String> getPartValuesFromPartName(String partName)
           
 boolean isDir(org.apache.hadoop.fs.Path f)
           
static String makeDynamicPartName(Map<String,String> spec)
          Given a dynamic partition specification, return the path corresponding to the static part of partition specification.
static String makePartName(List<FieldSchema> partCols, List<String> vals)
           
static String makePartName(Map<String,String> spec, boolean addTrailingSeperator)
          Makes a partition name from a specification
static String makePartPath(Map<String,String> spec)
          Given a partition specification, return the path corresponding to the partition spec.
static void makeSpecFromName(Map<String,String> partSpec, org.apache.hadoop.fs.Path currPath)
           
static LinkedHashMap<String,String> makeSpecFromName(String name)
           
 boolean mkdirs(org.apache.hadoop.fs.Path f)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

Warehouse

public Warehouse(org.apache.hadoop.conf.Configuration conf)
          throws MetaException
Throws:
MetaException
Method Detail

getFs

public org.apache.hadoop.fs.FileSystem getFs(org.apache.hadoop.fs.Path f)
                                      throws MetaException
Helper functions to convert IOException to MetaException

Throws:
MetaException

closeFs

public static void closeFs(org.apache.hadoop.fs.FileSystem fs)
                    throws MetaException
Throws:
MetaException

getDnsPath

public org.apache.hadoop.fs.Path getDnsPath(org.apache.hadoop.fs.Path path)
                                     throws MetaException
Hadoop File System reverse lookups paths with raw ip addresses The File System URI always contains the canonical DNS name of the Namenode. Subsequently, operations on paths with raw ip addresses cause an exception since they don't match the file system URI. This routine solves this problem by replacing the scheme and authority of a path with the scheme and authority of the FileSystem that it maps to.

Parameters:
path - Path to be canonicalized
Returns:
Path with canonical scheme and authority
Throws:
MetaException

getDefaultDatabasePath

public org.apache.hadoop.fs.Path getDefaultDatabasePath(String dbName)
                                                 throws MetaException
Throws:
MetaException

getDefaultTablePath

public org.apache.hadoop.fs.Path getDefaultTablePath(String dbName,
                                                     String tableName)
                                              throws MetaException
Throws:
MetaException

mkdirs

public boolean mkdirs(org.apache.hadoop.fs.Path f)
               throws MetaException
Throws:
MetaException

deleteDir

public boolean deleteDir(org.apache.hadoop.fs.Path f,
                         boolean recursive)
                  throws MetaException
Throws:
MetaException

makePartPath

public static String makePartPath(Map<String,String> spec)
                           throws MetaException
Given a partition specification, return the path corresponding to the partition spec. By default, the specification does not include dynamic partitions.

Parameters:
spec -
Returns:
string representation of the partition specification.
Throws:
MetaException

makePartName

public static String makePartName(Map<String,String> spec,
                                  boolean addTrailingSeperator)
                           throws MetaException
Makes a partition name from a specification

Parameters:
spec -
addTrailingSeperator - if true, adds a trailing separator e.g. 'ds=1/'
Returns:
Throws:
MetaException

makeDynamicPartName

public static String makeDynamicPartName(Map<String,String> spec)
Given a dynamic partition specification, return the path corresponding to the static part of partition specification. This is basically a copy of makePartName but we get rid of MetaException since it is not serializable.

Parameters:
spec -
Returns:
string representation of the static part of the partition specification.

makeSpecFromName

public static LinkedHashMap<String,String> makeSpecFromName(String name)
                                                     throws MetaException
Throws:
MetaException

makeSpecFromName

public static void makeSpecFromName(Map<String,String> partSpec,
                                    org.apache.hadoop.fs.Path currPath)

getPartitionPath

public org.apache.hadoop.fs.Path getPartitionPath(String dbName,
                                                  String tableName,
                                                  LinkedHashMap<String,String> pm)
                                           throws MetaException
Throws:
MetaException

getPartitionPath

public org.apache.hadoop.fs.Path getPartitionPath(org.apache.hadoop.fs.Path tblPath,
                                                  LinkedHashMap<String,String> pm)
                                           throws MetaException
Throws:
MetaException

isDir

public boolean isDir(org.apache.hadoop.fs.Path f)
              throws MetaException
Throws:
MetaException

makePartName

public static String makePartName(List<FieldSchema> partCols,
                                  List<String> vals)
                           throws MetaException
Throws:
MetaException

getPartValuesFromPartName

public static List<String> getPartValuesFromPartName(String partName)
                                              throws MetaException
Throws:
MetaException


Copyright © 2011 The Apache Software Foundation