public class Warehouse extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DATABASE_WAREHOUSE_SUFFIX |
static String |
DEFAULT_CATALOG_COMMENT |
static String |
DEFAULT_CATALOG_NAME |
static String |
DEFAULT_DATABASE_COMMENT |
static String |
DEFAULT_DATABASE_NAME |
static String |
DEFAULT_SERIALIZATION_FORMAT |
static org.slf4j.Logger |
LOG |
| Constructor and Description |
|---|
Warehouse(org.apache.hadoop.conf.Configuration conf) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
copyDir(org.apache.hadoop.fs.Path sourcePath,
org.apache.hadoop.fs.Path destPath,
boolean needCmRecycle) |
boolean |
deleteDir(org.apache.hadoop.fs.Path f,
boolean recursive,
boolean ifPurge,
boolean needCmRecycle) |
boolean |
deleteDir(org.apache.hadoop.fs.Path f,
boolean recursive,
boolean ifPurge,
Database db) |
boolean |
deleteDir(org.apache.hadoop.fs.Path f,
boolean recursive,
Database db) |
org.apache.hadoop.fs.Path |
determineDatabasePath(Catalog cat,
Database db)
Build the database path based on catalog name and database name.
|
static String |
escapePathName(String path) |
static String |
getCatalogQualifiedTableName(Table table)
Get table name in cat.db.table format.
|
org.apache.hadoop.fs.Path |
getDatabaseExternalPath(Database db)
Get the external tables path specified by the database.
|
org.apache.hadoop.fs.Path |
getDatabaseManagedPath(Database db)
Get the managed tables path specified by the database.
|
org.apache.hadoop.fs.Path |
getDatabasePath(Database db)
Get the managed tables path specified by the database.
|
org.apache.hadoop.fs.Path |
getDefaultDatabasePath(String dbName) |
org.apache.hadoop.fs.Path |
getDefaultDatabasePath(String dbName,
boolean inExternalWH) |
org.apache.hadoop.fs.Path |
getDefaultExternalDatabasePath(String dbName) |
org.apache.hadoop.fs.Path |
getDefaultManagedTablePath(Database db,
String tableName) |
org.apache.hadoop.fs.Path |
getDefaultPartitionPath(Database db,
Table table,
Map<String,String> pm)
Returns the default partition path of a table within a given database and partition key value
pairs.
|
org.apache.hadoop.fs.Path |
getDefaultTablePath(Database db,
String tableName)
Deprecated.
|
org.apache.hadoop.fs.Path |
getDefaultTablePath(Database db,
String tableName,
boolean isExternal) |
org.apache.hadoop.fs.Path |
getDefaultTablePath(Database db,
Table table) |
org.apache.hadoop.fs.Path |
getDefaultTablePath(String dbName,
String tableName,
boolean isExternal) |
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.
|
List<org.apache.hadoop.fs.FileStatus> |
getFileStatusesForLocation(String location) |
List<org.apache.hadoop.fs.FileStatus> |
getFileStatusesForSD(StorageDescriptor desc) |
List<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,
Table table,
List<String> vals)
Given a database, a table and the partition key value pairs this method returns the Path object
corresponding to the partition key value pairs.
|
org.apache.hadoop.fs.Path |
getPartitionPath(org.apache.hadoop.fs.Path tblPath,
Map<String,String> pm)
Returns the path object for the given partition key-value pairs and the base location
|
static List<String> |
getPartValuesFromPartName(String partName) |
static String |
getQualifiedName(Partition partition) |
static String |
getQualifiedName(String dbName,
String tableName)
Deprecated.
|
static String |
getQualifiedName(Table table)
Deprecated.
|
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).
|
org.apache.hadoop.fs.Path |
getWhRootExternal() |
boolean |
isDir(org.apache.hadoop.fs.Path f) |
boolean |
isEmptyDir(org.apache.hadoop.fs.Path path) |
boolean |
isEmptyDir(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.PathFilter pathFilter) |
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 String |
makeDynamicPartNameNoTrailingSeperator(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 |
makePartNameUtil(Map<String,String> spec,
boolean addTrailingSeperator,
boolean dynamic)
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 boolean |
makeSpecFromName(Map<String,String> partSpec,
org.apache.hadoop.fs.Path currPath,
Set<String> requiredKeys) |
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) |
void |
recycleDirToCmPath(org.apache.hadoop.fs.Path f,
boolean ifPurge) |
boolean |
renameDir(org.apache.hadoop.fs.Path sourcePath,
org.apache.hadoop.fs.Path destPath,
boolean needCmRecycle) |
public static final String DEFAULT_CATALOG_NAME
public static final String DEFAULT_CATALOG_COMMENT
public static final String DEFAULT_DATABASE_NAME
public static final String DEFAULT_DATABASE_COMMENT
public static final String DEFAULT_SERIALIZATION_FORMAT
public static final String DATABASE_WAREHOUSE_SUFFIX
public static final org.slf4j.Logger LOG
public Warehouse(org.apache.hadoop.conf.Configuration conf)
throws MetaException
MetaExceptionpublic static org.apache.hadoop.fs.FileSystem getFs(org.apache.hadoop.fs.Path f,
org.apache.hadoop.conf.Configuration conf)
throws MetaException
MetaExceptionpublic org.apache.hadoop.fs.FileSystem getFs(org.apache.hadoop.fs.Path f)
throws MetaException
MetaExceptionpublic 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 canonicalizedMetaExceptionpublic org.apache.hadoop.fs.Path getDnsPath(org.apache.hadoop.fs.Path path)
throws MetaException
MetaExceptionpublic org.apache.hadoop.fs.Path getWhRoot()
throws MetaException
MetaExceptionpublic org.apache.hadoop.fs.Path getWhRootExternal()
throws MetaException
MetaExceptionpublic org.apache.hadoop.fs.Path determineDatabasePath(Catalog cat, Database db) throws MetaException
getDatabasePath(Database). If the passed in
database already has a path set that will be used. If not the location will be built using
catalog's path and the database name.cat - catalog the database is indb - database objectMetaException - when the file path cannot be properly determined from the configured
file system.public org.apache.hadoop.fs.Path getDatabasePath(Database db) throws MetaException
db - database to get the path ofMetaException - when the file path cannot be properly determined from the configured
file system.public org.apache.hadoop.fs.Path getDatabaseExternalPath(Database db) throws MetaException
db - database to get the path ofMetaException - when the file path cannot be properly determined from the configured
file system.public org.apache.hadoop.fs.Path getDatabaseManagedPath(Database db) throws MetaException
db - database to get the path ofMetaException - when the file path cannot be properly determined from the configured
file system.public org.apache.hadoop.fs.Path getDefaultDatabasePath(String dbName) throws MetaException
MetaExceptionpublic org.apache.hadoop.fs.Path getDefaultExternalDatabasePath(String dbName) throws MetaException
MetaExceptionpublic org.apache.hadoop.fs.Path getDefaultDatabasePath(String dbName, boolean inExternalWH) throws MetaException
MetaException@Deprecated public org.apache.hadoop.fs.Path getDefaultTablePath(Database db, String tableName) throws MetaException
db - Database where the table is createdtableName - table nameMetaExceptionpublic org.apache.hadoop.fs.Path getDefaultTablePath(Database db, String tableName, boolean isExternal) throws MetaException
MetaExceptionpublic org.apache.hadoop.fs.Path getDefaultManagedTablePath(Database db, String tableName) throws MetaException
MetaExceptionpublic org.apache.hadoop.fs.Path getDefaultTablePath(String dbName, String tableName, boolean isExternal) throws MetaException
MetaExceptionpublic org.apache.hadoop.fs.Path getDefaultTablePath(Database db, Table table) throws MetaException
MetaException@Deprecated public static String getQualifiedName(Table table)
@Deprecated public static String getQualifiedName(String dbName, String tableName)
public static String getCatalogQualifiedTableName(Table table)
table - table objectpublic boolean mkdirs(org.apache.hadoop.fs.Path f)
throws MetaException
MetaExceptionpublic boolean renameDir(org.apache.hadoop.fs.Path sourcePath,
org.apache.hadoop.fs.Path destPath,
boolean needCmRecycle)
throws MetaException
MetaExceptionpublic boolean copyDir(org.apache.hadoop.fs.Path sourcePath,
org.apache.hadoop.fs.Path destPath,
boolean needCmRecycle)
throws MetaException
MetaExceptionpublic boolean deleteDir(org.apache.hadoop.fs.Path f,
boolean recursive,
Database db)
throws MetaException
MetaExceptionpublic boolean deleteDir(org.apache.hadoop.fs.Path f,
boolean recursive,
boolean ifPurge,
Database db)
throws MetaException
MetaExceptionpublic boolean deleteDir(org.apache.hadoop.fs.Path f,
boolean recursive,
boolean ifPurge,
boolean needCmRecycle)
throws MetaException
MetaExceptionpublic void recycleDirToCmPath(org.apache.hadoop.fs.Path f,
boolean ifPurge)
throws MetaException
MetaExceptionpublic boolean isEmptyDir(org.apache.hadoop.fs.Path path)
throws IOException,
MetaException
IOExceptionMetaExceptionpublic boolean isEmptyDir(org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.PathFilter pathFilter)
throws IOException,
MetaException
IOExceptionMetaExceptionpublic boolean isWritable(org.apache.hadoop.fs.Path path)
throws IOException
IOExceptionpublic static String makePartPath(Map<String,String> spec) throws MetaException
spec - MetaExceptionpublic static String makePartNameUtil(Map<String,String> spec, boolean addTrailingSeperator, boolean dynamic) throws MetaException
spec - The partition specification, key and value pairs.addTrailingSeperator - If true, adds a trailing separator e.g. 'ds=1/'.dynamic - If true, create a dynamic partition name.MetaExceptionpublic static String makePartName(Map<String,String> spec, boolean addTrailingSeperator) throws MetaException
spec - addTrailingSeperator - if true, adds a trailing separator e.g. 'ds=1/'MetaExceptionpublic static String makeDynamicPartName(Map<String,String> spec)
spec - public static String makeDynamicPartNameNoTrailingSeperator(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.MetaExceptionpublic static LinkedHashMap<String,String> makeSpecFromName(String name) throws MetaException
MetaExceptionpublic static boolean makeSpecFromName(Map<String,String> partSpec, org.apache.hadoop.fs.Path currPath, Set<String> requiredKeys)
public static Map<String,String> makeEscSpecFromName(String name) throws MetaException
MetaExceptionpublic org.apache.hadoop.fs.Path getDefaultPartitionPath(Database db, Table table, Map<String,String> pm) throws MetaException
db - - parent database which is used to get the base location of the partition directorytable - - table for the partitionspm - - Partition key value pairsMetaExceptionpublic org.apache.hadoop.fs.Path getPartitionPath(org.apache.hadoop.fs.Path tblPath,
Map<String,String> pm)
throws MetaException
tblPath - - the base location for the partitions. Typically the table locationpm - - Partition key value pairsMetaExceptionpublic org.apache.hadoop.fs.Path getPartitionPath(Database db, Table table, List<String> vals) throws MetaException
db - - Parent database of the given tabletable - - Table for which the partition key-values are givenvals - - List of values for the partition keysMetaExceptionpublic boolean isDir(org.apache.hadoop.fs.Path f)
throws MetaException
MetaExceptionpublic static String makePartName(List<FieldSchema> partCols, List<String> vals) throws MetaException
MetaExceptionpublic List<org.apache.hadoop.fs.FileStatus> getFileStatusesForSD(StorageDescriptor desc) throws MetaException
desc - MetaExceptionpublic List<org.apache.hadoop.fs.FileStatus> getFileStatusesForLocation(String location) throws MetaException
location - MetaExceptionpublic List<org.apache.hadoop.fs.FileStatus> getFileStatusesForUnpartitionedTable(Database db, Table table) throws MetaException
db - databasetable - tableMetaExceptionpublic 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.MetaExceptionpublic static List<String> getPartValuesFromPartName(String partName) throws MetaException
MetaExceptionCopyright © 2024 The Apache Software Foundation. All rights reserved.