public class HCatUtil extends Object
| Constructor and Description |
|---|
HCatUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertNotNull(Object t,
String msg,
org.slf4j.Logger logger) |
static boolean |
checkJobContextIfRunningFromBackend(org.apache.hadoop.mapreduce.JobContext j) |
static void |
closeHiveClientQuietly(IMetaStoreClient client) |
static void |
configureOutputStorageHandler(HiveStorageHandler storageHandler,
org.apache.hadoop.conf.Configuration conf,
OutputJobInfo outputJobInfo) |
static void |
copyConf(org.apache.hadoop.conf.Configuration src,
org.apache.hadoop.conf.Configuration dest)
Replace the contents of dest with the contents of src
|
static void |
copyJobPropertiesToJobConf(Map<String,String> jobProperties,
org.apache.hadoop.mapred.JobConf jobConf) |
static byte[] |
decodeBytes(String str) |
static Object |
deserialize(String str) |
static String |
encodeBytes(byte[] bytes) |
static HCatSchema |
extractSchema(Partition partition) |
static HCatSchema |
extractSchema(Table table) |
static org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier> |
extractThriftToken(String tokenStrForm,
String tokenSignature) |
static Pair<String,String> |
getDbAndTableName(String tableName) |
static List<org.apache.hadoop.hive.metastore.api.FieldSchema> |
getFieldSchemaList(List<HCatFieldSchema> hcatFields) |
static List<HCatFieldSchema> |
getHCatFieldSchemaList(org.apache.hadoop.hive.metastore.api.FieldSchema... fields) |
static List<HCatFieldSchema> |
getHCatFieldSchemaList(List<org.apache.hadoop.hive.metastore.api.FieldSchema> fields) |
static Map<String,String> |
getHCatKeyHiveConf(org.apache.hadoop.mapred.JobConf conf) |
static HiveMetaStoreClient |
getHiveClient(HiveConf hiveConf)
Deprecated.
|
static HiveConf |
getHiveConf(org.apache.hadoop.conf.Configuration conf) |
static IMetaStoreClient |
getHiveMetastoreClient(HiveConf hiveConf)
Get or create a hive client depending on whether it exits in cache or not
|
static Map<String,String> |
getInputJobProperties(HiveStorageHandler storageHandler,
InputJobInfo inputJobInfo) |
static org.apache.hadoop.mapred.JobConf |
getJobConfFromContext(org.apache.hadoop.mapreduce.JobContext jobContext) |
static org.apache.hadoop.security.token.Token<org.apache.hadoop.mapreduce.security.token.delegation.DelegationTokenIdentifier> |
getJobTrackerDelegationToken(org.apache.hadoop.conf.Configuration conf,
String userName) |
static HCatSchema |
getPartitionColumns(Table table)
return the partition columns from a table instance
|
static HiveStorageHandler |
getStorageHandler(org.apache.hadoop.conf.Configuration conf,
PartInfo partitionInfo) |
static HiveStorageHandler |
getStorageHandler(org.apache.hadoop.conf.Configuration conf,
StorerInfo storerInfo)
Create an instance of a storage handler defined in storerInfo.
|
static HiveStorageHandler |
getStorageHandler(org.apache.hadoop.conf.Configuration conf,
String storageHandler,
String serDe,
String inputFormat,
String outputFormat)
Create an instance of a storage handler.
|
static Table |
getTable(IMetaStoreClient client,
String dbName,
String tableName) |
static HCatSchema |
getTableSchemaWithPtnCols(Table table) |
static boolean |
isHadoop23() |
static String |
makePathASafeFileName(String filePath)
Used by various tests to make sure the path is safe for Windows
|
static String |
serialize(Serializable obj) |
static HiveConf |
storePropertiesToHiveConf(Properties properties,
HiveConf hiveConf) |
static boolean |
validateExecuteBitPresentIfReadOrWrite(org.apache.hadoop.fs.permission.FsAction perms)
Ensure that read or write permissions are not granted without also
granting execute permissions.
|
static boolean |
validateMorePermissive(org.apache.hadoop.fs.permission.FsAction first,
org.apache.hadoop.fs.permission.FsAction second)
Test if the first FsAction is more permissive than the second.
|
static List<org.apache.hadoop.hive.metastore.api.FieldSchema> |
validatePartitionSchema(Table table,
HCatSchema partitionSchema)
Validate partition schema, checks if the column types match between the
partition and the existing table schema.
|
public static boolean checkJobContextIfRunningFromBackend(org.apache.hadoop.mapreduce.JobContext j)
public static String serialize(Serializable obj) throws IOException
IOExceptionpublic static Object deserialize(String str) throws IOException
IOExceptionpublic static String encodeBytes(byte[] bytes)
public static byte[] decodeBytes(String str)
public static List<HCatFieldSchema> getHCatFieldSchemaList(org.apache.hadoop.hive.metastore.api.FieldSchema... fields) throws HCatException
HCatExceptionpublic static List<HCatFieldSchema> getHCatFieldSchemaList(List<org.apache.hadoop.hive.metastore.api.FieldSchema> fields) throws HCatException
HCatExceptionpublic static HCatSchema extractSchema(Table table) throws HCatException
HCatExceptionpublic static HCatSchema extractSchema(Partition partition) throws HCatException
HCatExceptionpublic static List<org.apache.hadoop.hive.metastore.api.FieldSchema> getFieldSchemaList(List<HCatFieldSchema> hcatFields)
public static Table getTable(IMetaStoreClient client, String dbName, String tableName) throws org.apache.hadoop.hive.metastore.api.NoSuchObjectException, org.apache.thrift.TException, org.apache.hadoop.hive.metastore.api.MetaException
org.apache.hadoop.hive.metastore.api.NoSuchObjectExceptionorg.apache.thrift.TExceptionorg.apache.hadoop.hive.metastore.api.MetaExceptionpublic static HCatSchema getTableSchemaWithPtnCols(Table table) throws IOException
IOExceptionpublic static HCatSchema getPartitionColumns(Table table) throws IOException
table - the instance to extract partition columns fromIOExceptionpublic static List<org.apache.hadoop.hive.metastore.api.FieldSchema> validatePartitionSchema(Table table, HCatSchema partitionSchema) throws IOException
table - the tablepartitionSchema - the partition schemaIOException - Signals that an I/O exception has occurred.public static boolean validateMorePermissive(org.apache.hadoop.fs.permission.FsAction first,
org.apache.hadoop.fs.permission.FsAction second)
public static boolean validateExecuteBitPresentIfReadOrWrite(org.apache.hadoop.fs.permission.FsAction perms)
perms - The FsAction to verifypublic static org.apache.hadoop.security.token.Token<org.apache.hadoop.mapreduce.security.token.delegation.DelegationTokenIdentifier> getJobTrackerDelegationToken(org.apache.hadoop.conf.Configuration conf,
String userName)
throws Exception
Exceptionpublic static org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier> extractThriftToken(String tokenStrForm, String tokenSignature) throws org.apache.hadoop.hive.metastore.api.MetaException, org.apache.thrift.TException, IOException
org.apache.hadoop.hive.metastore.api.MetaExceptionorg.apache.thrift.TExceptionIOExceptionpublic static HiveStorageHandler getStorageHandler(org.apache.hadoop.conf.Configuration conf, StorerInfo storerInfo) throws IOException
conf - job's configuration will be used to configure the Configurable StorageHandlerstorerInfo - StorerInfo to definining the StorageHandler and InputFormat, OutputFormat and SerDeIOExceptionpublic static HiveStorageHandler getStorageHandler(org.apache.hadoop.conf.Configuration conf, PartInfo partitionInfo) throws IOException
IOExceptionpublic static HiveStorageHandler getStorageHandler(org.apache.hadoop.conf.Configuration conf, String storageHandler, String serDe, String inputFormat, String outputFormat) throws IOException
conf - job's configuration will be used to configure the Configurable StorageHandlerstorageHandler - fully qualified class name of the desired StorageHandle instanceserDe - fully qualified class name of the desired SerDe instanceinputFormat - fully qualified class name of the desired InputFormat instanceoutputFormat - fully qualified class name of the desired outputFormat instanceIOExceptionpublic static Pair<String,String> getDbAndTableName(String tableName) throws IOException
IOExceptionpublic static Map<String,String> getInputJobProperties(HiveStorageHandler storageHandler, InputJobInfo inputJobInfo)
@InterfaceAudience.Private @InterfaceStability.Evolving public static void configureOutputStorageHandler(HiveStorageHandler storageHandler, org.apache.hadoop.conf.Configuration conf, OutputJobInfo outputJobInfo)
public static void copyConf(org.apache.hadoop.conf.Configuration src,
org.apache.hadoop.conf.Configuration dest)
src - dest - public static IMetaStoreClient getHiveMetastoreClient(HiveConf hiveConf) throws org.apache.hadoop.hive.metastore.api.MetaException, IOException
hiveConf - The hive configurationorg.apache.hadoop.hive.metastore.api.MetaException - When HiveMetaStoreClient couldn't be createdIOException@Deprecated public static HiveMetaStoreClient getHiveClient(HiveConf hiveConf) throws org.apache.hadoop.hive.metastore.api.MetaException, IOException
hiveConf - The hive configurationorg.apache.hadoop.hive.metastore.api.MetaException - When HiveMetaStoreClient couldn't be createdIOExceptionpublic static void closeHiveClientQuietly(IMetaStoreClient client)
public static HiveConf getHiveConf(org.apache.hadoop.conf.Configuration conf) throws IOException
IOExceptionpublic static HiveConf storePropertiesToHiveConf(Properties properties, HiveConf hiveConf) throws IOException
IOExceptionpublic static org.apache.hadoop.mapred.JobConf getJobConfFromContext(org.apache.hadoop.mapreduce.JobContext jobContext)
public static Map<String,String> getHCatKeyHiveConf(org.apache.hadoop.mapred.JobConf conf)
public static void copyJobPropertiesToJobConf(Map<String,String> jobProperties, org.apache.hadoop.mapred.JobConf jobConf)
public static boolean isHadoop23()
public static String makePathASafeFileName(String filePath)
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.