diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java index edb20ae7e6..d4dc6d67dd 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java @@ -847,13 +847,13 @@ private void doPhase1GetColumnAliasesFromSelect( if (isInsertInto(qbp, dest)) { ASTNode tblAst = qbp.getDestForClause(dest); String tableName = getUnescapedName((ASTNode) tblAst.getChild(0)); - Table targetTable = null; + Table targetTable; try { if (isValueClause(selectExpr)) { - targetTable = db.getTable(tableName, false); + targetTable = getTableObjectByName(tableName); replaceDefaultKeyword((ASTNode) selectExpr.getChild(0).getChild(0).getChild(1), targetTable, qbp.getDestSchemaForClause(dest)); } else if (updating(dest)) { - targetTable = db.getTable(tableName, false); + targetTable = getTableObjectByName(tableName); replaceDefaultKeywordForUpdate(selectExpr, targetTable); } } catch (Exception e) { @@ -1914,11 +1914,10 @@ private void handleInsertStatementSpecPhase1(ASTNode ast, QBParseInfo qbp, Phase throw new SemanticException(generateErrorMessage(tabColName, "Duplicate column name detected in " + fullTableName + " table schema specification")); } - Table targetTable = null; + Table targetTable; try { - targetTable = db.getTable(fullTableName, false); - } - catch (HiveException ex) { + targetTable = getTableObjectByName(fullTableName); + } catch (HiveException ex) { LOG.error("Error processing HiveParser.TOK_DESTINATION: " + ex.getMessage(), ex); throw new SemanticException(ex); }