use of org.apache.hadoop.hive.ql.metadata.InvalidTableException in project hive by apache.
the class SemanticAnalyzer method validateAnalyzeNoscan.
/**
* Validate noscan command
*
* @param tree
* @throws SemanticException
*/
private void validateAnalyzeNoscan(ASTNode tree) throws SemanticException {
// since it is noscan, it is true table name in command
String tableName = getUnescapedName((ASTNode) tree.getChild(0).getChild(0));
Table tbl;
try {
tbl = this.getTableObjectByName(tableName);
} catch (InvalidTableException e) {
throw new SemanticException(ErrorMsg.INVALID_TABLE.getMsg(tableName), e);
} catch (HiveException e) {
throw new SemanticException(e.getMessage(), e);
}
/* A nice error message should be given to user. */
if (tbl.isNonNative()) {
throw new SemanticException(ErrorMsg.ANALYZE_TABLE_NOSCAN_NON_NATIVE.getMsg(tbl.getTableName()));
}
}
use of org.apache.hadoop.hive.ql.metadata.InvalidTableException in project hive by apache.
the class UpdateDeleteSemanticAnalyzer method getTargetTable.
/**
* @return the Metastore representation of the target table
*/
private Table getTargetTable(ASTNode tabRef) throws SemanticException {
String[] tableName;
Table mTable;
switch(tabRef.getType()) {
case HiveParser.TOK_TABREF:
tableName = getQualifiedTableName((ASTNode) tabRef.getChild(0));
break;
case HiveParser.TOK_TABNAME:
tableName = getQualifiedTableName(tabRef);
break;
default:
throw raiseWrongType("TOK_TABREF|TOK_TABNAME", tabRef);
}
try {
mTable = db.getTable(tableName[0], tableName[1]);
} catch (InvalidTableException e) {
LOG.error("Failed to find table " + getDotName(tableName) + " got exception " + e.getMessage());
throw new SemanticException(ErrorMsg.INVALID_TABLE.getMsg(getDotName(tableName)), e);
} catch (HiveException e) {
LOG.error("Failed to find table " + getDotName(tableName) + " got exception " + e.getMessage());
throw new SemanticException(e.getMessage(), e);
}
return mTable;
}
Aggregations