@Test(expected = NoSuchObjectException.class) public void alterNonExistentCatalog() throws TException { String catName = "alter_no_such_catalog"; Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.alterCatalog(catName, cat); }
String db1Location = MetaStoreTestUtils.getTestWarehouseDir(dbNames[1]); dbs[1] = new DatabaseBuilder() .setName(dbNames[1])
@Test(expected = InvalidOperationException.class) public void alterChangeName() throws TException { String catName = "alter_change_name"; String location = MetaStoreTestUtils.getTestWarehouseDir(catName); String description = "I have a bad feeling about this"; new CatalogBuilder() .setName(catName) .setLocation(location) .setDescription(description) .create(client); Catalog newCat = client.getCatalog(catName); newCat.setName("you_may_call_me_tim"); client.alterCatalog(catName, newCat); } }
Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat);
@Override protected IMetaStoreClient getClient() throws Exception { // Separate client to create the catalog catalogCapableClient = new HiveMetaStoreClient(conf); catLocation = MetaStoreTestUtils.getTestWarehouseDir(catName); Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(catLocation) .build(); catalogCapableClient.createCatalog(cat); catalogCapableClient.close(); MetastoreConf.setVar(conf, MetastoreConf.ConfVars.CATALOG_DEFAULT, catName); return new HiveMetaStoreClientPreCatalog(conf); }
@Override protected IMetaStoreClient getClient() throws Exception { Configuration svrConf = new Configuration(conf); int port = MetaStoreTestUtils.startMetaStoreWithRetry(HadoopThriftAuthBridge.getBridge(), svrConf); // Only set the default catalog on the client. MetastoreConf.setVar(conf, MetastoreConf.ConfVars.THRIFT_URIS, "thrift://localhost:" + port); MetastoreConf.setVar(conf, MetastoreConf.ConfVars.CATALOG_DEFAULT, catName); IMetaStoreClient client = new HiveMetaStoreClient(conf); assert !client.isLocalMetaStore(); // Don't make any calls but catalog calls until the catalog has been created, as we just told // the client to direct all calls to a catalog that does not yet exist. catLocation = MetaStoreTestUtils.getTestWarehouseDir(catName); Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(catLocation) .build(); client.createCatalog(cat); return client; }
Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat);
@Test(expected = InvalidOperationException.class) public void dropCatalogWithNonEmptyDefaultDb() throws TException { String catName = "toBeDropped2"; new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .create(client); new TableBuilder() .setTableName("not_droppable") .setCatName(catName) .addCol("cola1", "bigint") .create(client, metaStore.getConf()); client.dropCatalog(catName); }
@Test(expected = InvalidOperationException.class) public void dropNonEmptyCatalog() throws TException { String catName = "toBeDropped"; Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat); String dbName = "dontDropMe"; new DatabaseBuilder() .setName(dbName) .setCatalogName(catName) .create(client, metaStore.getConf()); client.dropCatalog(catName); }
Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat);
@Test public void otherCatalogs() throws TException { String catName = "list_tables_in_other_catalogs"; Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat); String dbName = "db_in_other_catalog"; // For this one don't specify a location to make sure it gets put in the catalog directory Database db = new DatabaseBuilder() .setName(dbName) .setCatalogName(catName) .create(client, metaStore.getConf()); String[] tableNames = new String[4]; for (int i = 0; i < tableNames.length; i++) { tableNames[i] = "table_in_other_catalog_" + i; TableBuilder builder = new TableBuilder() .inDb(db) .setTableName(tableNames[i]) .addCol("col1_" + i, ColumnType.STRING_TYPE_NAME) .addCol("col2_" + i, ColumnType.INT_TYPE_NAME); if (i == 0) builder.addTableParam("the_key", "the_value"); builder.create(client, metaStore.getConf()); } String filter = hive_metastoreConstants.HIVE_FILTER_FIELD_PARAMS + "the_key=\"the_value\""; List<String> fetchedNames = client.listTableNamesByFilter(catName, dbName, filter, (short)-1); Assert.assertEquals(1, fetchedNames.size()); Assert.assertEquals(tableNames[0], fetchedNames.get(0)); }
Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat);
Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat);
Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat);
Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat);
Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat);
Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat);
@Test(expected = InvalidOperationException.class) public void moveTablesBetweenCatalogsOnAlter() throws TException { String catName = "move_table_between_catalogs_on_alter"; Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat); String dbName = "a_db"; // For this one don't specify a location to make sure it gets put in the catalog directory Database db = new DatabaseBuilder() .setName(dbName) .setCatalogName(catName) .create(client, metaStore.getConf()); String tableName = "non_movable_table"; Table before = new TableBuilder() .inDb(db) .setTableName(tableName) .addCol("col1", ColumnType.STRING_TYPE_NAME) .addCol("col2", ColumnType.INT_TYPE_NAME) .create(client, metaStore.getConf()); Table after = before.deepCopy(); after.setCatName(DEFAULT_CATALOG_NAME); client.alter_table(catName, dbName, tableName, after); }
Catalog cat = new CatalogBuilder() .setName(catName) .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName)) .build(); client.createCatalog(cat);
.setLocation(MetaStoreTestUtils.getTestWarehouseDir(OTHER_CATALOG)) .build(); client.createCatalog(cat);