You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Jean-Daniel Cryans (JIRA)" <ji...@apache.org> on 2011/08/30 20:15:40 UTC
[jira] [Commented] (HBASE-4295) rowcounter does not return the
correct number of rows in certain circumstances
[ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13093965#comment-13093965 ]
Jean-Daniel Cryans commented on HBASE-4295:
-------------------------------------------
Good catch, would you be kind enough to provide a patch?
> 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