|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hive.metastore.MetaStoreUtils
public class MetaStoreUtils
Field Summary | |
---|---|
static String |
DATABASE_WAREHOUSE_SUFFIX
|
static String |
DEFAULT_DATABASE_COMMENT
|
static String |
DEFAULT_DATABASE_NAME
|
protected static org.apache.commons.logging.Log |
LOG
|
Constructor Summary | |
---|---|
MetaStoreUtils()
|
Method Summary | ||
---|---|---|
static boolean |
compareFieldColumns(List<FieldSchema> schema1,
List<FieldSchema> schema2)
|
|
static Table |
createColumnsetSchema(String name,
List<String> columns,
List<String> partCols,
Configuration conf)
|
|
static void |
deleteWHDirectory(Path path,
Configuration conf,
boolean use_trash)
|
|
static int |
findFreePort()
Finds a free port on the machine. |
|
static Class<?> |
getClass(String rawStoreClassName)
|
|
static String |
getColumnNamesFromFieldSchema(List<FieldSchema> fieldSchemas)
Convert FieldSchemas to columnNames. |
|
static String |
getColumnTypesFromFieldSchema(List<FieldSchema> fieldSchemas)
Convert FieldSchemas to columnTypes. |
|
static String |
getDDLFromFieldSchema(String structName,
List<FieldSchema> fieldSchemas)
Convert FieldSchemas to Thrift DDL. |
|
static Deserializer |
getDeserializer(Configuration conf,
Partition part,
Table table)
getDeserializer Get the Deserializer for a partition. |
|
static Deserializer |
getDeserializer(Configuration conf,
Properties schema)
getDeserializer Get the Deserializer for a table given its name and properties. |
|
static Deserializer |
getDeserializer(Configuration conf,
Table table)
getDeserializer Get the Deserializer for a table. |
|
static FieldSchema |
getFieldSchemaFromTypeInfo(String fieldName,
TypeInfo typeInfo)
Convert TypeInfo to FieldSchema. |
|
static List<FieldSchema> |
getFieldsFromDeserializer(String tableName,
Deserializer deserializer)
|
|
static String |
getFullDDLFromFieldSchema(String structName,
List<FieldSchema> fieldSchemas)
Convert FieldSchemas to Thrift DDL + column names and column types |
|
static String |
getIndexTableName(String dbName,
String baseTblName,
String indexName)
|
|
static String |
getListType(String t)
|
|
static String |
getMapType(String k,
String v)
|
|
static Map<String,String> |
getMetaStoreSaslProperties(HiveConf conf)
Read and return the meta store Sasl configuration. |
|
static Path |
getOriginalLocation(Partition part)
|
|
static Properties |
getPartitionMetadata(Partition partition,
Table table)
|
|
static Properties |
getPartSchemaFromTableSchema(StorageDescriptor sd,
StorageDescriptor tblsd,
Map<String,String> parameters,
String databaseName,
String tableName,
List<FieldSchema> partitionKeys,
Properties tblSchema)
Get partition level schema from table level schema. |
|
static List<String> |
getPvals(List<FieldSchema> partCols,
Map<String,String> partSpec)
Given a list of partition columns and a partial mapping from some partition columns to values the function returns the values for the column. |
|
static Properties |
getSchema(Partition part,
Table table)
|
|
static Properties |
getSchema(StorageDescriptor sd,
StorageDescriptor tblsd,
Map<String,String> parameters,
String databaseName,
String tableName,
List<FieldSchema> partitionKeys)
|
|
static Properties |
getTableMetadata(Table table)
|
|
static boolean |
isArchived(Partition part)
|
|
static boolean |
isExternalTable(Table table)
Determines whether a table is an external table. |
|
static boolean |
isIndexTable(Table table)
|
|
static boolean |
isNonNativeTable(Table table)
|
|
static void |
makeDir(Path path,
HiveConf hiveConf)
|
|
static String |
makeFilterStringFromMap(Map<String,String> m)
Given a map of partition column names to values, this creates a filter string that can be used to call the *byFilter methods |
|
static
|
newInstance(Class<T> theClass,
Class<?>[] parameterTypes,
Object[] initargs)
Create an object of the given class. |
|
static boolean |
partitionNameHasValidCharacters(List<String> partVals,
Pattern partitionValidationPattern)
|
|
static void |
printStackTrace(Exception e)
printStackTrace Helper function to print an exception stack trace to the log and not stderr |
|
static boolean |
pvalMatches(List<String> partial,
List<String> full)
Returns true if partial has the same values as full for all values that aren't empty in partial. |
|
static void |
recursiveDelete(File f)
recursiveDelete just recursively deletes a dir - you'd think Java would have something to do this?? |
|
static void |
setSerdeParam(SerDeInfo sdi,
Properties schema,
String param)
|
|
static void |
startMetaStore(int port,
HadoopThriftAuthBridge bridge)
|
|
static String |
typeToThriftType(String type)
Convert type to ThriftType. |
|
static boolean |
validateColumnType(String type)
validate column type if it is predefined, yes. |
|
static boolean |
validateName(String name)
validateName Checks the name conforms to our standars which are: "[a-zA-z_0-9]+". |
|
static void |
validatePartitionNameCharacters(List<String> partVals,
Pattern partitionValidationPattern)
|
|
static String |
validateSkewedColNames(List<String> cols)
|
|
static String |
validateSkewedColNamesSubsetCol(List<String> skewedColNames,
List<FieldSchema> cols)
|
|
static String |
validateTblColumns(List<FieldSchema> cols)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log LOG
public static final String DEFAULT_DATABASE_NAME
public static final String DEFAULT_DATABASE_COMMENT
public static final String DATABASE_WAREHOUSE_SUFFIX
Constructor Detail |
---|
public MetaStoreUtils()
Method Detail |
---|
public static void printStackTrace(Exception e)
e
- the exceptionpublic static Table createColumnsetSchema(String name, List<String> columns, List<String> partCols, Configuration conf) throws MetaException
MetaException
public static void recursiveDelete(File f) throws IOException
f
- - the file/dir to delete
IOException
- propogate f.delete() exceptionspublic static Deserializer getDeserializer(Configuration conf, Properties schema) throws MetaException
conf
- hadoop configschema
- the properties to use to instantiate the deserializer
MetaException
- if any problems instantiating the Deserializer
todo - this should move somewhere into serde.jarpublic static Deserializer getDeserializer(Configuration conf, Table table) throws MetaException
conf
- - hadoop configtable
- the table
MetaException
- if any problems instantiating the Deserializer
todo - this should move somewhere into serde.jarpublic static Deserializer getDeserializer(Configuration conf, Partition part, Table table) throws MetaException
conf
- - hadoop configpart
- the partitiontable
- the table
MetaException
- if any problems instantiating the Deserializerpublic static void deleteWHDirectory(Path path, Configuration conf, boolean use_trash) throws MetaException
MetaException
public static List<String> getPvals(List<FieldSchema> partCols, Map<String,String> partSpec)
partCols
- the list of table partition columnspartSpec
- the partial mapping from partition column to values
public static boolean validateName(String name)
name
- the name to validate
MetaException
- if it doesn't match the pattern.public static String validateTblColumns(List<FieldSchema> cols)
public static boolean validateColumnType(String type)
name
-
public static String validateSkewedColNames(List<String> cols)
public static String validateSkewedColNamesSubsetCol(List<String> skewedColNames, List<FieldSchema> cols)
public static String getListType(String t)
public static String getMapType(String k, String v)
public static void setSerdeParam(SerDeInfo sdi, Properties schema, String param)
public static String typeToThriftType(String type)
public static String getFullDDLFromFieldSchema(String structName, List<FieldSchema> fieldSchemas)
structName
- The name of the tablefieldSchemas
- List of fields along with their schemas
public static String getDDLFromFieldSchema(String structName, List<FieldSchema> fieldSchemas)
public static Properties getTableMetadata(Table table)
public static Properties getPartitionMetadata(Partition partition, Table table)
public static Properties getSchema(Partition part, Table table)
public static Properties getPartSchemaFromTableSchema(StorageDescriptor sd, StorageDescriptor tblsd, Map<String,String> parameters, String databaseName, String tableName, List<FieldSchema> partitionKeys, Properties tblSchema)
sd
- The Partition level Storage Descriptor.tblsd
- The Table level Storage Descriptor.parameters
- partition level parametersdatabaseName
- DB nametableName
- table namepartitionKeys
- partition columnstblSchema
- The table level schema from which this partition should be copied.
public static Properties getSchema(StorageDescriptor sd, StorageDescriptor tblsd, Map<String,String> parameters, String databaseName, String tableName, List<FieldSchema> partitionKeys)
public static String getColumnNamesFromFieldSchema(List<FieldSchema> fieldSchemas)
public static String getColumnTypesFromFieldSchema(List<FieldSchema> fieldSchemas)
public static void makeDir(Path path, HiveConf hiveConf) throws MetaException
MetaException
public static void startMetaStore(int port, HadoopThriftAuthBridge bridge) throws Exception
Exception
public static int findFreePort() throws IOException
IOException
public static List<FieldSchema> getFieldsFromDeserializer(String tableName, Deserializer deserializer) throws SerDeException, MetaException
tableName
- deserializer
-
SerDeException
MetaException
public static FieldSchema getFieldSchemaFromTypeInfo(String fieldName, TypeInfo typeInfo)
public static boolean isExternalTable(Table table)
table
- table of interest
public static boolean isArchived(Partition part)
public static Path getOriginalLocation(Partition part)
public static boolean isNonNativeTable(Table table)
public static boolean pvalMatches(List<String> partial, List<String> full)
public static String getIndexTableName(String dbName, String baseTblName, String indexName)
public static boolean isIndexTable(Table table)
public static String makeFilterStringFromMap(Map<String,String> m)
m
-
public static Class<?> getClass(String rawStoreClassName) throws MetaException
MetaException
public static <T> T newInstance(Class<T> theClass, Class<?>[] parameterTypes, Object[] initargs)
theClass
- parameterTypes
- an array of parameterTypes for the constructorinitargs
- the list of arguments for the constructorpublic static void validatePartitionNameCharacters(List<String> partVals, Pattern partitionValidationPattern) throws MetaException
MetaException
public static boolean partitionNameHasValidCharacters(List<String> partVals, Pattern partitionValidationPattern)
public static boolean compareFieldColumns(List<FieldSchema> schema1, List<FieldSchema> schema2)
schema1:
- The first schema to be comparedschema2:
- The second schema to be compared
public static Map<String,String> getMetaStoreSaslProperties(HiveConf conf)
conf
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |