Java Code Examples for org.apache.kylin.cube.CubeSegment#getDimensionEncodingMap()
The following examples show how to use
org.apache.kylin.cube.CubeSegment#getDimensionEncodingMap() .
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: CubeStatsReader.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private static Map<Long, Double> getCuboidSizeMapFromRowCount(CubeSegment cubeSegment, Map<Long, Long> rowCountMap, long sourceRowCount, boolean origin) { final CubeDesc cubeDesc = cubeSegment.getCubeDesc(); final List<Integer> rowkeyColumnSize = Lists.newArrayList(); final Cuboid baseCuboid = Cuboid.getBaseCuboid(cubeDesc); final List<TblColRef> columnList = baseCuboid.getColumns(); final CubeDimEncMap dimEncMap = cubeSegment.getDimensionEncodingMap(); final Long baseCuboidRowCount = rowCountMap.get(baseCuboid.getId()); for (int i = 0; i < columnList.size(); i++) { rowkeyColumnSize.add(dimEncMap.get(columnList.get(i)).getLengthOfEncoding()); } Map<Long, Double> sizeMap = Maps.newHashMap(); for (Map.Entry<Long, Long> entry : rowCountMap.entrySet()) { sizeMap.put(entry.getKey(), estimateCuboidStorageSize(cubeSegment, entry.getKey(), entry.getValue(), baseCuboid.getId(), baseCuboidRowCount, rowkeyColumnSize, sourceRowCount)); } if (origin == false && cubeSegment.getConfig().enableJobCuboidSizeOptimize()) { optimizeSizeMap(sizeMap, cubeSegment); } return sizeMap; }
Example 2
Source File: RowKeyEncoder.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public RowKeyEncoder(CubeSegment cubeSeg, Cuboid cuboid) { super(cubeSeg, cuboid); enableSharding = cubeSeg.isEnableSharding(); headerLength = cubeSeg.getRowKeyPreambleSize(); Set<TblColRef> shardByColumns = cubeSeg.getCubeDesc().getShardByColumns(); if (shardByColumns.size() > 1) { throw new IllegalStateException("Does not support multiple UHC now"); } colIO = new RowKeyColumnIO(cubeSeg.getDimensionEncodingMap()); for (TblColRef column : cuboid.getColumns()) { if (shardByColumns.contains(column)) { uhcOffset = bodyLength; uhcLength = colIO.getColumnLength(column); } bodyLength += colIO.getColumnLength(column); } }
Example 3
Source File: CubeStatsReader.java From kylin with Apache License 2.0 | 6 votes |
private static Map<Long, Double> getCuboidSizeMapFromRowCount(CubeSegment cubeSegment, Map<Long, Long> rowCountMap, long sourceRowCount, boolean origin) { final CubeDesc cubeDesc = cubeSegment.getCubeDesc(); final List<Integer> rowkeyColumnSize = Lists.newArrayList(); final Cuboid baseCuboid = Cuboid.getBaseCuboid(cubeDesc); final List<TblColRef> columnList = baseCuboid.getColumns(); final CubeDimEncMap dimEncMap = cubeSegment.getDimensionEncodingMap(); final Long baseCuboidRowCount = rowCountMap.get(baseCuboid.getId()); for (int i = 0; i < columnList.size(); i++) { rowkeyColumnSize.add(dimEncMap.get(columnList.get(i)).getLengthOfEncoding()); } Map<Long, Double> sizeMap = Maps.newHashMap(); for (Map.Entry<Long, Long> entry : rowCountMap.entrySet()) { sizeMap.put(entry.getKey(), estimateCuboidStorageSize(cubeSegment, entry.getKey(), entry.getValue(), baseCuboid.getId(), baseCuboidRowCount, rowkeyColumnSize, sourceRowCount)); } if (origin == false && cubeSegment.getConfig().enableJobCuboidSizeOptimize()) { optimizeSizeMap(sizeMap, cubeSegment); } return sizeMap; }
Example 4
Source File: RowKeyEncoder.java From kylin with Apache License 2.0 | 6 votes |
public RowKeyEncoder(CubeSegment cubeSeg, Cuboid cuboid) { super(cubeSeg, cuboid); enableSharding = cubeSeg.isEnableSharding(); headerLength = cubeSeg.getRowKeyPreambleSize(); Set<TblColRef> shardByColumns = cubeSeg.getCubeDesc().getShardByColumns(); if (shardByColumns.size() > 1) { throw new IllegalStateException("Does not support multiple UHC now"); } colIO = new RowKeyColumnIO(cubeSeg.getDimensionEncodingMap()); for (TblColRef column : cuboid.getColumns()) { if (shardByColumns.contains(column)) { uhcOffset = bodyLength; uhcLength = colIO.getColumnLength(column); } bodyLength += colIO.getColumnLength(column); } }
Example 5
Source File: CoprocessorRowType.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public static CoprocessorRowType fromCuboid(CubeSegment seg, Cuboid cuboid) { List<TblColRef> colList = cuboid.getColumns(); TblColRef[] cols = colList.toArray(new TblColRef[colList.size()]); RowKeyColumnIO colIO = new RowKeyColumnIO(seg.getDimensionEncodingMap()); int[] colSizes = new int[cols.length]; for (int i = 0; i < cols.length; i++) { colSizes[i] = colIO.getColumnLength(cols[i]); } return new CoprocessorRowType(cols, colSizes, seg.getRowKeyPreambleSize()); }
Example 6
Source File: CoprocessorRowType.java From kylin with Apache License 2.0 | 5 votes |
public static CoprocessorRowType fromCuboid(CubeSegment seg, Cuboid cuboid) { List<TblColRef> colList = cuboid.getColumns(); TblColRef[] cols = colList.toArray(new TblColRef[colList.size()]); RowKeyColumnIO colIO = new RowKeyColumnIO(seg.getDimensionEncodingMap()); int[] colSizes = new int[cols.length]; for (int i = 0; i < cols.length; i++) { colSizes[i] = colIO.getColumnLength(cols[i]); } return new CoprocessorRowType(cols, colSizes, seg.getRowKeyPreambleSize()); }
Example 7
Source File: RowKeyDecoder.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
public RowKeyDecoder(CubeSegment cubeSegment) { this.cubeDesc = cubeSegment.getCubeDesc(); this.rowKeySplitter = new RowKeySplitter(cubeSegment); this.colIO = new RowKeyColumnIO(cubeSegment.getDimensionEncodingMap()); this.values = new ArrayList<String>(); }
Example 8
Source File: RowKeyDecoder.java From kylin with Apache License 2.0 | 4 votes |
public RowKeyDecoder(CubeSegment cubeSegment) { this.cubeDesc = cubeSegment.getCubeDesc(); this.rowKeySplitter = new RowKeySplitter(cubeSegment); this.colIO = new RowKeyColumnIO(cubeSegment.getDimensionEncodingMap()); this.values = new ArrayList<String>(); }