如何通过行键从 Bigtable 中获取所有值?
How to get all values from Bigtable by row key?
我无法通过行键从 BigTable 获取所有值,
我的table是这样的,我只能得到3个,同一个column family同一个qualifier只会得到一个,比如hashes:md5只会得到"emialmd5test"
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 键搜索即可获取所有值。不关心列族和限定符
您可以将此添加到您的扫描中以获取所有版本:scan.setMaxVersions();
我无法通过行键从 BigTable 获取所有值,
我的table是这样的,我只能得到3个,同一个column family同一个qualifier只会得到一个,比如hashes:md5只会得到"emialmd5test"
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 键搜索即可获取所有值。不关心列族和限定符
您可以将此添加到您的扫描中以获取所有版本:scan.setMaxVersions();