Rick
Rick

Reputation: 15

HBase - Java Client Limit Scan Results Explanation?

Is there a way to limit the total number of rows of sequential data when performing a scan of the data?

Notes:

Can someone better explain what is happening here and how to get the results I want?

Upvotes: 1

Views: 1544

Answers (1)

user3338391
user3338391

Reputation: 46

you can use either hbase shell or hbase java client.

1- hbase shell: use this command and pipe the results to a file and do "wc -l ..."

count 'table_name',1

2- java hbase client api

long count=0;
String row="";

for (Result res : scanner)
{
    for (Cell cell : res.listCells())
    {
        row = new String(CellUtil.cloneRow(cell));
        if(!row.equals(""))
            count++;
    }
}

Upvotes: 1

Related Questions