You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by GitBox <gi...@apache.org> on 2018/09/30 03:07:29 UTC

[GitHub] shaofengshi closed pull request #251: KYLIN-3583, KYLIN-3579

shaofengshi closed pull request #251: KYLIN-3583, KYLIN-3579
URL: https://github.com/apache/kylin/pull/251
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/algorithm/BPUSCalculator.java b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/algorithm/BPUSCalculator.java
index ea91c6cb81..6316858d58 100755
--- a/core-cube/src/main/java/org/apache/kylin/cube/cuboid/algorithm/BPUSCalculator.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/cuboid/algorithm/BPUSCalculator.java
@@ -60,15 +60,15 @@ protected BPUSCalculator(CuboidStats cuboidStats, ImmutableMap<Long, Long> initC
                 cuboidAggCostMap.put(cuboid, getCuboidCost(cuboid));
             }
         }
-        Set<Long> mandatoryCuboidSetWithStats = cuboidAggCostMap.keySet();
+
         //Initialize stats for selection cuboids
         long baseCuboidCost = getCuboidCost(cuboidStats.getBaseCuboid());
         for (Long cuboid : cuboidStats.getAllCuboidsForSelection()) {
             long leastCost = baseCuboidCost;
-            for (Long cuboidTarget : mandatoryCuboidSetWithStats) {
-                if ((cuboid | cuboidTarget) == cuboidTarget) {
-                    if (leastCost > cuboidAggCostMap.get(cuboidTarget)) {
-                        leastCost = cuboidAggCostMap.get(cuboidTarget);
+            for (Map.Entry<Long, Long> cuboidTargetEntry : cuboidAggCostMap.entrySet()) {
+                if ((cuboid | cuboidTargetEntry.getKey()) == cuboidTargetEntry.getKey()) {
+                    if (leastCost > cuboidTargetEntry.getValue()) {
+                        leastCost = cuboidTargetEntry.getValue();
                     }
                 }
             }
@@ -106,9 +106,9 @@ protected BPUSCalculator(CuboidStats cuboidStats, ImmutableMap<Long, Long> initC
         }
         double totalCostSaving = 0;
         int benefitCount = 0;
-        for (Long cuboid : cuboidAggCostMapCopy.keySet()) {
-            if (cuboidAggCostMapCopy.get(cuboid) < processCuboidAggCostMap.get(cuboid)) {
-                totalCostSaving += processCuboidAggCostMap.get(cuboid) - cuboidAggCostMapCopy.get(cuboid);
+        for (Map.Entry<Long, Long> entry : cuboidAggCostMapCopy.entrySet()) {
+            if (entry.getValue() < processCuboidAggCostMap.get(entry.getKey())) {
+                totalCostSaving += processCuboidAggCostMap.get(entry.getKey()) - entry.getValue();
                 benefitCount++;
             }
         }
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java
index 357747663d..4c71fea011 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java
@@ -168,13 +168,13 @@ public Object decodeColumnValue(int col, ByteBuffer buf) {
 
         // deal with holistic distinct count
         if (dependentMetricsMap != null) {
-            for (Integer child : dependentMetricsMap.keySet()) {
-                if (columns.get(child)) {
-                    Integer parent = dependentMetricsMap.get(child);
+            for (Map.Entry<Integer, Integer> childEntry : dependentMetricsMap.entrySet()) {
+                if (columns.get(childEntry.getKey())) {
+                    Integer parent = childEntry.getValue();
                     if (columns.get(parent) == false)
                         throw new IllegalStateException();
 
-                    int childIdx = columns.trueBitIndexOf(child);
+                    int childIdx = columns.trueBitIndexOf(childEntry.getKey());
                     int parentIdx = columns.trueBitIndexOf(parent);
                     result[childIdx].setDependentAggregator(result[parentIdx]);
                 }
diff --git a/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEventTimeDetail.java b/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEventTimeDetail.java
index c611d0f943..827b5a10e1 100644
--- a/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEventTimeDetail.java
+++ b/core-metrics/src/main/java/org/apache/kylin/metrics/lib/impl/RecordEventTimeDetail.java
@@ -71,7 +71,7 @@ public RecordEventTimeDetail(long timeStamp) {
         this.second = calendar.get(Calendar.SECOND);
 
         long timeStampForWeekBegin = timeStamp;
-        timeStampForWeekBegin -= 3600000 * 24 * (calendar.get(Calendar.DAY_OF_WEEK) - 1);
+        timeStampForWeekBegin -= 3600000L * 24 * (calendar.get(Calendar.DAY_OF_WEEK) - 1);
         calendar.setTimeInMillis(timeStampForWeekBegin);
         this.week_begin_date = dateFormat.format(calendar.getTime());
     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services