Updated on 2022-08-16 GMT+08:00

Modifying a Table

Function

Modify a table object using KuduClient.alterTable(String name, AlterTableOptions ato).

Sample Code

The code snippet for writing data is as follows:

// Alter the table, adding a column with a default value. 
// Note: after altering the table, the table needs to be re-opened. 
AlterTableOptions ato = new AlterTableOptions(); 
ato.addColumn("added", org.apache.kudu.Type.DOUBLE, DEFAULT_DOUBLE); 
client.alterTable(tableName, ato);

In the sample code, AlterTableOptions is the set of table attributes to be modified. In the example, a column is added to the table.