You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Wing Yew Poon (JIRA)" <ji...@apache.org> on 2011/08/30 07:04:37 UTC

[jira] [Created] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

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

        

[jira] [Commented] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "stack (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13152959#comment-13152959 ] 

stack commented on HBASE-4295:
------------------------------

Hmm... it looks like it is in 0.90.5.  Ignore above.
                
> 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
>            Assignee: Dave Revell
>            Priority: Critical
>             Fix For: 0.90.5
>
>         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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "stack (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13152956#comment-13152956 ] 

stack commented on HBASE-4295:
------------------------------

Stuti Awasthi on the list confirms this fixed rowcounter for him.  Lets get this into 0.90.5.
                
> 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
>            Assignee: Dave Revell
>             Fix For: 0.90.5
>
>         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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "Ted Yu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13093997#comment-13093997 ] 

Ted Yu commented on HBASE-4295:
-------------------------------

We can add a parameter, -includeEmptyValue, for rowcounter.
We should also create a variant of FirstKeyOnlyFilter which finds the first non-empty value before setting foundKV to true.

> 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

        

[jira] [Updated] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "stack (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stack updated HBASE-4295:
-------------------------

       Resolution: Fixed
    Fix Version/s: 0.90.5
     Hadoop Flags: [Reviewed]
           Status: Resolved  (was: Patch Available)

Committed to branches and trunk.  Thanks for the patch David (and the persistence Wing Yew Poon)

> 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
>            Assignee: David Revell
>             Fix For: 0.90.5
>
>         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

        

[jira] [Updated] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "David Revell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Revell updated HBASE-4295:
--------------------------------

    Assignee: David Revell
      Status: Patch Available  (was: Open)

> 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
>            Assignee: David Revell
>         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

        

[jira] [Updated] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "stack (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stack updated HBASE-4295:
-------------------------

    Priority: Critical  (was: Major)
    
> 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
>            Assignee: Dave Revell
>            Priority: Critical
>             Fix For: 0.90.5
>
>         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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "Jean-Daniel Cryans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13094001#comment-13094001 ] 

Jean-Daniel Cryans commented on HBASE-4295:
-------------------------------------------

I think it's more a problem of "what's a row". If there's one qualifier but it's empty, does the row still exist? I can easily see people not putting values if they don't need to, using the qualifier as a value. Maybe we don't need to check for an empty value.

> 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

        

[jira] [Commented] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "David Revell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13109761#comment-13109761 ] 

David Revell commented on HBASE-4295:
-------------------------------------

I should also mention that HBASE-4295-v1.patch applies to both 0.90 and trunk.

> 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

        

[jira] [Commented] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "Jean-Daniel Cryans (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] [Commented] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "Wing Yew Poon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13094004#comment-13094004 ] 

Wing Yew Poon commented on HBASE-4295:
--------------------------------------

Since I did not write the rowcounter program, I don't know what the intention was, and I can only guess. It seems to me that if the user invoked

{noformat}
rowcounter <table> <column1> <column2> <column3>
{noformat}

for example, that we should count only the rows where at least one of column1, column2 or column3 is non-empty. If a row has empty cells in all 3 (column1, column2 and column3) - it may have non-empty cells in other unspecified columns of the table - then that row should not be counted. I'm guessing this was the intended functionality.


> 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

        

[jira] [Commented] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13113776#comment-13113776 ] 

Hudson commented on HBASE-4295:
-------------------------------

Integrated in HBase-TRUNK #2246 (See [https://builds.apache.org/job/HBase-TRUNK/2246/])
    HBASE-4295 rowcounter does not return the correct number of rows in certain circumstances

stack : 
Files : 
* /hbase/trunk/CHANGES.txt
* /hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapred/RowCounter.java
* /hbase/trunk/src/main/java/org/apache/hadoop/hbase/mapreduce/RowCounter.java


> 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
>            Assignee: Dave Revell
>             Fix For: 0.90.5
>
>         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

        

[jira] [Updated] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "David Revell (JIRA)" <ji...@apache.org>.
     [ 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 notice.

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

        

[jira] [Commented] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-4295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13113824#comment-13113824 ] 

Hudson commented on HBASE-4295:
-------------------------------

Integrated in HBase-0.92 #17 (See [https://builds.apache.org/job/HBase-0.92/17/])
    HBASE-4295 rowcounter does not return the correct number of rows in certain circumstances

stack : 
Files : 
* /hbase/branches/0.92/CHANGES.txt
* /hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/mapred/RowCounter.java
* /hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/mapreduce/RowCounter.java


> 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
>            Assignee: Dave Revell
>             Fix For: 0.90.5
>
>         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

        

[jira] [Commented] (HBASE-4295) rowcounter does not return the correct number of rows in certain circumstances

Posted by "Wing Yew Poon (JIRA)" <ji...@apache.org>.
    [ 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