nichunen commented on a change in pull request #752: KYLIN-4091 support fast mode and simple mode for running CI URL: https://github.com/apache/kylin/pull/752#discussion_r308668535
########## File path: kylin-it/src/test/java/org/apache/kylin/provision/BuildCubeWithEngine.java ########## @@ -484,40 +555,56 @@ private void checkHFilesInHBase(CubeSegment segment) throws IOException { } } - private void checkEmptySegRangeInfo(CubeInstance cube) { - CubeSegment segment = getLastModifiedSegment(cube); - for (String colId : segment.getDimensionRangeInfoMap().keySet()) { - DimensionRangeInfo range = segment.getDimensionRangeInfoMap().get(colId); - if (!(range.getMax() == null && range.getMin() == null)) { - throw new RuntimeException("Empty segment must have null info."); + private void checkEmptySegRangeInfo(CubeSegment segment) { + if (segment != null) { + segment = cubeManager.getCube(segment.getCubeDesc().getName()).getSegmentById(segment.getUuid()); + for (String colId : segment.getDimensionRangeInfoMap().keySet()) { + DimensionRangeInfo range = segment.getDimensionRangeInfoMap().get(colId); + if (!(range.getMax() == null && range.getMin() == null)) { + throw new RuntimeException("Empty segment must have null info."); + } } } } - - private void checkNormalSegRangeInfo(CubeInstance cube) { + private void checkEmptySegRangeInfo(CubeInstance cube) { CubeSegment segment = getLastModifiedSegment(cube); - if (segment.getModel().getPartitionDesc().isPartitioned()) { + checkEmptySegRangeInfo(segment); + } + + private void checkNormalSegRangeInfo(CubeSegment segment) throws IOException { + if (segment != null && segment.getModel().getPartitionDesc().isPartitioned()) { + segment = cubeManager.getCube(segment.getCubeDesc().getName()).getSegmentById(segment.getUuid()); TblColRef colRef = segment.getModel().getPartitionDesc().getPartitionDateColumnRef(); DimensionRangeInfo dmRangeInfo = segment.getDimensionRangeInfoMap().get(colRef.getIdentity()); - long min_v = DateFormat.stringToMillis(dmRangeInfo.getMin()); - long max_v = DateFormat.stringToMillis(dmRangeInfo.getMax()); - long ts_range_start = segment.getTSRange().start.v; - long ts_range_end = segment.getTSRange().end.v; - if (!(ts_range_start <= min_v && max_v <= ts_range_end - 1)) { - throw new RuntimeException(String.format(Locale.ROOT, - "Build cube failed, wrong partition column min/max value." - + " Segment: %s, min value: %s, TsRange.start: %s, max value: %s, TsRange.end: %s", - segment, min_v, ts_range_start, max_v, ts_range_end)); + if (dmRangeInfo != null) { + long min_v = DateFormat.stringToMillis(dmRangeInfo.getMin()); + long max_v = DateFormat.stringToMillis(dmRangeInfo.getMax()); + long ts_range_start = segment.getTSRange().start.v; + long ts_range_end = segment.getTSRange().end.v; + if (!(ts_range_start <= min_v && max_v <= ts_range_end - 1)) { + throw new RuntimeException(String.format(Locale.ROOT, + "Build cube failed, wrong partition column min/max value." + + " Segment: %s, min value: %s, TsRange.start: %s, max value: %s, TsRange.end: %s", + segment, min_v, ts_range_start, max_v, ts_range_end)); + } } } } + private void checkNormalSegRangeInfo(CubeInstance cube) throws IOException { + CubeSegment segment = getLastModifiedSegment(cube); + checkNormalSegRangeInfo(segment); + } private CubeSegment getLastModifiedSegment(CubeInstance cube) { - return Collections.max(cube.getSegments(), new Comparator<CubeSegment>() { - @Override - public int compare(CubeSegment o1, CubeSegment o2) { - return Long.compare(o1.getLastBuildTime(), o2.getLastBuildTime()); - } - }); + Segments segments = cube.getSegments(); + if (segments.size()>0) { Review comment: Seems not formatted ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services