![](/img/trans.png)
[英]LongComparator does not work in Google Cloud Bigtable with HBase API
[英]How to delete a column of a single row in Google Cloud Bigtable with HBase API
我正在使用HBase API訪問Google Cloud Bigtable,但每當我嘗試刪除列時:
Delete delete = new Delete(r.getRow());
delete.addColumn(CF, Bytes.toBytes(d.seqid()));
delete.addColumn(CF, COL_LEASE);
tasksTable.delete(delete);
我收到了UnsupportedOperationException
:
java.lang.UnsupportedOperationException: Cannot delete single latest cell.
at com.google.cloud.bigtable.hbase.adapters.DeleteAdapter.throwIfUnsupportedPointDelete(DeleteAdapter.java:85)
at com.google.cloud.bigtable.hbase.adapters.DeleteAdapter.adapt(DeleteAdapter.java:141)
at com.google.cloud.bigtable.hbase.adapters.HBaseRequestAdapter.adapt(HBaseRequestAdapter.java:71)
at com.google.cloud.bigtable.hbase.BigtableTable.delete(BigtableTable.java:307)
at queue.BigTableRowBackedQueue.poll(BigTableRowBackedQueue.java:54)
我可以從HBase Java客戶端中刪除整行,並且可以使用HBase shell刪除單個列。
如何在不刪除Java客戶端中的行的情況下刪除列?
對不起您的麻煩。 Bigtable和HBase在幾個方面有所不同,這就是其中之一。
Delete delete = new Delete(rowKey);
delete.addColumns(COLUMN_FAMILY, qual); // the 's' matters
table.delete(delete);
HBase的Delete.addColumn
僅刪除列中的最新單元格。 Delete.addColumn_s_
表示刪除所有單元格(即所有不同的時間戳)。 或者,您可以通過Delete.addColumn(byte[], byte[], long)
刪除特定單元格Delete.addColumn(byte[], byte[], long)
其中long
是時間戳。
hbase shell delete 使用 deleteColumns
映射到封面下的addColumns
。 它也使用s
變體,這就是它工作的原因。
這里是我們完整的TestDelete套件,用於標識您作為@Category(KnownGap.class)
呈現的用例,我們使用它來識別Bigtable客戶端中缺少HBase功能的差異。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.