我无法按行键从bigtable获取所有值,
我的表是这样的,我只能得到其中的3个,具有相同限定符的同一列族只能得到一个,例如hashes:md5 will 只接受“EMIALMD5测试”
xy001uuuyyyy
hashes:md5 @ 2019/06/17-16:57:10.173000
"emialmd5test"
hashes:md5 @ 2019/06/17-10:58:39.711000
"emialmd5"
hashes:sha1 @ 2019/06/17-16:57:10.173000
"emailsha1test"
hashes:sha1 @ 2019/06/17-10:58:39.711000
"emailsha1"
hashes:sha256 @ 2019/06/17-16:57:10.172000
"emailsha256test"
hashes:sha256 @ 2019/06/17-10:58:39.711000
"emailsha256"
这是我的密码
Connection connection = BigtableConfiguration.connect(WholeSaleHelper.WHOOLE_SALE_CONFIG.toHBaseConfig());
Scan scan = new Scan()
.setRowPrefixFilter(cookieAndPel.getValue().getBytes());
Table table = connection.getTable(TableName.valueOf(WholeSaleHelper.WHOOLE_SALE_CONFIG.getTableId()));
byte[] md5Bytes = null, sha1Bytes = null, sha256Bytes = null;
for (Result result : table.getScanner(scan)) {
md5Bytes = result.getValue(WholeSaleHelper.WHOLE_SALE_COLUMN_FAMILY.getBytes(), WholeSaleHelper.WHOLE_SALE_MD5.getBytes());
sha1Bytes = result.getValue(WholeSaleHelper.WHOLE_SALE_COLUMN_FAMILY.getBytes(), WholeSaleHelper.WHOLE_SALE_SHA1.getBytes());
sha256Bytes = result.getValue(WholeSaleHelper.WHOLE_SALE_COLUMN_FAMILY.getBytes(), WholeSaleHelper.WHOLE_SALE_SHA256.getBytes());
}
或者我可以用其他方法来得到这些值吗?只需按roe键搜索即可获得所有值。不关心列族和限定符
1条答案
按热度按时间aor9mmx11#
您可以将此添加到扫描以获取所有版本:
scan.setMaxVersions();