【问题标题】:(BigTable Query, java API) how to use scan and rowKey at the same time?(BigTable Query, java API) 如何同时使用scan和rowKey?
【发布时间】:2020-01-31 20:39:48
【问题描述】:
这就是 bigTable 的样子
rowKey 列族
限定符1 限定符2 限定符3
键 1 值 1 值 2 值 3
键 2 值 4 值 5 值 6
键 3 值 7 值 8 值 9
如果我想获取 key1 的前 2 个限定符的值(value1 和 value 2)和 key2 的前 2 个限定符的值(value4 和 value 5)
我怎么能通过使用java API来做到这一点
尝试了 BigtableExtendedScan 但我无法将 2 个行键传递给该对象....
请在这里帮忙。
【问题讨论】:
标签:
google-cloud-bigtable
【解决方案1】:
一种可能的解决方案是使用“readRows()”方法扫描 BigTable 实例中的多行。您可以创建行范围从 'START KEY' 到 'END KEY' 的查询:
Query query = Query.create(tableId)
.range("[START KEY]", "[END KEY]")
.filter(FILTERS.qualifier().regex("[COLUMN PREFIX].*"));