【问题标题】:Google Cloud Bigtable emulator seems to drop column familiesGoogle Cloud Bigtable 模拟器似乎删除了列族
【发布时间】:2016-07-29 00:09:36
【问题描述】:

我正在尝试创建一个具有单列族的表(针对使用 Java 客户端库 0.9.1 的 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 系列;因此,任何在该列族中存储数据的调用都会失败。

是我遗漏了什么还是模拟器的限制?

【问题讨论】:

标签: java emulation google-cloud-bigtable


【解决方案1】:

在修复错误之前可以使用的特定于模拟器的解决方法是在创建表后添加列族:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-31
    • 2018-11-08
    • 1970-01-01
    • 2018-12-22
    • 2020-04-09
    相关资源
    最近更新 更多