0
votes

I can't get all the values from BigTable by row key,

My table looks like this, and I can only get 3 of them, same column family with the same qualifier will get only one, such as hashes:md5 will only get only "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"

Here is my code

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());
    }

or can I use some other way to get the values? just search by the roe key to get all values. Don't care about the column family and qualifier

1

1 Answers

1
votes

You can add this to your scan to get all versions: scan.setMaxVersions();