Refine search
private Scenario scenarioType(org.apache.hadoop.hive.metastore.api.Table before, org.apache.hadoop.hive.metastore.api.Table after) { if (before.getDbName().equals(after.getDbName()) && before.getTableName().equals(after.getTableName())) { return isTruncateOp ? Scenario.TRUNCATE : Scenario.ALTER; } else { return Scenario.RENAME; } }
@Test(expected = UnknownDBException.class) public void getTableObjectsByNameBogusCatalog() throws TException { client.getTableObjectsByName("nosuch", testTables[0].getDbName(), Arrays.asList(testTables[0].getTableName(), testTables[1].getTableName())); }
@Test(expected = InvalidObjectException.class) public void testAppendPartitionByNameBogusCatalog() throws Exception { client.appendPartition("nosuch", DB_NAME, tableWithPartitions.getTableName(), "year=2017/month=april"); }
@Test(expected = MetaException.class) public void testExchangePartitionsEmptyPartSpec() throws Exception { Map<String, String> partitionSpecs = new HashMap<>(); client.exchange_partitions(partitionSpecs, sourceTable.getDbName(), sourceTable.getTableName(), destTable.getDbName(), destTable.getTableName()); }
@Test(expected = NoSuchObjectException.class) public void testDropTableNoSuchDatabase() throws Exception { Table table = testTables[2]; client.dropTable("no_such_database", table.getTableName(), true, false); }
public T onTable(Table table) { this.catName = table.getCatName(); this.dbName = table.getDbName(); this.tableName = table.getTableName(); return child; }
@Test(expected = MetaException.class) public void testExchangePartitionEmptyPartSpec() throws Exception { Map<String, String> partitionSpecs = new HashMap<>(); client.exchange_partition(partitionSpecs, sourceTable.getDbName(), sourceTable.getTableName(), destTable.getDbName(), destTable.getTableName()); }
@Test(expected = NoSuchObjectException.class) public void testDropTableNoSuchTableInTheDatabase() throws Exception { Table table = testTables[2]; client.dropTable(OTHER_DATABASE, table.getTableName(), true, false); }
public JSONCreateTableMessage(String server, String servicePrincipal, Table tableObj, Iterator<String> fileIter, Long timestamp) { this(server, servicePrincipal, tableObj.getDbName(), tableObj.getTableName(), tableObj.getTableType(), timestamp); try { this.tableObjJson = MessageBuilder.createTableObjJson(tableObj); } catch (TException e) { throw new IllegalArgumentException("Could not serialize: ", e); } this.files = (fileIter != null) ? Lists.newArrayList(fileIter) : Lists.newArrayList(); }
@Test(expected = MetaException.class) public void testExchangePartitionsNonExistingValuesInPartSpec() throws Exception { Map<String, String> partitionSpecs = new HashMap<>(); partitionSpecs.put("ev", "2017"); partitionSpecs.put("honap", "march"); partitionSpecs.put("nap", "22"); client.exchange_partitions(partitionSpecs, sourceTable.getDbName(), sourceTable.getTableName(), destTable.getDbName(), destTable.getTableName()); }
@Test(expected = NoSuchObjectException.class) public void testGetTableNoSuchTableInTheDatabase() throws Exception { Table table = testTables[2]; client.getTable(OTHER_DATABASE, table.getTableName()); }
/** * Get table name in cat.db.table format. * @param table table object * @return fully qualified name. */ public static String getCatalogQualifiedTableName(Table table) { return TableName.getQualified(table.getCatName(), table.getDbName(), table.getTableName()); }
@Test(expected = MetaException.class) public void testExchangePartitionNonExistingValuesInPartSpec() throws Exception { Map<String, String> partitionSpecs = new HashMap<>(); partitionSpecs.put("ev", "2017"); partitionSpecs.put("honap", "march"); partitionSpecs.put("nap", "22"); client.exchange_partition(partitionSpecs, sourceTable.getDbName(), sourceTable.getTableName(), destTable.getDbName(), destTable.getTableName()); }
@Test public void testListTableNamesByFilterCheckCombined() throws Exception { // Combined: last_access<=3000 and (Owner="Tester" or param1="param2") String filter = hive_metastoreConstants.HIVE_FILTER_FIELD_LAST_ACCESS + "<3000 and (" + hive_metastoreConstants.HIVE_FILTER_FIELD_OWNER + "=\"Tester\" or " + hive_metastoreConstants.HIVE_FILTER_FIELD_PARAMS + "param1=\"value2\")"; List<String> tableNames = client.listTableNamesByFilter(DEFAULT_DATABASE, filter, (short)-1); Assert.assertEquals("Found tables", 3, tableNames.size()); Assert.assertTrue(tableNames.contains(testTables[1].getTableName())); Assert.assertTrue(tableNames.contains(testTables[2].getTableName())); Assert.assertTrue(tableNames.contains(testTables[4].getTableName())); }
private static void removeTempTable(org.apache.hadoop.hive.metastore.api.Table t) { String qualifiedTableName = Warehouse. getQualifiedName(t.getDbName().toLowerCase(), t.getTableName().toLowerCase()); SessionState ss = SessionState.get(); if (ss == null) { LOG.warn("No current SessionState, skipping temp partitions for " + qualifiedTableName); return; } ss.getTempPartitions().remove(Warehouse.getQualifiedName(t)); } private static void createTempTable(org.apache.hadoop.hive.metastore.api.Table t) {
@Test(expected = MetaException.class) public void testExchangePartitionsNullSourceDB() throws Exception { Map<String, String> partitionSpecs = getPartitionSpec(partitions[1]); client.exchange_partitions(partitionSpecs, null, sourceTable.getTableName(), destTable.getDbName(), destTable.getTableName()); }
@Test public void testListTableNamesByFilterCheckLastAccess() throws Exception { String filter = hive_metastoreConstants.HIVE_FILTER_FIELD_LAST_ACCESS + "=1000"; List<String> tableNames = client.listTableNamesByFilter(DEFAULT_DATABASE, filter, (short)-1); Assert.assertEquals("Found tables", 2, tableNames.size()); Assert.assertTrue(tableNames.contains(testTables[0].getTableName())); Assert.assertTrue(tableNames.contains(testTables[2].getTableName())); }
@Override public DropPartitionMessage buildDropPartitionMessage(Table table, Iterator<Partition> partitions) { return new JSONDropPartitionMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, table.getDbName(), table.getTableName(), table.getTableType(), MessageBuilder.getPartitionKeyValues(table, partitions), now()); }
@Test(expected = MetaException.class) public void testExchangePartitionEmptySourceDB() throws Exception { Map<String, String> partitionSpecs = getPartitionSpec(partitions[1]); client.exchange_partition(partitionSpecs, "", sourceTable.getTableName(), destTable.getDbName(), destTable.getTableName()); }
private void setTableSkipProperty( IMetaStoreClient msClient, String tbl, String val) throws Exception { Table table = msClient.getTable(ss.getCurrentDatabase(), tbl); table.getParameters().put(StatsUpdaterThread.SKIP_STATS_AUTOUPDATE_PROPERTY, val); msClient.alter_table(table.getDbName(), table.getTableName(), table); }