hbase类型不一致bug
一:java.lang.IllegalArgumentException: offset (0) + length (8) exceed the capacity of the array: 3
java.lang.IllegalArgumentException: offset (0) + length (8) exceed the capacity of the array: 3 at org.apache.hadoop.hbase.util.Bytes.explainWrongLengthOrOffset(Bytes.java:632) at org.apache.hadoop.hbase.util.Bytes.toLong(Bytes.java:606) at org.apache.hadoop.hbase.util.Bytes.toLong(Bytes.java:579) at com.tracker.coprocessor.observer.aggregate.measure.LongSumAggregator.aggregateBytes(LongSumAggregator.java:20) at com.tracker.coprocessor.observer.aggregate.handler.GroupAggrHandler.aggregate(GroupAggrHandler.java:153) at com.tracker.common.db.simplehbase.HbaseClientImpl.aggrData_internal(HbaseClientImpl.java:608) at com.tracker.common.db.simplehbase.HbaseClientImpl.aggrByRowRange(HbaseClientImpl.java:578)
问题,读hbase是希望读取的长度是8,但是长度是有3。
读取的同时会映射为对象,对象其中的一个成员为:
@HBaseColumn(qualifier = "logCount", isKpi = true, defaultFuncName = MeasureAggregator.FUNC_SUM) public Long logCount; //广告展示次数
然而,scan数据为:
总结,就是希望读取的内容格式是Long,而实际上存储的形式确是String。所以会出现读取异常的错误。