[ https://issues.apache.org/jira/browse/HBASE-13417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nick Dimiduk updated HBASE-13417: --------------------------------- Resolution: Fixed Status: Resolved (was: Patch Available) Pushed to branch-1.0+. Thanks for the contribution [~abhishek.chouhan]! Thanks reviewers [~tedyu] and [~ghelmling]. > batchCoprocessorService() does not handle NULL keys > --------------------------------------------------- > > Key: HBASE-13417 > URL: https://issues.apache.org/jira/browse/HBASE-13417 > Project: HBase > Issue Type: Bug > Components: Coprocessors > Affects Versions: 1.0.0 > Reporter: Lars George > Assignee: Abhishek Singh Chouhan > Priority: Minor > Labels: noob > Fix For: 2.0.0, 1.1.0, 1.0.2, 1.2.0 > > Attachments: HBASE-13417.patch > > > The JavaDoc for {{batchCoprocessorService()}} reads: > {noformat} > * @param startKey > * start region selection with region containing this row. If {@code > null}, the > * selection will start with the first table region. > * @param endKey > * select regions up to and including the region containing this row. > If {@code null}, > * selection will continue through the last table region. > {noformat} > Setting the call to {{null}} keys like so > {code} > Map<byte[], CountResponse> results = table.batchCoprocessorService( > RowCountService.getDescriptor().findMethodByName("getRowCount"), > request, null, null, CountResponse.getDefaultInstance()); > {code} > yields an exception: > {noformat} > java.lang.NullPointerException > at org.apache.hadoop.hbase.util.Bytes.compareTo(Bytes.java:1187) > at > org.apache.hadoop.hbase.client.HTable.getKeysAndRegionsInRange(HTable.java:744) > at > org.apache.hadoop.hbase.client.HTable.getKeysAndRegionsInRange(HTable.java:723) > at > org.apache.hadoop.hbase.client.HTable.batchCoprocessorService(HTable.java:1801) > at > org.apache.hadoop.hbase.client.HTable.batchCoprocessorService(HTable.java:1778) > at coprocessor.EndpointBatchExample.main(EndpointBatchExample.java:60) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) > {noformat} > This is caused by the call shipping off the keys to {{getStartKeysInRange()}} > as-is and that method uses {{Bytes.compareTo()}} on the {{null}} keys and > fails. > One can work around using {{HConstants.EMPTY_START_ROW, > HConstants.EMPTY_END_ROW}} instead, but that is not documented, nor standard > behavior. Need to handle {{null}} keys as advertised. -- This message was sent by Atlassian JIRA (v6.3.4#6332)