client.createDatabase(db); } catch (MetaException cantCreateDB) { createFailed = true;
@Test public void testTimeout() throws Exception { HiveMetaStore.TEST_TIMEOUT_VALUE = 2 * 1000; String dbName = "db"; client.dropDatabase(dbName, true, true); Database db = new DatabaseBuilder() .setName(dbName) .build(conf); try { client.createDatabase(db); Assert.fail("should throw timeout exception."); } catch (MetaException e) { Assert.assertTrue("unexpected MetaException", e.getMessage().contains("Timeout when " + "executing method: create_database")); } // restore HiveMetaStore.TEST_TIMEOUT_VALUE = 1; }
} catch (Exception e) { client.createDatabase(new Database(dbName, "", null, null)); assertNotNull((client.getDatabase(dbName).getLocationUri()));
client.createDatabase(db1); createTable(dbName1, tableName1); Database db2 = new Database(); db2.setName(dbName2); client.createDatabase(db2); createTable(dbName2, tableName2);
msc.createDatabase(db); listSize++; assertEquals(listSize, notifyList.size());
.build(conf); try { client.createDatabase(db); } catch (MetaException e) { Assert.fail("should not throw timeout exception: " + e.getMessage()); client.createDatabase(db); Assert.fail("should throw timeout exception."); } catch (MetaException e) {
client.createDatabase(db); } catch (MetaException cantCreateDB) { System.err.println(cantCreateDB.getMessage());
.build(conf); Assert.assertEquals(SecurityUtils.getUser(), db.getOwnerName()); client.createDatabase(db);
Database db = new Database(); db.setName(dbName); client.createDatabase(db);
@Override public Void call() throws TException { client.createDatabase( new Database(dbName, "Database created by Kite", null /* default location */, null /* no custom parameters */ )); return null; } };
@Override public Void call() throws TException { client.createDatabase( new Database(dbName, "Database created by Kite", null /* default location */, null /* no custom parameters */ )); return null; } };
void createDatabase(String dbName, String description, String locationUri, Map<String, String> parameters) throws TException { metaStoreClient.createDatabase(new Database(dbName,description, locationUri, parameters)); }
/** * Create a new database with the specified name. * * @param databaseName Database name. * @throws TException If an error occurs creating the database. */ public void createDatabase(String databaseName) throws TException { HiveMetaStoreClient client = new HiveMetaStoreClient(conf()); String databaseFolder = new File(temporaryFolder.getRoot(), databaseName).toURI().toString(); try { client.createDatabase(new Database(databaseName, null, databaseFolder, null)); } finally { client.close(); } }
@Before public void setup() throws IOException, TException, InvocationTargetException, NoSuchMethodException, IllegalAccessException, NoSuchFieldException, SQLException { this.executorService = Executors.newSingleThreadExecutor(); hiveLocalDir = createTempDirectory("hive", asFileAttribute(fromString("rwxrwxrwx"))).toFile(); setupDB("jdbc:derby:" + getDerbyPath() + ";create=true"); this.server = thriftServer(); executorService.submit(() -> server.serve()); this.metastoreClient = new HiveMetaStoreClient(this.hiveConf); createIfNotExistsCatalog("hive"); this.metastoreClient.createDatabase(new Database(DB_NAME, "description", getDBPath(), new HashMap<>())); new HiveTables(this.hiveConf).create(schema, partitionSpec, DB_NAME, TABLE_NAME); }