This is an automated email from the ASF dual-hosted git repository.
xxyu pushed a commit to branch kylin-on-parquet-v2
in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/kylin-on-parquet-v2 by this
push:
new 2ad58c7 KYLIN-4872 Fix NPE when there are more than one segment if
cube planner is open
2ad58c7 is described below
commit 2ad58c712ea1cb8ca7a3494eb30a7d1a69f212a2
Author: Zhichao Zhang <[email protected]>
AuthorDate: Thu Jan 14 17:23:33 2021 +0800
KYLIN-4872 Fix NPE when there are more than one segment if cube planner is
open
---
.../kylin/engine/mr/common/CubeStatsReader.java | 37 ++++++++++++++--------
webapp/app/js/controllers/cube.js | 4 +--
2 files changed, 25 insertions(+), 16 deletions(-)
diff --git
a/build-engine/src/main/java/org/apache/kylin/engine/mr/common/CubeStatsReader.java
b/build-engine/src/main/java/org/apache/kylin/engine/mr/common/CubeStatsReader.java
index 3f804dd..353e7f4 100644
---
a/build-engine/src/main/java/org/apache/kylin/engine/mr/common/CubeStatsReader.java
+++
b/build-engine/src/main/java/org/apache/kylin/engine/mr/common/CubeStatsReader.java
@@ -96,26 +96,32 @@ public class CubeStatsReader {
*/
public CubeStatsReader(CubeSegment cubeSegment, CuboidScheduler
cuboidScheduler, KylinConfig kylinConfig)
throws IOException {
+ this.seg = cubeSegment;
+ this.cuboidScheduler = cuboidScheduler;
ResourceStore store = ResourceStore.getStore(kylinConfig);
String statsKey = cubeSegment.getStatisticsResourcePath();
RawResource resource = store.getResource(statsKey);
- if (resource == null) {
+ if (resource != null) {
+ File tmpSeqFile = writeTmpSeqFile(resource.content());
+ Path path = new Path(HadoopUtil.fixWindowsPath("file://" +
tmpSeqFile.getAbsolutePath()));
+ logger.info("Reading statistics from {}", path);
+ CubeStatsResult cubeStatsResult = new CubeStatsResult(path,
kylinConfig.getCubeStatsHLLPrecision());
+ tmpSeqFile.delete();
+
+ this.samplingPercentage = cubeStatsResult.getPercentage();
+ this.mapperNumberOfFirstBuild = cubeStatsResult.getMapperNumber();
+ this.mapperOverlapRatioOfFirstBuild =
cubeStatsResult.getMapperOverlapRatio();
+ this.cuboidRowEstimatesHLL = cubeStatsResult.getCounterMap();
+ this.sourceRowCount = cubeStatsResult.getSourceRecordCount();
+ } else {
// throw new IllegalStateException("Missing resource at " +
statsKey);
logger.warn("{} is not exists.", statsKey);
+ this.samplingPercentage = -1;
+ this.mapperNumberOfFirstBuild = -1;
+ this.mapperOverlapRatioOfFirstBuild = -1.0;
+ this.cuboidRowEstimatesHLL = null;
+ this.sourceRowCount = -1L;
}
- File tmpSeqFile = writeTmpSeqFile(resource.content());
- Path path = new Path(HadoopUtil.fixWindowsPath("file://" +
tmpSeqFile.getAbsolutePath()));
- logger.info("Reading statistics from {}", path);
- CubeStatsResult cubeStatsResult = new CubeStatsResult(path,
kylinConfig.getCubeStatsHLLPrecision());
- tmpSeqFile.delete();
-
- this.seg = cubeSegment;
- this.cuboidScheduler = cuboidScheduler;
- this.samplingPercentage = cubeStatsResult.getPercentage();
- this.mapperNumberOfFirstBuild = cubeStatsResult.getMapperNumber();
- this.mapperOverlapRatioOfFirstBuild =
cubeStatsResult.getMapperOverlapRatio();
- this.cuboidRowEstimatesHLL = cubeStatsResult.getCounterMap();
- this.sourceRowCount = cubeStatsResult.getSourceRecordCount();
}
/**
@@ -167,6 +173,9 @@ public class CubeStatsReader {
}
public Map<Long, Long> getCuboidRowEstimatesHLL() {
+ if (cuboidRowEstimatesHLL == null) {
+ return null;
+ }
return getCuboidRowCountMapFromSampling(cuboidRowEstimatesHLL,
samplingPercentage);
}
diff --git a/webapp/app/js/controllers/cube.js
b/webapp/app/js/controllers/cube.js
index 60df772..32df70f 100755
--- a/webapp/app/js/controllers/cube.js
+++ b/webapp/app/js/controllers/cube.js
@@ -239,7 +239,7 @@ KylinApp.controller('CubeCtrl', function ($scope,
$rootScope, AccessService, Mes
};
$scope.currentOptions.chart.sunburst = getSunburstDispatch();
$scope.currentOptions.title.text = 'Current Cuboid Distribution';
- $scope.currentOptions.subtitle.text = '[Cuboid Count: ' +
data.nodeInfos.length + '] [Row Count: ' + data.totalRowCount + ']';
+ $scope.currentOptions.subtitle.text = '[Cuboid Count: ' +
data.nodeInfos.length + '] [The Row Count of The First Segment: ' +
data.totalRowCount + ']';
} else if ('recommend' === type) {
$scope.recommendData = [chartData];
$scope.recommendOptions =
angular.copy(cubeConfig.baseChartOptions);
@@ -258,7 +258,7 @@ KylinApp.controller('CubeCtrl', function ($scope,
$rootScope, AccessService, Mes
};
$scope.recommendOptions.chart.sunburst = getSunburstDispatch();
$scope.recommendOptions.title.text = 'Recommend Cuboid
Distribution';
- $scope.recommendOptions.subtitle.text = '[Cuboid Count: ' +
data.nodeInfos.length + '] [Row Count: ' + data.totalRowCount + ']';
+ $scope.recommendOptions.subtitle.text = '[Cuboid Count: ' +
data.nodeInfos.length + '] [The Row Count of The First Segment: ' +
data.totalRowCount + ']';
}
};