2016-07-29 5 views
2

(Javaクライアントライブラリ0.9.1を使用してGoogle Cloud Bigtableエミュレータをターゲットにして)単一の列ファミリのテーブルを作成しようとしています。Google Cloud 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

エミュレータ固有の問題を回避するには、テーブルを作成した後、カラムファミリを追加することです:

connector.getAdmin().addColumn(
    descriptor.getTableName(), new HColumnDescriptor("EOD")); 
関連する問題