@Test public void testUpdateTableSchema() throws Exception { try { HCatClient client = HCatClient.create(new Configuration(hcatConf)); final String dbName = "testUpdateTableSchema_DBName"; final String tableName = "testUpdateTableSchema_TableName"; client.dropDatabase(dbName, true, HCatClient.DropDBMode.CASCADE); client.createDatabase(HCatCreateDBDesc.create(dbName).build()); List<HCatFieldSchema> oldSchema = Arrays.asList(new HCatFieldSchema("foo", Type.INT, ""), new HCatFieldSchema("bar", Type.STRING, "")); client.createTable(HCatCreateTableDesc.create(dbName, tableName, oldSchema).build()); List<HCatFieldSchema> newSchema = Arrays.asList(new HCatFieldSchema("completely", Type.DOUBLE, ""), new HCatFieldSchema("new", Type.FLOAT, ""), new HCatFieldSchema("fields", Type.STRING, "")); client.updateTableSchema(dbName, tableName, newSchema); assertArrayEquals(newSchema.toArray(), client.getTable(dbName, tableName).getCols().toArray()); client.dropDatabase(dbName, false, HCatClient.DropDBMode.CASCADE); } catch (Exception exception) { LOG.error("Unexpected exception.", exception); assertTrue("Unexpected exception: " + exception.getMessage(), false); } }
public abstract void updateTableSchema(String dbName, String tableName, List<HCatFieldSchema> columnSchema) throws HCatException;
HCatClient { public abstract void updateTableSchema(String dbName, String tableName, List<HCatFieldSchema> columnSchema) throws HCatException; }
HCatClient { public abstract void updateTableSchema(String dbName, String tableName, List<HCatFieldSchema> columnSchema) throws HCatException;  }
HCatClient { public abstract void updateTableSchema(String dbName, String tableName, List<HCatFieldSchema> columnSchema) throws HCatException;  static HCatClient create(Configuration conf); abstract List<String> listDatabaseNamesByPattern(String pattern); abstract HCatDatabase getDatabase(String dbName); abstract void createDatabase(HCatCreateDBDesc dbInfo); abstract void dropDatabase(String dbName, boolean ifExists,
                    DropDBMode mode); abstract List<String> listTableNamesByPattern(String dbName, String tablePattern); abstract HCatTable getTable(String dbName, String tableName); abstract void createTable(HCatCreateTableDesc createTableDesc); abstract void updateTableSchema(String dbName, String tableName, List<HCatFieldSchema> columnSchema); abstract void updateTableSchema(String dbName, String tableName, HCatTable newTableDefinition); abstract String serializeTable(HCatTable hcatTable); abstract HCatTable deserializeTable(String hcatTableStringRep); abstract String serializePartition(HCatPartition hcatPartition); abstract List<String> serializePartitions(List<HCatPartition> hcatPartitions); abstract HCatPartition deserializePartition(String hcatPartitionStringRep); abstract List<HCatPartition> deserializePartitions(List<String> hcatPartitionStringReps); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract List<String> serializePartitionSpec(HCatPartitionSpec partitionSpec); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings); abstract void createTableLike(String dbName, String existingTblName,
                     String newTableName, boolean ifNotExists, boolean isExternal,
                     String location); abstract void dropTable(String dbName, String tableName,
                   boolean ifExists); abstract void renameTable(String dbName, String oldName,
                   String newName); abstract List<HCatPartition> getPartitions(String dbName, String tblName); abstract List<HCatPartition> getPartitions(String dbName, String tblName, Map<String, String> partitionSpec); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract HCatPartitionSpec getPartitionSpecs(String dbName, String tableName, int maxPartitions); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract HCatPartitionSpec getPartitionSpecs(String dbName, String tableName, Map<String, String> partitionSelector, int maxPartitions); abstract HCatPartition getPartition(String dbName, String tableName,
                         Map<String, String> partitionSpec); abstract void addPartition(HCatAddPartitionDesc partInfo); abstract int addPartitions(List<HCatAddPartitionDesc> partInfoList); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract int addPartitionSpec(HCatPartitionSpec partitionSpec); abstract void dropPartitions(String dbName, String tableName,
                    Map<String, String> partitionSpec, boolean ifExists); abstract List<HCatPartition> listPartitionsByFilter(String dbName, String tblName,
                                 String filter); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract HCatPartitionSpec listPartitionSpecsByFilter(String dbName, String tblName,
                                                               String filter, int maxPartitions); abstract void markPartitionForEvent(String dbName, String tblName,
                         Map<String, String> partKVs, PartitionEventType eventType); abstract boolean isPartitionMarkedForEvent(String dbName, String tblName,
                            Map<String, String> partKVs, PartitionEventType eventType); abstract String getDelegationToken(String owner,
                        String renewerKerberosPrincipalName); abstract long renewDelegationToken(String tokenStrForm); abstract void cancelDelegationToken(String tokenStrForm); abstract String getMessageBusTopicName(String dbName, String tableName); abstract List<HCatNotificationEvent> getNextNotification(long lastEventId,
                                                                  int maxEvents,
                                                                  IMetaStoreClient.NotificationFilter filter); abstract long getCurrentNotificationEventId(); abstract void close(); }
