CubeSegment appendSegment(CubeInstance cube, TSRange tsRange, SegmentRange segRange, Map<Integer, Long> sourcePartitionOffsetStart, Map<Integer, Long> sourcePartitionOffsetEnd) throws IOException { CubeInstance cubeCopy = cube.latestCopyForWrite(); // get a latest copy checkInputRanges(tsRange, segRange); // fix start/end a bit if (cubeCopy.getModel().getPartitionDesc().isPartitioned()) { // if missing start, set it to where last time ends if (tsRange != null && tsRange.start.v == 0) { CubeDesc cubeDesc = cubeCopy.getDescriptor(); CubeSegment last = cubeCopy.getLastSegment(); if (last == null) tsRange = new TSRange(cubeDesc.getPartitionDateStart(), tsRange.end.v); else if (!last.isOffsetCube()) tsRange = new TSRange(last.getTSRange().end.v, tsRange.end.v); } } else { // full build tsRange = null; segRange = null; } CubeSegment newSegment = newSegment(cubeCopy, tsRange, segRange); newSegment.setSourcePartitionOffsetStart(sourcePartitionOffsetStart); newSegment.setSourcePartitionOffsetEnd(sourcePartitionOffsetEnd); validateNewSegments(cubeCopy, newSegment); CubeUpdate update = new CubeUpdate(cubeCopy); update.setToAddSegs(newSegment); updateCube(update); return newSegment; }
public CubeInstanceResponse(CubeInstance cube, String project) { this.project = project; if (cube == null) return; setUuid(cube.getUuid()); setVersion(cube.getVersion()); setName(cube.getName()); setOwner(cube.getOwner()); setDescName(cube.getDescName()); setCost(cube.getCost()); setStatus(cube.getStatus()); setSegments(cube.getSegments()); setCreateTimeUTC(cube.getCreateTimeUTC()); setLastModified(cube.getDescriptor().getLastModified()); setCuboidLastOptimized(cube.getCuboidLastOptimized()); this.model = cube.getDescriptor().getModelName(); this.partitionDateStart = cube.getDescriptor().getPartitionDateStart(); // cuz model doesn't have a state to label a model is broken, // so in some case the model can not be loaded due to some check failed, // but the cube in this model can still be loaded. if (cube.getModel() != null) { this.partitionDateColumn = cube.getModel().getPartitionDesc().getPartitionDateColumn(); this.isStandardPartitioned = cube.getModel().isStandardPartitionedDateColumn(); this.isStreaming = cube.getModel().getRootFactTable().getTableDesc() .getSourceType() == ISourceAware.ID_STREAMING; } initSizeKB(); initInputRecordCount(); initInputRecordSizeBytes(); }
newCubeDesc.setStatusNeedNotify(cubeDesc.getStatusNeedNotify()); newCubeDesc.setAutoMergeTimeRanges(cubeDesc.getAutoMergeTimeRanges()); newCubeDesc.setPartitionDateStart(cubeDesc.getPartitionDateStart()); newCubeDesc.setPartitionDateEnd(cubeDesc.getPartitionDateEnd()); newCubeDesc.setVolatileRange(cubeDesc.getVolatileRange());
CubeSegment appendSegment(CubeInstance cube, TSRange tsRange, SegmentRange segRange, Map<Integer, Long> sourcePartitionOffsetStart, Map<Integer, Long> sourcePartitionOffsetEnd) throws IOException { CubeInstance cubeCopy = cube.latestCopyForWrite(); // get a latest copy checkInputRanges(tsRange, segRange); // fix start/end a bit if (cubeCopy.getModel().getPartitionDesc().isPartitioned()) { // if missing start, set it to where last time ends if (tsRange != null && tsRange.start.v == 0) { CubeDesc cubeDesc = cubeCopy.getDescriptor(); CubeSegment last = cubeCopy.getLastSegment(); if (last == null) tsRange = new TSRange(cubeDesc.getPartitionDateStart(), tsRange.end.v); else if (!last.isOffsetCube()) tsRange = new TSRange(last.getTSRange().end.v, tsRange.end.v); } } else { // full build tsRange = null; segRange = null; } CubeSegment newSegment = newSegment(cubeCopy, tsRange, segRange); newSegment.setSourcePartitionOffsetStart(sourcePartitionOffsetStart); newSegment.setSourcePartitionOffsetEnd(sourcePartitionOffsetEnd); validateNewSegments(cubeCopy, newSegment); CubeUpdate update = new CubeUpdate(cubeCopy); update.setToAddSegs(newSegment); updateCube(update); return newSegment; }
newCubeDesc.setStatusNeedNotify(cubeDesc.getStatusNeedNotify()); newCubeDesc.setAutoMergeTimeRanges(cubeDesc.getAutoMergeTimeRanges()); newCubeDesc.setPartitionDateStart(cubeDesc.getPartitionDateStart()); newCubeDesc.setPartitionDateEnd(cubeDesc.getPartitionDateEnd()); newCubeDesc.setVolatileRange(cubeDesc.getVolatileRange());