FAQ
Author: thejas
Date: Tue Oct 8 23:44:40 2013
New Revision: 1530466

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

Modified:
     hive/branches/branch-0.12/beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java
     hive/branches/branch-0.12/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java

Modified: hive/branches/branch-0.12/beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.12/beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java?rev=1530466&r1=1530465&r2=1530466&view=diff
==============================================================================
--- hive/branches/branch-0.12/beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java (original)
+++ hive/branches/branch-0.12/beeline/src/java/org/apache/hive/beeline/HiveSchemaHelper.java Tue Oct 8 23:44:40 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/branches/branch-0.12/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.12/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java?rev=1530466&r1=1530465&r2=1530466&view=diff
==============================================================================
--- hive/branches/branch-0.12/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java (original)
+++ hive/branches/branch-0.12/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java Tue Oct 8 23:44:40 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);

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedOct 8, '13 at 11:45p
activeOct 8, '13 at 11:45p
posts1
users1
websitehive.apache.org

1 user in discussion

Thejas: 1 post

People

Translate

site design / logo © 2021 Grokbase