hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbalamo...@apache.org
Subject hive git commit: HIVE-15300: Reuse table information in SemanticAnalyzer::getMetaData to reduce compilation time (Rajesh Balamohan, reviewed by Ashutosh Chauhan)
Date Thu, 25 May 2017 16:00:50 GMT
Repository: hive
Updated Branches:
  refs/heads/master 696be9f52 -> b18577426


HIVE-15300: Reuse table information in SemanticAnalyzer::getMetaData to reduce compilation
time (Rajesh Balamohan, reviewed by Ashutosh Chauhan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/b1857742
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/b1857742
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/b1857742

Branch: refs/heads/master
Commit: b18577426d93d9b73ad8f50dfcf428681765b57e
Parents: 696be9f
Author: Rajesh Balamohan <rbalamohan@apache.org>
Authored: Thu May 25 21:30:43 2017 +0530
Committer: Rajesh Balamohan <rbalamohan@apache.org>
Committed: Thu May 25 21:30:43 2017 +0530

----------------------------------------------------------------------
 .../hadoop/hive/ql/parse/SemanticAnalyzer.java   | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/b1857742/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
----------------------------------------------------------------------
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 f2b0bd0..7f5051c 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
@@ -1988,7 +1988,12 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
       String tabName = qb.getTabNameForAlias(alias);
       String cteName = tabName.toLowerCase();
 
-      Table tab = db.getTable(tabName, false);
+      // Get table details from tabNameToTabObject cache
+      Table tab = getTableObjectByName(tabName, false);
+      if (tab != null) {
+        // do a deep copy, in case downstream changes it.
+        tab = new Table(tab.getTTable().deepCopy());
+      }
       if (tab == null ||
               tab.getDbName().equals(SessionState.get().getCurrentDatabase())) {
         Table materializedTab = ctx.getMaterializedTable(cteName);
@@ -10924,16 +10929,22 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
     }
   }
 
-  private Table getTableObjectByName(String tableName) throws HiveException {
+  private Table getTableObjectByName(String tableName, boolean throwException) throws HiveException
{
     if (!tabNameToTabObject.containsKey(tableName)) {
-      Table table = db.getTable(tableName);
-      tabNameToTabObject.put(tableName, table);
+      Table table = db.getTable(tableName, throwException);
+      if (table != null) {
+        tabNameToTabObject.put(tableName, table);
+      }
       return table;
     } else {
       return tabNameToTabObject.get(tableName);
     }
   }
 
+  private Table getTableObjectByName(String tableName) throws HiveException {
+    return getTableObjectByName(tableName, true);
+  }
+
   private void walkASTMarkTABREF(ASTNode ast, Set<String> cteAlias)
       throws SemanticException {
     Queue<Node> queue = new LinkedList<>();


Mime
View raw message