public class Warehouse
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.apache.commons.logging.Log |
LOG |
Constructor and Description |
---|
Warehouse(Configuration conf) |
Modifier and Type | Method and Description |
---|---|
static void |
closeFs(FileSystem fs) |
boolean |
deleteDir(Path f,
boolean recursive) |
Path |
getDatabasePath(Database db) |
Path |
getDefaultDatabasePath(java.lang.String dbName) |
Path |
getDnsPath(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.
|
FileSystem |
getFs(Path f)
Helper functions to convert IOException to MetaException
|
Path |
getPartitionPath(Database db,
java.lang.String tableName,
java.util.LinkedHashMap<java.lang.String,java.lang.String> pm) |
Path |
getPartitionPath(Path tblPath,
java.util.LinkedHashMap<java.lang.String,java.lang.String> pm) |
static java.util.List<java.lang.String> |
getPartValuesFromPartName(java.lang.String partName) |
Path |
getTablePath(Database db,
java.lang.String tableName) |
Path |
getTablePath(java.lang.String whRootString,
java.lang.String tableName) |
Path |
getWhRoot()
Resolve the configured warehouse root dir with respect to the configuration
This involves opening the FileSystem corresponding to the warehouse root
dir (but that should be ok given that this is only called during DDL
statements for non-external tables).
|
boolean |
isDir(Path f) |
boolean |
isWritable(Path path) |
static java.lang.String |
makeDynamicPartName(java.util.Map<java.lang.String,java.lang.String> spec)
Given a dynamic partition specification, return the path corresponding to the
static part of partition specification.
|
static java.util.Map<java.lang.String,java.lang.String> |
makeEscSpecFromName(java.lang.String name) |
static java.lang.String |
makePartName(java.util.List<FieldSchema> partCols,
java.util.List<java.lang.String> vals) |
static java.lang.String |
makePartName(java.util.List<FieldSchema> partCols,
java.util.List<java.lang.String> vals,
java.lang.String defaultStr)
Makes a valid partition name.
|
static java.lang.String |
makePartName(java.util.Map<java.lang.String,java.lang.String> spec,
boolean addTrailingSeperator)
Makes a partition name from a specification
|
static java.lang.String |
makePartPath(java.util.Map<java.lang.String,java.lang.String> spec)
Given a partition specification, return the path corresponding to the
partition spec.
|
static void |
makeSpecFromName(java.util.Map<java.lang.String,java.lang.String> partSpec,
Path currPath) |
static java.util.LinkedHashMap<java.lang.String,java.lang.String> |
makeSpecFromName(java.lang.String name) |
boolean |
mkdirs(Path f) |
boolean |
renameDir(Path sourcePath,
Path destPath) |
public Warehouse(Configuration conf) throws MetaException
MetaException
public FileSystem getFs(Path f) throws MetaException
MetaException
public static void closeFs(FileSystem fs) throws MetaException
MetaException
public Path getDnsPath(Path path) throws MetaException
path
- Path to be canonicalizedMetaException
public Path getWhRoot() throws MetaException
MetaException
public Path getTablePath(java.lang.String whRootString, java.lang.String tableName) throws MetaException
MetaException
public Path getDatabasePath(Database db) throws MetaException
MetaException
public Path getDefaultDatabasePath(java.lang.String dbName) throws MetaException
MetaException
public Path getTablePath(Database db, java.lang.String tableName) throws MetaException
MetaException
public boolean mkdirs(Path f) throws MetaException
MetaException
public boolean renameDir(Path sourcePath, Path destPath) throws MetaException
MetaException
public boolean deleteDir(Path f, boolean recursive) throws MetaException
MetaException
public boolean isWritable(Path path) throws java.io.IOException
java.io.IOException
public static java.lang.String makePartPath(java.util.Map<java.lang.String,java.lang.String> spec) throws MetaException
spec
- MetaException
public static java.lang.String makePartName(java.util.Map<java.lang.String,java.lang.String> spec, boolean addTrailingSeperator) throws MetaException
spec
- addTrailingSeperator
- if true, adds a trailing separator e.g. 'ds=1/'MetaException
public static java.lang.String makeDynamicPartName(java.util.Map<java.lang.String,java.lang.String> spec)
spec
- public static java.util.LinkedHashMap<java.lang.String,java.lang.String> makeSpecFromName(java.lang.String name) throws MetaException
MetaException
public static void makeSpecFromName(java.util.Map<java.lang.String,java.lang.String> partSpec, Path currPath)
public static java.util.Map<java.lang.String,java.lang.String> makeEscSpecFromName(java.lang.String name) throws MetaException
MetaException
public Path getPartitionPath(Database db, java.lang.String tableName, java.util.LinkedHashMap<java.lang.String,java.lang.String> pm) throws MetaException
MetaException
public Path getPartitionPath(Path tblPath, java.util.LinkedHashMap<java.lang.String,java.lang.String> pm) throws MetaException
MetaException
public boolean isDir(Path f) throws MetaException
MetaException
public static java.lang.String makePartName(java.util.List<FieldSchema> partCols, java.util.List<java.lang.String> vals) throws MetaException
MetaException
public static java.lang.String makePartName(java.util.List<FieldSchema> partCols, java.util.List<java.lang.String> vals, java.lang.String defaultStr) throws MetaException
partCols
- The partition columnsvals
- The partition valuesdefaultStr
- The default name given to a partition value if the respective value is empty or null.MetaException
public static java.util.List<java.lang.String> getPartValuesFromPartName(java.lang.String partName) throws MetaException
MetaException
Copyright © 2012 The Apache Software Foundation