2016-07-29 49 views
2

我想創建一個單列家族(使用Java客戶端庫0.9.1的Google雲端Bigtable模擬器)的表格。谷歌雲端Bigtable模擬器似乎將列家族刪除

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

我的問題是,創建表後,檢索到的描述符從不包含EOD系列;因此,在該列系列中存儲數據的任何調用都會失敗。

我是否錯過了一些東西,或者它是模擬器的限制嗎?

+3

這是模擬器的問題。我們正在修復它。 –

+1

該錯誤已在最新版本的模擬器中修復:https://cloud.google.com/bigtable/docs/emulator –

回答

3

的特定模擬器,解決辦法可以使用,直至修復bug是在創建表後添加列族:

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