Repository: hive Updated Branches: refs/heads/master 5ced7bf92 -> 2811d0af7
HIVE-19686 schematool --createCatalog option fails when using Oracle as the RDBMS (Alan Gates, reviewed by Daniel Dai) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/2811d0af Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/2811d0af Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/2811d0af Branch: refs/heads/master Commit: 2811d0af76e5df62fd151edb4ac5e6ccebeb44cd Parents: 5ced7bf Author: Alan Gates <ga...@hortonworks.com> Authored: Tue May 29 11:36:33 2018 -0700 Committer: Alan Gates <ga...@hortonworks.com> Committed: Tue May 29 11:36:33 2018 -0700 ---------------------------------------------------------------------- .../java/org/apache/hive/beeline/HiveSchemaTool.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/2811d0af/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java ---------------------------------------------------------------------- diff --git a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java index 7aad265..4245fa3 100644 --- a/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java +++ b/beeline/src/java/org/apache/hive/beeline/HiveSchemaTool.java @@ -34,7 +34,6 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.conf.HiveConf.ConfVars; -import org.apache.hadoop.hive.metastore.DatabaseProduct; import org.apache.hadoop.hive.metastore.HiveMetaException; import org.apache.hadoop.hive.metastore.IMetaStoreSchemaInfo; import org.apache.hadoop.hive.metastore.MetaStoreSchemaInfoFactory; @@ -44,7 +43,6 @@ import org.apache.hadoop.hive.metastore.conf.MetastoreConf; import org.apache.hadoop.hive.metastore.tools.HiveSchemaHelper; import org.apache.hadoop.hive.metastore.tools.HiveSchemaHelper.MetaStoreConnectionInfo; import org.apache.hadoop.hive.metastore.tools.HiveSchemaHelper.NestedScriptParser; -import org.apache.hadoop.hive.metastore.tools.SQLGenerator; import org.apache.hadoop.hive.shims.ShimLoader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -916,12 +914,7 @@ public class HiveSchemaTool { return; } } - SQLGenerator sqlGenerator = new SQLGenerator( - DatabaseProduct.determineDatabaseProduct( - conn.getMetaData().getDatabaseProductName() - ), hiveConf); - String query = sqlGenerator.addForUpdateClause("select max(" + quoteIf("CTLG_ID") + ") " + - "from " + quoteIf("CTLGS")); + String query = "select max(" + quoteIf("CTLG_ID") + ") from " + quoteIf("CTLGS"); LOG.debug("Going to run " + query); ResultSet rs = stmt.executeQuery(query); if (!rs.next()) { @@ -937,14 +930,14 @@ public class HiveSchemaTool { conn.commit(); success = true; } - } catch (MetaException|SQLException e) { + } catch (SQLException e) { throw new HiveMetaException("Failed to add catalog", e); } finally { try { if (!success) conn.rollback(); } catch (SQLException e) { // Not really much we can do here. - LOG.error("Failed to rollback, everything will probably go bad from here."); + LOG.error("Failed to rollback, everything will probably go bad from here.", e); } } }