FAQ
Author: kevinwilfong
Date: Fri Mar 29 01:29:50 2013
New Revision: 1462373

URL: http://svn.apache.org/r1462373
Log:
HIVE-4235. CREATE TABLE IF NOT EXISTS uses inefficient way to check if table exists. (Gang Tim Liu via kevinwilfong)

Modified:
     hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1462373&r1=1462372&r2=1462373&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Fri Mar 29 01:29:50 2013
@@ -9128,8 +9128,10 @@ public class SemanticAnalyzer extends Ba
      // check for existence of table
      if (ifNotExists) {
        try {
- List<String> tables = db.getTablesByPattern(tableName);
- if (tables != null && tables.size() > 0) { // table exists
+ Table table = db.getTable(tableName, false); // use getTable(final String tableName, boolean
+ // throwException) which doesn't throw
+ // exception but null if table doesn't exist
+ if (table != null) { // table exists
            return null;
          }
        } catch (HiveException e) {

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedMar 29, '13 at 1:30a
activeMar 29, '13 at 1:30a
posts1
users1
websitehive.apache.org

1 user in discussion

Kevinwilfong: 1 post

People

Translate

site design / logo © 2021 Grokbase