@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]; BufferedMeasureCodec codec = new BufferedMeasureCodec(hbaseCol.getMeasures()); BigDecimal sum = new BigDecimal("333.1234567"); BigDecimal min = new BigDecimal("333.1111111"); BigDecimal max = new BigDecimal("333.1999999"); Long count = new Long(2); Long item_count = new Long(100); ByteBuffer buf = codec.encode(new Object[] { sum, min, max, count, item_count }); 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.findMeasure(aggrFunc); rowValueDecoder.setProjectIndex(index); } rowValueDecoder.decodeAndConvertJavaObj(valueBytes); Object[] measureValues = rowValueDecoder.getValues(); assertEquals("[333.1235, 333.1111, 333.2000, 2, 100]", Arrays.toString(measureValues)); }
public void decode(Result hbaseRow) { decode(hbaseRow, false); }
RowValueDecoder implements Cloneable { public void decode(Result hbaseRow) { decode(hbaseRow, false); } }
RowValueDecoder implements Cloneable { public void decode(Result hbaseRow) { decode(hbaseRow, false); } RowValueDecoder(HBaseColumnDesc hbaseColumn); }
RowValueDecoder implements Cloneable { public void decode(Result hbaseRow) { decode(hbaseRow, false); } RowValueDecoder(HBaseColumnDesc hbaseColumn); void decodeAndConvertJavaObj(Result hbaseRow); void decode(Result hbaseRow); void decodeAndConvertJavaObj(byte[] bytes); void decode(byte[] bytes); void setProjectIndex(int bitIndex); BitSet getProjectionIndex(); HBaseColumnDesc getHBaseColumn(); Object[] getValues(); MeasureDesc[] getMeasures(); void loadCubeMeasureArray(Object[] result); boolean hasMemHungryMeasures(); static boolean hasMemHungryMeasures(Collection<RowValueDecoder> rowValueDecoders); }
RowValueDecoder implements Cloneable { public void decode(Result hbaseRow) { decode(hbaseRow, false); } RowValueDecoder(HBaseColumnDesc hbaseColumn); void decodeAndConvertJavaObj(Result hbaseRow); void decode(Result hbaseRow); void decodeAndConvertJavaObj(byte[] bytes); void decode(byte[] bytes); void setProjectIndex(int bitIndex); BitSet getProjectionIndex(); HBaseColumnDesc getHBaseColumn(); Object[] getValues(); MeasureDesc[] getMeasures(); void loadCubeMeasureArray(Object[] result); boolean hasMemHungryMeasures(); static boolean hasMemHungryMeasures(Collection<RowValueDecoder> rowValueDecoders);  }