@Test(expected = InvalidOperationException.class) public void testAlterTableNoSuchDatabase() throws Exception { Table originalTable = testTables[2]; Table newTable = originalTable.deepCopy(); client.alter_table("no_such_database", originalTable.getTableName(), newTable); }
@Test(expected = InvalidOperationException.class) public void testAlterTableNoSuchTable() throws Exception { Table originalTable = testTables[2]; Table newTable = originalTable.deepCopy(); client.alter_table(originalTable.getDbName(), "no_such_table_name", newTable); }
@Test(expected = InvalidOperationException.class) public void testAlterTableNoSuchTableInThisDatabase() throws Exception { Table originalTable = testTables[2]; Table newTable = originalTable.deepCopy(); client.alter_table(OTHER_DATABASE, originalTable.getTableName(), newTable); }
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); }
@Test(expected = InvalidOperationException.class) public void testAlterTableInvalidStorageDescriptorRemovePartitionColumn() throws Exception { Table originalTable = partitionedTable; Table newTable = originalTable.deepCopy(); newTable.getPartitionKeys().remove(0); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test(expected = InvalidOperationException.class) public void alterTableBogusCatalog() throws TException { Table t = testTables[0].deepCopy(); t.getParameters().put("a", "b"); client.alter_table("nosuch", t.getDbName(), t.getTableName(), t); }
@Test public void testAlterTableNullTableName() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); try { client.alter_table(originalTable.getDbName(), null, newTable); Assert.fail("Expected exception"); } catch (MetaException | TProtocolException ex) { // Expected. } }
@Test public void testAlterTableNullDatabase() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); try { client.alter_table(null, originalTable.getTableName(), newTable); Assert.fail("Expected exception"); } catch (MetaException | TProtocolException ex) { } }
@Test(expected = InvalidOperationException.class) public void testAlterTableInvalidStorageDescriptorAlterPartitionColumnName() throws Exception { Table originalTable = partitionedTable; Table newTable = originalTable.deepCopy(); newTable.getPartitionKeys().get(0).setName("altered_name"); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test(expected = MetaException.class) public void testAlterTableNullDatabaseInNew() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.setDbName(null); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test(expected = MetaException.class) public void testAlterTableInvalidStorageDescriptorNullColumnType() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.getSd().getCols().get(0).setType(null); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test(expected = MetaException.class) public void testAlterTableNullStorageDescriptorInNew() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.setSd(null); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test(expected = InvalidOperationException.class) public void testAlterTableInvalidTableNameInNew() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.setTableName("test_table;"); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test(expected = InvalidOperationException.class) public void testAlterTableEmptyTableNameInNew() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.setTableName(""); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test(expected = InvalidOperationException.class) public void testAlterTableInvalidStorageDescriptorInvalidColumnType() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.getSd().getCols().get(0).setType("xyz"); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test(expected = MetaException.class) public void testAlterTableInvalidStorageDescriptorNullLocation() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.getSd().setLocation(null); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test(expected = InvalidOperationException.class) public void testAlterTableInvalidStorageDescriptorAddPartitionColumns() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.addToPartitionKeys(new FieldSchema("new_part", "int", "comment")); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test(expected = MetaException.class) public void testAlterTableInvalidStorageDescriptorNullCols() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.getSd().setCols(null); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }
@Test public void testAlterTableNullTableNameInNew() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.setTableName(null); try { client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); Assert.fail("Expected exception"); } catch (MetaException | TProtocolException ex) { // Expected. } }
@Test(expected = MetaException.class) public void testAlterTableInvalidStorageDescriptorNullSerdeInfo() throws Exception { Table originalTable = testTables[0]; Table newTable = originalTable.deepCopy(); newTable.getSd().setSerdeInfo(null); client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable); }