Java Code Examples for org.apache.kylin.cube.CubeSegment#setCuboidShardNums()
The following examples show how to use
org.apache.kylin.cube.CubeSegment#setCuboidShardNums() .
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: CuboidShardUtil.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public static void saveCuboidShards(CubeSegment segment, Map<Long, Short> cuboidShards, int totalShards) throws IOException { CubeManager cubeManager = CubeManager.getInstance(segment.getConfig()); Map<Long, Short> filtered = Maps.newHashMap(); for (Map.Entry<Long, Short> entry : cuboidShards.entrySet()) { if (entry.getValue() > 1) { filtered.put(entry.getKey(), entry.getValue()); } } // work on copy instead of cached objects CubeInstance cubeCopy = segment.getCubeInstance().latestCopyForWrite(); CubeSegment segCopy = cubeCopy.getSegmentById(segment.getUuid()); segCopy.setCuboidShardNums(filtered); segCopy.setTotalShards(totalShards); CubeUpdate update = new CubeUpdate(cubeCopy); update.setToUpdateSegs(segCopy); cubeManager.updateCube(update); }
Example 2
Source File: CubeBuildJob.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private void updateSegmentInfo(String cubeId, SegmentInfo segmentInfo, long sourceRowCount) throws IOException { CubeInstance cubeInstance = cubeManager.getCubeByUuid(cubeId); CubeInstance cubeCopy = cubeInstance.latestCopyForWrite(); CubeUpdate update = new CubeUpdate(cubeCopy); List<CubeSegment> cubeSegments = Lists.newArrayList(); CubeSegment segment = cubeCopy.getSegmentById(segmentInfo.id()); segment.setSizeKB(segmentInfo.getAllLayoutSize() / 1024); segment.setLastBuildTime(System.currentTimeMillis()); segment.setLastBuildJobID(getParam(MetadataConstants.P_JOB_ID)); segment.setInputRecords(sourceRowCount); segment.setSnapshots(new ConcurrentHashMap<>(segmentInfo.getSnapShot2JavaMap())); segment.setCuboidShardNums(cuboidShardNum); Map<String, String> additionalInfo = segment.getAdditionalInfo(); additionalInfo.put("storageType", "" + IStorageAware.ID_PARQUET); segment.setAdditionalInfo(additionalInfo); cubeSegments.add(segment); update.setToUpdateSegs(cubeSegments.toArray(new CubeSegment[0])); cubeManager.updateCube(update); }
Example 3
Source File: CuboidShardUtil.java From kylin with Apache License 2.0 | 6 votes |
public static void saveCuboidShards(CubeSegment segment, Map<Long, Short> cuboidShards, int totalShards) throws IOException { CubeManager cubeManager = CubeManager.getInstance(segment.getConfig()); Map<Long, Short> filtered = Maps.newHashMap(); for (Map.Entry<Long, Short> entry : cuboidShards.entrySet()) { if (entry.getValue() > 1) { filtered.put(entry.getKey(), entry.getValue()); } } // work on copy instead of cached objects CubeInstance cubeCopy = segment.getCubeInstance().latestCopyForWrite(); CubeSegment segCopy = cubeCopy.getSegmentById(segment.getUuid()); segCopy.setCuboidShardNums(filtered); segCopy.setTotalShards(totalShards); CubeUpdate update = new CubeUpdate(cubeCopy); update.setToUpdateSegs(segCopy); cubeManager.updateCube(update); }