java - 如何通过行键从Bigtable中获取所有值?

标签 java google-cloud-platform hbase bigtable google-cloud-bigtable

我无法通过行键从 BigTable 获取所有值,

我的表是这样的,我只能得到其中的3个,相同的列族具有相同的限定符只会得到一个,例如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();

关于java - 如何通过行键从Bigtable中获取所有值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56647565/

相关文章:

google-cloud-platform - 使用部署管理器创建云运行服务返回 "Requested entity was not found."错误

scala - 如何从Spark中的Hbase表读取数据?

java - Android AsyncTask 和对象传递

Java URLConnection 到 php

google-cloud-platform - stackdriver 指标中的 count 有什么用

hadoop - 减少 HFileOutputFormat 中挂起的作业

python - 如何让Pandas Python中的HBase中不存储空值?

java - 如何在 GWT 中使用 JSNI 覆盖类型提取嵌套 JSON 对象?

java - 检查类型是否可分配不适用于原始类型

Google Cloud 上的 Angular 应用程序 : Bootstrap 4 btn doesn't fit in input-group-btn