hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Revell (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances
Date Wed, 21 Sep 2011 18:33:10 GMT

     [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

David Revell updated HBASE-4295:

    Attachment: HBASE-4295-v1.patch

Attaching patch v1 for mapreduce.RowCounter and mapred.RowCounter.

In my opinion, it is silly not to count rows where data is stored only in qualifiers. Because:

1. Leaving cell values empty is a valid schema choice. Nothing about HBase's design suggests
that you must use the cell value in order to be considered a first class row. Leaving these
rows uncounted is a rude surprise for users who expect all rows to be counted, if they even

2. Scanning for non-empty cells breaks the FirstKeyOnlyFilter optimization and forces us to
scan potentially many cells looking for non-empty values.

My feeling is that anyone who has the rare use case "count rows where some cell has a non-empty
value" can easily write that themselves, and the builtin jobs should do the simple obvious
fast thing.

> rowcounter does not return the correct number of rows in certain circumstances
> ------------------------------------------------------------------------------
>                 Key: HBASE-4295
>                 URL: https://issues.apache.org/jira/browse/HBASE-4295
>             Project: HBase
>          Issue Type: Bug
>          Components: mapreduce
>    Affects Versions: 0.90.4
>            Reporter: Wing Yew Poon
>         Attachments: HBASE-4295-v1.patch
> When you run
> {noformat}
> hadoop jar hbase.jar rowcounter <table>
> {noformat}
> the org.apache.hadoop.hbase.mapreduce.RowCounter class is run.
> The RowCounterMapper class in the RowCounter mapreduce job contains the following:
> {noformat}
>     @Override
>     public void map(ImmutableBytesWritable row, Result values,
>       Context context)
>     throws IOException {
>       for (KeyValue value: values.list()) {
>         if (value.getValue().length > 0) {
>           context.getCounter(Counters.ROWS).increment(1);
>           break;
>         }
>       }
>     }
> {noformat}
> The intention is to go through the column values in the row, and increment the ROWS counter
if some value is non-empty. However, values.list() always has size 1. This is because the
createSubmittableJob static method uses a Scan as follows:
> {noformat}
>     Scan scan = new Scan();
>     scan.setFilter(new FirstKeyOnlyFilter());
> {noformat}
> So the input map splits always contain just the first KV. If the column corresponding
to that first KV is empty, even though other columns are non-empty, that row is skipped.
> This way, rowcounter can return an incorrect result.
> One way to reproduce this is to create an hbase table with two columns, say f1:q1 and
f2:q2. Create some (say 2) rows with empty f1:q1 but non-empty f2:q2, and some (say 3) rows
with empty f2:q2 and non-empty f1:q1.
> Then run rowcounter (specifying only the table but not any columns). The count will be
either 2 short or 3 short.

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message