HCatClient { public abstract void updateTableSchema(String dbName, String tableName, List<HCatFieldSchema> columnSchema) throws HCatException;  static HCatClient create(Configuration conf); abstract List<String> listDatabaseNamesByPattern(String pattern); abstract HCatDatabase getDatabase(String dbName); abstract void createDatabase(HCatCreateDBDesc dbInfo); abstract void dropDatabase(String dbName, boolean ifExists,
                    DropDBMode mode); abstract List<String> listTableNamesByPattern(String dbName, String tablePattern); abstract HCatTable getTable(String dbName, String tableName); abstract void createTable(HCatCreateTableDesc createTableDesc); abstract void updateTableSchema(String dbName, String tableName, List<HCatFieldSchema> columnSchema); abstract void updateTableSchema(String dbName, String tableName, HCatTable newTableDefinition); abstract String serializeTable(HCatTable hcatTable); abstract HCatTable deserializeTable(String hcatTableStringRep); abstract String serializePartition(HCatPartition hcatPartition); abstract List<String> serializePartitions(List<HCatPartition> hcatPartitions); abstract HCatPartition deserializePartition(String hcatPartitionStringRep); abstract List<HCatPartition> deserializePartitions(List<String> hcatPartitionStringReps); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract List<String> serializePartitionSpec(HCatPartitionSpec partitionSpec); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract HCatPartitionSpec deserializePartitionSpec(List<String> hcatPartitionSpecStrings); abstract void createTableLike(String dbName, String existingTblName,
                     String newTableName, boolean ifNotExists, boolean isExternal,
                     String location); abstract void dropTable(String dbName, String tableName,
                   boolean ifExists); abstract void renameTable(String dbName, String oldName,
                   String newName); abstract List<HCatPartition> getPartitions(String dbName, String tblName); abstract List<HCatPartition> getPartitions(String dbName, String tblName, Map<String, String> partitionSpec); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract HCatPartitionSpec getPartitionSpecs(String dbName, String tableName, int maxPartitions); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract HCatPartitionSpec getPartitionSpecs(String dbName, String tableName, Map<String, String> partitionSelector, int maxPartitions); abstract HCatPartition getPartition(String dbName, String tableName,
                         Map<String, String> partitionSpec); abstract void addPartition(HCatAddPartitionDesc partInfo); abstract int addPartitions(List<HCatAddPartitionDesc> partInfoList); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract int addPartitionSpec(HCatPartitionSpec partitionSpec); abstract void dropPartitions(String dbName, String tableName,
                    Map<String, String> partitionSpec, boolean ifExists); abstract List<HCatPartition> listPartitionsByFilter(String dbName, String tblName,
                                 String filter); @InterfaceAudience.LimitedPrivate({"Hive"}) @InterfaceStability.Evolving abstract HCatPartitionSpec listPartitionSpecsByFilter(String dbName, String tblName,
                                                               String filter, int maxPartitions); abstract void markPartitionForEvent(String dbName, String tblName,
                         Map<String, String> partKVs, PartitionEventType eventType); abstract boolean isPartitionMarkedForEvent(String dbName, String tblName,
                            Map<String, String> partKVs, PartitionEventType eventType); abstract String getDelegationToken(String owner,
                        String renewerKerberosPrincipalName); abstract long renewDelegationToken(String tokenStrForm); abstract void cancelDelegationToken(String tokenStrForm); abstract String getMessageBusTopicName(String dbName, String tableName); abstract List<HCatNotificationEvent> getNextNotification(long lastEventId,
                                                                  int maxEvents,
                                                                  IMetaStoreClient.NotificationFilter filter); abstract long getCurrentNotificationEventId(); abstract void close(); static final String HCAT_CLIENT_IMPL_CLASS; }