Repository: hive Updated Branches: refs/heads/branch-3 c7f713d57 -> 5d3dfc2af
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/5d3dfc2a Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/5d3dfc2a Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/5d3dfc2a Branch: refs/heads/branch-3 Commit: 5d3dfc2afc21c7e01be17fef027e23e120c1645a Parents: c7f713d 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:38:07 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/5d3dfc2a/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 a469cd4..856b0ac 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; @@ -909,12 +907,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()) { @@ -930,14 +923,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); } } }