[
https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13093979#comment-13093979
]
Wing Yew Poon commented on HBASE-4295:
--------------------------------------
I'll try to put together a unit test for the issue. However, I'm not sure what
is an appropriate fix. Removing the line
{noformat}
scan.setFilter(new FirstKeyOnlyFilter());
{noformat}
would ensure correct behavior, but I don't know if the performance would be
acceptable.
> 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
>
> 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