本文整理汇总了Java中org.apache.hadoop.hive.ql.metadata.Table.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getProperty方法的具体用法?Java Table.getProperty怎么用?Java Table.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hive.ql.metadata.Table
的用法示例。
在下文中一共展示了Table.getProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setIndexAndTypeIfNotPresent
import org.apache.hadoop.hive.ql.metadata.Table; //导入方法依赖的package包/类
private void setIndexAndTypeIfNotPresent(AbstractQueryContext context, ASTNode rootQueryNode) throws LensException {
final ASTNode dbSchemaTable = HQLParser.findNodeByPath(
rootQueryNode,
HiveParser.TOK_FROM,
HiveParser.TOK_TABREF,
HiveParser.TOK_TABNAME);
try {
Validate.notNull(dbSchemaTable);
if (dbSchemaTable.getChildren().size() == 2) {
/**
* Index and type is already set here
*/
return;
}
/**
* Get the table name, check metastore and set index and actual table name
*/
final Tree firstChild = dbSchemaTable.getChild(0);
final String lensTable = firstChild.getText();
final Table tbl = CubeMetastoreClient.getInstance(context.getHiveConf()).getHiveTable(lensTable);
final String index = tbl.getProperty(LensConfConstants.ES_INDEX_NAME);
final String type = tbl.getProperty(LensConfConstants.ES_TYPE_NAME);
Validate.notNull(index, LensConfConstants.ES_INDEX_NAME + " property missing in table definition");
Validate.notNull(type, LensConfConstants.ES_TYPE_NAME + " property missing in table definition");
((ASTNode) firstChild).getToken().setText(type);
final ASTNode indexIdentifier = new ASTNode(new CommonToken(HiveParser.Identifier, index));
indexIdentifier.setParent(dbSchemaTable);
dbSchemaTable.insertChild(0, indexIdentifier);
} catch (HiveException e) {
throw new LensException("Error occured when trying to communicate with metastore");
}
}
示例2: NativeTableInfo
import org.apache.hadoop.hive.ql.metadata.Table; //导入方法依赖的package包/类
NativeTableInfo(Table tbl) {
String columnMappingProp = tbl.getProperty(LensConfConstants.NATIVE_TABLE_COLUMN_MAPPING);
if (StringUtils.isNotBlank(columnMappingProp)) {
String[] columnMapArray = StringUtils.split(columnMappingProp, ",");
for (String columnMapEntry : columnMapArray) {
String[] mapEntry = StringUtils.split(columnMapEntry, "=");
columnMapping.put(mapEntry[0].trim(), mapEntry[1].trim());
}
}
}
示例3: isLensQueryableTable
import org.apache.hadoop.hive.ql.metadata.Table; //导入方法依赖的package包/类
public boolean isLensQueryableTable(String tableName) {
try {
Table table = getTable(tableName);
String typeProperty = table.getProperty(MetastoreConstants.TABLE_TYPE_KEY);
if (StringUtils.isBlank(typeProperty)) {
return false;
}
CubeTableType type = CubeTableType.valueOf(typeProperty);
return type == CubeTableType.CUBE || type == CubeTableType.DIMENSION;
} catch (LensException e) {
return false;
}
}
示例4: getUnderlyingDBName
import org.apache.hadoop.hive.ql.metadata.Table; //导入方法依赖的package包/类
/**
* Gets the underlying db name.
*
* @param tbl the table
* @return the underlying db name
* @throws HiveException the hive exception
*/
String getUnderlyingDBName(Table tbl) throws HiveException {
return tbl == null ? null : tbl.getProperty(LensConfConstants.NATIVE_DB_NAME);
}
示例5: getUnderlyingTableName
import org.apache.hadoop.hive.ql.metadata.Table; //导入方法依赖的package包/类
/**
* Gets the underlying table name.
*
* @param tbl the table
* @return the underlying table name
* @throws HiveException the hive exception
*/
String getUnderlyingTableName(Table tbl) throws HiveException {
return tbl == null ? null : tbl.getProperty(LensConfConstants.NATIVE_TABLE_NAME);
}