diff --git itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java index 7a0cd0e..e2d9b42 100644 --- itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java +++ itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java @@ -40,6 +40,8 @@ import junit.framework.TestCase; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.conf.HiveConf; @@ -48,6 +50,7 @@ * */ public class TestJdbcDriver extends TestCase { + private static final Log LOG = LogFactory.getLog(TestJdbcDriver.class); private static final String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver"; private static final String tableName = "testHiveJdbcDriver_Table"; private static final String tableComment = "Simple table"; @@ -1165,6 +1168,14 @@ public void testShowGrant() throws SQLException { public void testShowRoleGrant() throws SQLException { Statement stmt = con.createStatement(); + + // drop role. ignore error. + try { + stmt.execute("drop role role1"); + } catch (Exception ex) { + LOG.warn("Ignoring error during drop role: " + ex); + } + stmt.execute("create role role1"); stmt.execute("grant role role1 to user hive_test_user"); stmt.execute("show role grant user hive_test_user"); diff --git itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java index 653c554..7db1f41 100644 --- itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java +++ itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java @@ -46,6 +46,8 @@ import java.util.Set; import java.util.regex.Pattern; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.TableType; @@ -70,6 +72,7 @@ * */ public class TestJdbcDriver2 { + private static final Log LOG = LogFactory.getLog(TestJdbcDriver2.class); private static final String driverName = "org.apache.hive.jdbc.HiveDriver"; private static final String tableName = "testHiveJdbcDriver_Table"; private static final String tableComment = "Simple table"; @@ -1997,6 +2000,14 @@ public void testShowGrant() throws SQLException { @Test public void testShowRoleGrant() throws SQLException { Statement stmt = con.createStatement(); + + // drop role. ignore error. + try { + stmt.execute("drop role role1"); + } catch (Exception ex) { + LOG.warn("Ignoring error during drop role: " + ex); + } + stmt.execute("create role role1"); stmt.execute("grant role role1 to user hive_test_user"); stmt.execute("show role grant user hive_test_user");