This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/master by this push:
new d3235e7 KYLIN-3597 fix sonar issues
d3235e7 is described below
commit d3235e7b1fa4d95b56d79ebee00dcfee67af53b4
Author: whuwb <[email protected]>
AuthorDate: Wed Jan 23 14:27:42 2019 +0800
KYLIN-3597 fix sonar issues
---
.../cube/cuboid/algorithm/CuboidRecommender.java | 19 +++++++------------
.../kylin/engine/mr/common/CuboidRecommenderUtil.java | 7 ++++---
.../kylin/engine/mr/steps/SaveStatisticsStep.java | 6 +++---
3 files changed, 14 insertions(+), 18 deletions(-)
diff --git
a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/algorithm/CuboidRecommender.java
b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/algorithm/CuboidRecommender.java
index 0e6a844..54206e8 100644
---
a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/algorithm/CuboidRecommender.java
+++
b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/algorithm/CuboidRecommender.java
@@ -35,20 +35,15 @@ import org.slf4j.LoggerFactory;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.RemovalListener;
-import com.google.common.cache.RemovalNotification;
import com.google.common.collect.Maps;
public class CuboidRecommender {
private static final Logger logger =
LoggerFactory.getLogger(CuboidRecommender.class);
private static Cache<String, Map<Long, Long>> cuboidRecommendCache =
CacheBuilder.newBuilder()
- .removalListener(new RemovalListener<String, Map<Long, Long>>() {
- @Override
- public void onRemoval(RemovalNotification<String, Map<Long,
Long>> notification) {
- logger.info("Recommended cuboids for cube " +
notification.getKey() + " is removed due to "
- + notification.getCause());
- }
+ .removalListener((notification) -> {
+ logger.info("Recommended cuboids for cube " +
notification.getKey() + " is removed due to "
+ + notification.getCause());
}).maximumSize(KylinConfig.getInstanceFromEnv().getCubePlannerRecommendCuboidCacheMaxSize())
.expireAfterWrite(1, TimeUnit.DAYS).build();
@@ -143,13 +138,13 @@ public class CuboidRecommender {
}
long startTime = System.currentTimeMillis();
- logger.info("Cube Planner Algorithm started at " + startTime);
+ logger.info("Cube Planner Algorithm started at {}", startTime);
List<Long> recommendCuboidList =
algorithm.recommend(kylinConf.getCubePlannerExpansionRateThreshold());
- logger.info("Cube Planner Algorithm ended at " +
(System.currentTimeMillis() - startTime));
+ logger.info("Cube Planner Algorithm ended at {}",
System.currentTimeMillis() - startTime);
if (recommendCuboidList.size() < allCuboidCount) {
- logger.info("Cube Planner Algorithm chooses " +
recommendCuboidList.size()
- + " most effective cuboids to build among of all " +
allCuboidCount + " cuboids.");
+ logger.info("Cube Planner Algorithm chooses {} most effective
cuboids to build among of all {} cuboids.",
+ recommendCuboidList.size(), allCuboidCount);
}
Map<Long, Long> recommendCuboidsWithStats = Maps.newLinkedHashMap();
diff --git
a/engine-mr/src/main/java/org/apache/kylin/engine/mr/common/CuboidRecommenderUtil.java
b/engine-mr/src/main/java/org/apache/kylin/engine/mr/common/CuboidRecommenderUtil.java
index 2bffe86..75d4c91 100644
---
a/engine-mr/src/main/java/org/apache/kylin/engine/mr/common/CuboidRecommenderUtil.java
+++
b/engine-mr/src/main/java/org/apache/kylin/engine/mr/common/CuboidRecommenderUtil.java
@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
public class CuboidRecommenderUtil {
private static final Logger logger =
LoggerFactory.getLogger(CuboidRecommenderUtil.class);
+ private static final String BASE_CUBOID_COUNT_IN_CUBOID_STATISTICS_IS_ZERO
= "Base cuboid count in cuboid statistics is 0.";
/** Trigger cube planner phase one */
public static Map<Long, Long> getRecommendCuboidList(CubeSegment segment)
throws IOException {
@@ -52,7 +53,7 @@ public class CuboidRecommenderUtil {
long baseCuboid = cube.getCuboidScheduler().getBaseCuboidId();
if (cubeStatsReader.getCuboidRowEstimatesHLL().get(baseCuboid) == null
|| cubeStatsReader.getCuboidRowEstimatesHLL().get(baseCuboid)
== 0L) {
- logger.info("Base cuboid count in cuboid statistics is 0.");
+ logger.info(BASE_CUBOID_COUNT_IN_CUBOID_STATISTICS_IS_ZERO);
return null;
}
@@ -75,7 +76,7 @@ public class CuboidRecommenderUtil {
.readCuboidStatsAndSizeFromCube(currentCuboids, cube);
long baseCuboid = cuboidScheduler.getBaseCuboidId();
if (statsPair.getFirst().get(baseCuboid) == null ||
statsPair.getFirst().get(baseCuboid) == 0L) {
- logger.info("Base cuboid count in cuboid statistics is 0.");
+ logger.info(BASE_CUBOID_COUNT_IN_CUBOID_STATISTICS_IS_ZERO);
return null;
}
@@ -120,7 +121,7 @@ public class CuboidRecommenderUtil {
long baseCuboid = cube.getCuboidScheduler().getBaseCuboidId();
if (cubeStatsReader.getCuboidRowEstimatesHLL().get(baseCuboid) == null
|| cubeStatsReader.getCuboidRowEstimatesHLL().get(baseCuboid)
== 0L) {
- logger.info("Base cuboid count in cuboid statistics is 0.");
+ logger.info(BASE_CUBOID_COUNT_IN_CUBOID_STATISTICS_IS_ZERO);
return null;
}
diff --git
a/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/SaveStatisticsStep.java
b/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/SaveStatisticsStep.java
index 1f79539..3d0d492 100644
---
a/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/SaveStatisticsStep.java
+++
b/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/SaveStatisticsStep.java
@@ -129,14 +129,14 @@ public class SaveStatisticsStep extends
AbstractExecutable {
mapperNumber, mapperOverlapRatio, sourceRecordCount);
Path statisticsFile = new Path(statisticsDir,
BatchConstants.CFG_STATISTICS_CUBOID_ESTIMATION_FILENAME);
- logger.info(newSegment + " stats saved to hdfs " + statisticsFile);
+ logger.info("{} stats saved to hdfs {}", newSegment,
statisticsFile);
FSDataInputStream is = fs.open(statisticsFile);
try {
// put the statistics to metadata store
String resPath = newSegment.getStatisticsResourcePath();
rs.putResource(resPath, is, System.currentTimeMillis());
- logger.info(newSegment + " stats saved to resource " +
resPath);
+ logger.info("{} stats saved to resource {}", newSegment,
resPath);
StatisticsDecisionUtil.decideCubingAlgorithm(cubingJob,
newSegment);
StatisticsDecisionUtil.optimizeCubingPlan(newSegment);
@@ -152,7 +152,7 @@ public class SaveStatisticsStep extends AbstractExecutable {
}
private void logMapperAndCuboidStatistics(Map<Long, HLLCounter>
cuboidHLLMap, int samplingPercentage,
- int mapperNumber, long grantTotal, long totalRowsBeforeMerge)
throws IOException {
+ int mapperNumber, long grantTotal, long totalRowsBeforeMerge) {
logger.debug("Total cuboid number: \t" + cuboidHLLMap.size());
logger.debug("Sampling percentage: \t" + samplingPercentage);
logger.debug("The following statistics are collected based on sampling
data.");