user1568967 user1568967 - 7 months ago 50
Java Question

Google Cloud Bigtable emulator seems to drop column families

I am trying to create a table with a single column family (targeting the Google Cloud Bigtable emulator using Java client library 0.9.1).

private void setupTable() throws IOException {

TableName name = TableName.valueOf("EndOfDayPriceUnadjusted");
try(Connection connection = BigtableConfiguration.connect(hbaseConf)){
HTableDescriptor descriptor = new HTableDescriptor(name);
descriptor.addFamily(new HColumnDescriptor("EOD"));

// calling HTableDescriptor desc = connection.getAdmin().getTableDescriptor(name); yields the same result
Table t = connection.getTable(name);
if(t.getTableDescriptor().getColumnFamilies().length == 0)
log.error("no column families.");
else"table with column family created.");

My problem is that after creating the table, the retrieved descriptor never contains the
family; therefore, any calls to store data in that column family fails.

Am I missing something or is it a limitation of the emulator?


An emulator-specific workaround you can use until the bug is fixed is to add the column family after creating the table:

connector.getAdmin().addColumn(descriptor.getTableName(), new HColumnDescriptor("EOD"));