public class HiveUtilities
extends java.lang.Object
| Constructor and Description |
|---|
HiveUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static Metadata.Item |
extractTableFromName(java.lang.String qualifiedName)
Extracts the db_name and table_name from the qualifiedName.
|
static java.util.List<Metadata.Item> |
extractTablesFromPattern(org.apache.hadoop.hive.metastore.HiveMetaStoreClient client,
java.lang.String pattern)
Extracts the db_name(s) and table_name(s) corresponding to the given pattern.
|
static org.apache.hadoop.hive.metastore.api.Table |
getHiveTable(org.apache.hadoop.hive.metastore.HiveMetaStoreClient client,
Metadata.Item itemName) |
static org.apache.hadoop.hive.metastore.HiveMetaStoreClient |
initHiveClient()
Initializes the HiveMetaStoreClient
Uses classpath configuration files to locate the MetaStore
|
static Metadata.Field |
mapHiveType(org.apache.hadoop.hive.metastore.api.FieldSchema hiveColumn)
Checks if hive type is supported, and if so
return its matching HAWQ type.
|
public static org.apache.hadoop.hive.metastore.HiveMetaStoreClient initHiveClient()
public static org.apache.hadoop.hive.metastore.api.Table getHiveTable(org.apache.hadoop.hive.metastore.HiveMetaStoreClient client,
Metadata.Item itemName)
throws java.lang.Exception
java.lang.Exceptionpublic static Metadata.Field mapHiveType(org.apache.hadoop.hive.metastore.api.FieldSchema hiveColumn) throws UnsupportedTypeException
tinyint -> int2smallint -> int2int -> int4bigint -> int8boolean -> boolfloat -> float4double -> float8string -> textbinary -> byteatimestamp -> timestampdate -> datedecimal(precision, scale) -> numeric(precision, scale)varchar(size) -> varchar(size)char(size) -> bpchar(size)hiveColumn - hive column schemaUnsupportedTypeException - if the column type is not supportedpublic static Metadata.Item extractTableFromName(java.lang.String qualifiedName)
table_name or db_name.table_name.qualifiedName - Hive table nameMetadata.Item object holding the full table namepublic static java.util.List<Metadata.Item> extractTablesFromPattern(org.apache.hadoop.hive.metastore.HiveMetaStoreClient client, java.lang.String pattern)
table_name_pattern or db_name_pattern.table_name_pattern.client - Hivemetastore clientpattern - Hive table name or patternMetadata.Item objects holding the full table name