public class Warehouse extends Object
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
Warehouse(org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
static void |
closeFs(org.apache.hadoop.fs.FileSystem fs) |
boolean |
deleteDir(org.apache.hadoop.fs.Path f,
boolean recursive) |
boolean |
deleteDir(org.apache.hadoop.fs.Path f,
boolean recursive,
boolean ifPurge) |
org.apache.hadoop.fs.Path |
getDatabasePath(Database db) |
org.apache.hadoop.fs.Path |
getDefaultDatabasePath(String dbName) |
org.apache.hadoop.fs.Path |
getDnsPath(org.apache.hadoop.fs.Path path) |
static org.apache.hadoop.fs.Path |
getDnsPath(org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration conf)
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.FileStatus[] |
getFileStatusesForLocation(String location) |
org.apache.hadoop.fs.FileStatus[] |
getFileStatusesForSD(StorageDescriptor desc) |
org.apache.hadoop.fs.FileStatus[] |
getFileStatusesForUnpartitionedTable(Database db,
Table table) |
org.apache.hadoop.fs.FileSystem |
getFs(org.apache.hadoop.fs.Path f) |
static org.apache.hadoop.fs.FileSystem |
getFs(org.apache.hadoop.fs.Path f,
org.apache.hadoop.conf.Configuration conf)
Helper functions to convert IOException to MetaException
|
org.apache.hadoop.fs.Path |
getPartitionPath(Database db,
String tableName,
LinkedHashMap<String,String> pm) |
org.apache.hadoop.fs.Path |
getPartitionPath(org.apache.hadoop.fs.Path tblPath,
LinkedHashMap<String,String> pm) |
static List<String> |
getPartValuesFromPartName(String partName) |
static String |
getQualifiedName(Partition partition) |
static String |
getQualifiedName(Table table) |
org.apache.hadoop.fs.Path |
getTablePath(Database db,
String tableName) |
org.apache.hadoop.fs.Path |
getTablePath(String whRootString,
String tableName) |
org.apache.hadoop.fs.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(org.apache.hadoop.fs.Path f) |
boolean |
isEmpty(org.apache.hadoop.fs.Path path) |
boolean |
isWritable(org.apache.hadoop.fs.Path path) |
static String |
makeDynamicPartName(Map<String,String> spec)
Given a dynamic partition specification, return the path corresponding to the
static part of partition specification.
|
static Map<String,String> |
makeEscSpecFromName(String name) |
static String |
makePartName(List<FieldSchema> partCols,
List<String> vals) |
static String |
makePartName(List<FieldSchema> partCols,
List<String> vals,
String defaultStr)
Makes a valid partition name.
|
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) |
static Map<String,String> |
makeSpecFromValues(List<FieldSchema> partCols,
List<String> values) |
static AbstractList<String> |
makeValsFromName(String name,
AbstractList<String> result)
Extracts values from partition name without the column names.
|
boolean |
mkdirs(org.apache.hadoop.fs.Path f,
boolean inheritPermCandidate) |
boolean |
renameDir(org.apache.hadoop.fs.Path sourcePath,
org.apache.hadoop.fs.Path destPath) |
boolean |
renameDir(org.apache.hadoop.fs.Path sourcePath,
org.apache.hadoop.fs.Path destPath,
boolean inheritPerms) |
public Warehouse(org.apache.hadoop.conf.Configuration conf) throws MetaException
MetaException
public static org.apache.hadoop.fs.FileSystem getFs(org.apache.hadoop.fs.Path f, org.apache.hadoop.conf.Configuration conf) throws MetaException
MetaException
public org.apache.hadoop.fs.FileSystem getFs(org.apache.hadoop.fs.Path f) throws MetaException
MetaException
public static void closeFs(org.apache.hadoop.fs.FileSystem fs) throws MetaException
MetaException
public static org.apache.hadoop.fs.Path getDnsPath(org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf) throws MetaException
path
- Path to be canonicalizedMetaException
public org.apache.hadoop.fs.Path getDnsPath(org.apache.hadoop.fs.Path path) throws MetaException
MetaException
public org.apache.hadoop.fs.Path getWhRoot() throws MetaException
MetaException
public org.apache.hadoop.fs.Path getTablePath(String whRootString, String tableName) throws MetaException
MetaException
public org.apache.hadoop.fs.Path getDatabasePath(Database db) throws MetaException
MetaException
public org.apache.hadoop.fs.Path getDefaultDatabasePath(String dbName) throws MetaException
MetaException
public org.apache.hadoop.fs.Path getTablePath(Database db, String tableName) throws MetaException
MetaException
public boolean mkdirs(org.apache.hadoop.fs.Path f, boolean inheritPermCandidate) throws MetaException
MetaException
public boolean renameDir(org.apache.hadoop.fs.Path sourcePath, org.apache.hadoop.fs.Path destPath) throws MetaException
MetaException
public boolean renameDir(org.apache.hadoop.fs.Path sourcePath, org.apache.hadoop.fs.Path destPath, boolean inheritPerms) throws MetaException
MetaException
public boolean deleteDir(org.apache.hadoop.fs.Path f, boolean recursive) throws MetaException
MetaException
public boolean deleteDir(org.apache.hadoop.fs.Path f, boolean recursive, boolean ifPurge) throws MetaException
MetaException
public boolean isEmpty(org.apache.hadoop.fs.Path path) throws IOException, MetaException
IOException
MetaException
public boolean isWritable(org.apache.hadoop.fs.Path path) throws IOException
IOException
public static String makePartPath(Map<String,String> spec) throws MetaException
spec
- MetaException
public static String makePartName(Map<String,String> spec, boolean addTrailingSeperator) throws MetaException
spec
- addTrailingSeperator
- if true, adds a trailing separator e.g. 'ds=1/'MetaException
public static String makeDynamicPartName(Map<String,String> spec)
spec
- public static AbstractList<String> makeValsFromName(String name, AbstractList<String> result) throws MetaException
name
- Partition name.result
- The result. Must be pre-sized to the expected number of columns.MetaException
public static LinkedHashMap<String,String> makeSpecFromName(String name) throws MetaException
MetaException
public static void makeSpecFromName(Map<String,String> partSpec, org.apache.hadoop.fs.Path currPath)
public static Map<String,String> makeEscSpecFromName(String name) throws MetaException
MetaException
public org.apache.hadoop.fs.Path getPartitionPath(Database db, String tableName, LinkedHashMap<String,String> pm) throws MetaException
MetaException
public org.apache.hadoop.fs.Path getPartitionPath(org.apache.hadoop.fs.Path tblPath, LinkedHashMap<String,String> pm) throws MetaException
MetaException
public boolean isDir(org.apache.hadoop.fs.Path f) throws MetaException
MetaException
public static String makePartName(List<FieldSchema> partCols, List<String> vals) throws MetaException
MetaException
public org.apache.hadoop.fs.FileStatus[] getFileStatusesForSD(StorageDescriptor desc) throws MetaException
desc
- MetaException
public org.apache.hadoop.fs.FileStatus[] getFileStatusesForLocation(String location) throws MetaException
location
- MetaException
public org.apache.hadoop.fs.FileStatus[] getFileStatusesForUnpartitionedTable(Database db, Table table) throws MetaException
table
- MetaException
public static String makePartName(List<FieldSchema> partCols, List<String> vals, 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 List<String> getPartValuesFromPartName(String partName) throws MetaException
MetaException
Copyright © 2016 The Apache Software Foundation. All rights reserved.