Java Code Examples for org.apache.kylin.cube.CubeInstance#getCuboidsByMode()
The following examples show how to use
org.apache.kylin.cube.CubeInstance#getCuboidsByMode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CalculateStatsFromBaseCuboidMapper.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
@Override protected void doSetup(Context context) throws IOException { Configuration conf = context.getConfiguration(); HadoopUtil.setCurrentConfiguration(conf); KylinConfig config = AbstractHadoopJob.loadKylinPropsAndMetadata(); String cubeName = conf.get(BatchConstants.CFG_CUBE_NAME); CubeInstance cube = CubeManager.getInstance(config).getCube(cubeName); CubeDesc cubeDesc = cube.getDescriptor(); CubeSegment cubeSegment = cube.getSegmentById(conf.get(BatchConstants.CFG_CUBE_SEGMENT_ID)); baseCuboidId = cube.getCuboidScheduler().getBaseCuboidId(); nRowKey = cubeDesc.getRowkey().getRowKeyColumns().length; String cuboidModeName = conf.get(BatchConstants.CFG_CUBOID_MODE); Set<Long> cuboidIdSet = cube.getCuboidsByMode(cuboidModeName); cuboidIds = cuboidIdSet.toArray(new Long[cuboidIdSet.size()]); allCuboidsBitSet = CuboidUtil.getCuboidBitSet(cuboidIds, nRowKey); samplingPercentage = Integer .parseInt(context.getConfiguration().get(BatchConstants.CFG_STATISTICS_SAMPLING_PERCENT)); allCuboidsHLL = new HLLCounter[cuboidIds.length]; for (int i = 0; i < cuboidIds.length; i++) { allCuboidsHLL[i] = new HLLCounter(cubeDesc.getConfig().getCubeStatsHLLPrecision()); } //for KYLIN-2518 backward compatibility if (KylinVersion.isBefore200(cubeDesc.getVersion())) { isUsePutRowKeyToHllNewAlgorithm = false; hf = Hashing.murmur3_32(); logger.info("Found KylinVersion : {}. Use old algorithm for cuboid sampling.", cubeDesc.getVersion()); } else { isUsePutRowKeyToHllNewAlgorithm = true; rowHashCodesLong = new long[nRowKey]; hf = Hashing.murmur3_128(); logger.info( "Found KylinVersion : {}. Use new algorithm for cuboid sampling. About the details of the new algorithm, please refer to KYLIN-2518", cubeDesc.getVersion()); } rowKeyDecoder = new RowKeyDecoder(cubeSegment); }
Example 2
Source File: CalculateStatsFromBaseCuboidMapper.java From kylin with Apache License 2.0 | 4 votes |
@Override protected void doSetup(Context context) throws IOException { Configuration conf = context.getConfiguration(); HadoopUtil.setCurrentConfiguration(conf); KylinConfig config = AbstractHadoopJob.loadKylinPropsAndMetadata(); String cubeName = conf.get(BatchConstants.CFG_CUBE_NAME); CubeInstance cube = CubeManager.getInstance(config).getCube(cubeName); CubeDesc cubeDesc = cube.getDescriptor(); CubeSegment cubeSegment = cube.getSegmentById(conf.get(BatchConstants.CFG_CUBE_SEGMENT_ID)); baseCuboidId = cube.getCuboidScheduler().getBaseCuboidId(); nRowKey = cubeDesc.getRowkey().getRowKeyColumns().length; String cuboidModeName = conf.get(BatchConstants.CFG_CUBOID_MODE); Set<Long> cuboidIdSet = cube.getCuboidsByMode(cuboidModeName); cuboidIds = cuboidIdSet.toArray(new Long[cuboidIdSet.size()]); allCuboidsBitSet = CuboidUtil.getCuboidBitSet(cuboidIds, nRowKey); samplingPercentage = Integer .parseInt(context.getConfiguration().get(BatchConstants.CFG_STATISTICS_SAMPLING_PERCENT)); allCuboidsHLL = new HLLCounter[cuboidIds.length]; for (int i = 0; i < cuboidIds.length; i++) { allCuboidsHLL[i] = new HLLCounter(cubeDesc.getConfig().getCubeStatsHLLPrecision()); } //for KYLIN-2518 backward compatibility if (KylinVersion.isBefore200(cubeDesc.getVersion())) { isUsePutRowKeyToHllNewAlgorithm = false; hf = Hashing.murmur3_32(); logger.info("Found KylinVersion : {}. Use old algorithm for cuboid sampling.", cubeDesc.getVersion()); } else { isUsePutRowKeyToHllNewAlgorithm = true; rowHashCodesLong = new long[nRowKey]; hf = Hashing.murmur3_128(); logger.info( "Found KylinVersion : {}. Use new algorithm for cuboid sampling. About the details of the new algorithm, please refer to KYLIN-2518", cubeDesc.getVersion()); } rowKeyDecoder = new RowKeyDecoder(cubeSegment); }