如何在Accumulo中跨多个范围执行高效删除



我有一个具有以下模式的索引表:

Row   CF    CQ
Name  POB   DOB

如何有效删除多行(例如John Doe:纽约:01/01/75,Jane Doe:迈阿密:06/21/80)?

使用要删除的所有Range(行)的BatchDeletersetRanges

https://accumulo.apache.org/1.7/apidocs/org/apache/accumulo/core/client/BatchDeleter.html

BatchDeleter deleter= conn.createBatchDeleter("Table Name", new Authorizations(), 1, config);
Collection<Range> ranges = new ArrayList<Range>();
Scanner tableScannerRange= conn.createScanner("TableName", new Authorizations());
tableScannerRange.setRange(new Range("XXXX"));
for (Entry<Key, Value> entry : tableScannerRange) {
                            ranges.add(new Range(entry.getKey().getRow()));
}
deleter.setRanges(ranges);
deleter.delete();

或使用Put-Delete

Mutation mutation_data = new Mutation("  ");
                        mutation_data.putDelete(CF,CQ);

相关内容

  • 没有找到相关文章

最新更新