0

我正在尝试在 HBase 中存储一些位置(纬度、经度)值。每次我从键值对的 HashMap 中获得一个新值时,我决定添加一列。我的 HashMap 如下所示:

{lat:43.7719802, lon:-79.5008048} (Hashmap 的示例 JSON 表示)

这是我的代码:

HTable table = new HTable(hBaseConfig, TableName);    
for (Map.Entry<String, String> entry : Columns.entrySet()) {
                    Append a = new Append(rowKey);
                    a.add(Bytes.toBytes("a"), Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue()));
                    table.append(a);
    }

但是当我想检索值时,它们是冗余存储的。我的意思是,对于每个值,它们在一个单元格中多次粘合在一起,如下所示:-79.5008048-79.5008048-79.5008048

我在我的代码中使用 HBase 0.94.15-cdh4.7.0 库。

有人知道解决这个问题的线索吗?

4

1 回答 1

1

您的值正在单元格中累积,因为您要求它们:您正在使用该append方法。

尝试put覆盖。

于 2014-07-10T23:22:37.083 回答