hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1529476 - in /hive/trunk/beeline/src/java/org/apache/hive/beeline: HiveSchemaHelper.java HiveSchemaTool.java
Date Sat, 05 Oct 2013 16:23:59 GMT
Author: hashutosh
Date: Sat Oct  5 16:23:59 2013
New Revision: 1529476

URL: http://svn.apache.org/r1529476
Log:
HIVE-5449 : Hive schematool info option incorrectly reports error for Postgres metastore (Prasad
Mujumdar via Ashutosh Chauhan)

Modified:
    hive/trunk/beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java
    hive/trunk/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java

Modified: hive/trunk/beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java
URL: http://svn.apache.org/viewvc/hive/trunk/beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java?rev=1529476&r1=1529475&r2=1529476&view=diff
==============================================================================
--- hive/trunk/beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java (original)
+++ hive/trunk/beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java Sat Oct  5 16:23:59
2013
@@ -73,6 +73,12 @@ public class HiveSchemaHelper {
      * @return
      */
     public String cleanseCommand(String dbCommand);
+
+    /***
+     * Does the DB required table/column names quoted
+     * @return
+     */
+    public boolean needsQuotedIdentifier();
   }
 
 
@@ -115,6 +121,11 @@ public class HiveSchemaHelper {
       }
       return dbCommand;
     }
+
+    @Override
+    public boolean needsQuotedIdentifier() {
+      return false;
+    }
   }
 
 
@@ -215,6 +226,11 @@ public class HiveSchemaHelper {
     public boolean isNestedScript(String dbCommand) {
       return dbCommand.startsWith(POSTGRES_NESTING_TOKEN);
     }
+
+    @Override
+    public boolean needsQuotedIdentifier() {
+      return true;
+    }
   }
 
   //Oracle specific parser

Modified: hive/trunk/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
URL: http://svn.apache.org/viewvc/hive/trunk/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java?rev=1529476&r1=1529475&r2=1529476&view=diff
==============================================================================
--- hive/trunk/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java (original)
+++ hive/trunk/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java Sat Oct  5 16:23:59
2013
@@ -116,7 +116,12 @@ public class HiveSchemaTool {
   // read schema version from metastore
   private String getMetaStoreSchemaVersion(Connection metastoreConn)
         throws HiveMetaException {
-    String versionQuery = "select t.SCHEMA_VERSION from VERSION t";
+    String versionQuery;
+    if (HiveSchemaHelper.getDbCommandParser(dbType).needsQuotedIdentifier()) {
+      versionQuery = "select t.\"SCHEMA_VERSION\" from \"VERSION\" t";
+    } else {
+      versionQuery = "select t.SCHEMA_VERSION from VERSION t";
+    }
     try {
       Statement stmt = metastoreConn.createStatement();
       ResultSet res = stmt.executeQuery(versionQuery);



Mime
View raw message