Hbase过滤记录数问题(新增UV/活跃UV)
protected void map(ImmutableBytesWritable key, Result value, Context context)throws IOException, InterruptedException {String keyStr = Bytes.toString(key.get());String appIdStr = keyStr.substring(2, 4);byte[] app_id = Bytes.toBytes(appIdStr);byte[] imei = keyStr.substring(4).getBytes();// if version = 2if (value.raw().length == 2) {byte[] version = value.getValue(HTableConstant.IPJ_STATICS_INDEX_IMEI_FAMILY,HTableConstant.IPJ_STATICS_INDEX_VERSION_QUALIFIER);byte[] time = value.getValue(HTableConstant.IPJ_STATICS_INDEX_IMEI_FAMILY,HTableConstant.IPJ_STATICS_INDEX_TIME_QUALIFIER);if (version != null) {outkey.set(app_id, 0, app_id.length, version,imei, time);context.write(outkey, ONE);}}}
?value.raw().length的值:
1.当job中过滤一行时,那么?value.raw().length = 1?表示新增UV
value.raw().length > 1?表示活跃UV
2.当job中过滤两行时,那么(上述代码情况)
value.raw().length = 2?表示新增UV
value.raw().length > 2?表示活跃UV
?