2
votes

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"));

        connection.getAdmin().createTable(descriptor);
        // 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
            log.info("table with column family created.");
    }
}

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

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

1
This is a problem with the emulator. We're working on fixing it. - Solomon Duskis
This bug has been fixed in recent versions of the emulator: cloud.google.com/bigtable/docs/emulator - Gary Elliott

1 Answers

3
votes

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"));