@Test public void testDecode() throws Exception { CubeDesc cubeDesc = CubeManager.getInstance(getTestConfig()).getCube("test_kylin_cube_with_slr_ready").getDescriptor(); HBaseColumnDesc hbaseCol = cubeDesc.getHBaseMapping().getColumnFamily()[0].getColumns()[0]; MeasureCodec codec = new MeasureCodec(hbaseCol.getMeasures()); BigDecimal sum = new BigDecimal("333.1234567"); BigDecimal min = new BigDecimal("333.1111111"); BigDecimal max = new BigDecimal("333.1999999"); LongWritable count = new LongWritable(2); ByteBuffer buf = ByteBuffer.allocate(RowConstants.ROWVALUE_BUFFER_SIZE); codec.encode(new Object[] { sum, min, max, count }, buf); buf.flip(); byte[] valueBytes = new byte[buf.limit()]; System.arraycopy(buf.array(), 0, valueBytes, 0, buf.limit()); RowValueDecoder rowValueDecoder = new RowValueDecoder(hbaseCol); for (MeasureDesc measure : cubeDesc.getMeasures()) { FunctionDesc aggrFunc = measure.getFunction(); int index = hbaseCol.findMeasureIndex(aggrFunc); rowValueDecoder.setIndex(index); } rowValueDecoder.decode(valueBytes); List<String> measureNames = rowValueDecoder.getNames(); Object[] measureValues = rowValueDecoder.getValues(); assertEquals("[PRICE, MIN_PRICE_, MAX_PRICE_, COUNT__]", measureNames.toString()); assertEquals("[333.1234567, 333.1111111, 333.1999999, 2]", Arrays.toString(measureValues)); }
public void decode(byte[] bytes) { codec.decode(ByteBuffer.wrap(bytes), values); convertToJavaObjects(values, values); }
RowValueDecoder implements Cloneable { public void decode(byte[] bytes) { codec.decode(ByteBuffer.wrap(bytes), values); convertToJavaObjects(values, values); } }
RowValueDecoder implements Cloneable { public void decode(byte[] bytes) { codec.decode(ByteBuffer.wrap(bytes), values); convertToJavaObjects(values, values); } RowValueDecoder(RowValueDecoder rowValueDecoder);  RowValueDecoder(HBaseColumnDesc hbaseColumn); }
RowValueDecoder implements Cloneable { public void decode(byte[] bytes) { codec.decode(ByteBuffer.wrap(bytes), values); convertToJavaObjects(values, values); } RowValueDecoder(RowValueDecoder rowValueDecoder);  RowValueDecoder(HBaseColumnDesc hbaseColumn); void decode(byte[] bytes); void setIndex(int bitIndex); HBaseColumnDesc getHBaseColumn(); BitSet getProjectionIndex(); Object[] getValues(); List<String> getNames(); MeasureDesc[] getMeasures(); boolean hasMemHungryCountDistinct(); static boolean hasMemHungryCountDistinct(Collection<RowValueDecoder> rowValueDecoders); }
RowValueDecoder implements Cloneable { public void decode(byte[] bytes) { codec.decode(ByteBuffer.wrap(bytes), values); convertToJavaObjects(values, values); } RowValueDecoder(RowValueDecoder rowValueDecoder);  RowValueDecoder(HBaseColumnDesc hbaseColumn); void decode(byte[] bytes); void setIndex(int bitIndex); HBaseColumnDesc getHBaseColumn(); BitSet getProjectionIndex(); Object[] getValues(); List<String> getNames(); MeasureDesc[] getMeasures(); boolean hasMemHungryCountDistinct(); static boolean hasMemHungryCountDistinct(Collection<RowValueDecoder> rowValueDecoders);  }