欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

org.apache.hadoop.hbase.DoNotRetryIOException: Field is not a long, it's 19 bytes wide

程序员文章站 2022-07-06 09:56:21
...

问题:
使用java代码调用原子性递增方法时报如下错:

Caused by: org.apache.hadoop.hbase.ipc.RemoteWithExtrasException(org.apache.hadoop.hbase.DoNotRetryIOException): org.apache.hadoop.hbase.DoNotRetryIOException: Field is not a long, it's 19 bytes wide
    at org.apache.hadoop.hbase.regionserver.HRegion.getLongValue(HRegion.java:7707)
    at org.apache.hadoop.hbase.regionserver.HRegion.applyIncrementsToColumnFamily(HRegion.java:7661)
    at org.apache.hadoop.hbase.regionserver.HRegion.doIncrement(HRegion.java:7536)
    at org.apache.hadoop.hbase.regionserver.HRegion.increment(HRegion.java:7496)
    at org.apache.hadoop.hbase.regionserver.RSRpcServices.increment(RSRpcServices.java:554)
    at org.apache.hadoop.hbase.regionserver.RSRpcServices.mutate(RSRpcServices.java:2249)
    at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:33646)
    at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2196)
    at org.apach

原因
代码如下:

Increment increment = new Increment(Bytes.toBytes("new_row_13"));
increment.addColumn(Bytes.toBytes("user_num"),Bytes.toBytes("in"), 2);
table.increment(increment);

因为之前在bash shell进行过put操作,value类型为非整型

put 'java_cli_table','new_row_13','user_num:in','0'

解决办法
由于还不知道怎么修改value类型,increment操作时,使用了新的修饰符

increment.addColumn(Bytes.toBytes("user_num"),Bytes.toBytes("inc"), 2);