diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java index ef2ebac82c..04493fdc32 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java @@ -5253,7 +5253,9 @@ private QBParseInfo getQBParseInfo(QB qb) throws CalciteSemanticException { @Override protected Table getTableObjectByName(String tableName, boolean throwException) throws HiveException { - if (!tabNameToTabObject.containsKey(tableName)) { + String[] names = Utilities.getDbTableName(tableName); + final String fullyqName = names[0] + "." + names[1]; + if (!tabNameToTabObject.containsKey(fullyqName)) { // TODO: The code below should be a single HMS call and possibly unified with method in SemanticAnalyzer Table table = db.getTable(tableName, throwException); if (table != null) { @@ -5265,11 +5267,11 @@ protected Table getTableObjectByName(String tableName, boolean throwException) t table.getDbName(), table.getTableName())); table.setNotNullConstraint(db.getReliableNotNullConstraints( table.getDbName(), table.getTableName())); - tabNameToTabObject.put(tableName, table); + tabNameToTabObject.put(fullyqName, table); } return table; } - return tabNameToTabObject.get(tableName); + return tabNameToTabObject.get(fullyqName); } /** 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 281025ff67..f9c73e6e98 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 @@ -480,7 +480,7 @@ protected void reset(boolean clearCache) { } else { mergeIsDirect = false; } - tabNameToTabObject.clear(); + //tabNameToTabObject.clear(); loadTableWork.clear(); loadFileWork.clear(); columnStatsAutoGatherContexts.clear();