Repository: kylin
Updated Branches:
  refs/heads/master 9b9cfe8f7 -> 6d61055ff


KYLIN-1524 Top-N metris data type is BigInt


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/6d61055f
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/6d61055f
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/6d61055f

Branch: refs/heads/master
Commit: 6d61055ffeb38f77c58e203dceeec58560550742
Parents: 9b9cfe8
Author: shaofengshi <[email protected]>
Authored: Wed Mar 23 19:53:13 2016 +0800
Committer: shaofengshi <[email protected]>
Committed: Wed Mar 23 19:53:13 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/measure/topn/TopNMeasureType.java     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/6d61055f/core-metadata/src/main/java/org/apache/kylin/measure/topn/TopNMeasureType.java
----------------------------------------------------------------------
diff --git 
a/core-metadata/src/main/java/org/apache/kylin/measure/topn/TopNMeasureType.java
 
b/core-metadata/src/main/java/org/apache/kylin/measure/topn/TopNMeasureType.java
index 2167cc1..cee8603 100644
--- 
a/core-metadata/src/main/java/org/apache/kylin/measure/topn/TopNMeasureType.java
+++ 
b/core-metadata/src/main/java/org/apache/kylin/measure/topn/TopNMeasureType.java
@@ -267,7 +267,8 @@ public class TopNMeasureType extends 
MeasureType<TopNCounter<ByteArray>> {
         final int literalTupleIdx = tupleInfo.hasColumn(literalCol) ? 
tupleInfo.getColumnIndex(literalCol) : -1;
         // for TopN, the aggr must be SUM, so the number fill into the column 
position (without rewrite)
         final int numericTupleIdx = tupleInfo.hasColumn(numericCol) ? 
tupleInfo.getColumnIndex(numericCol) : -1;
-
+        final DataType numericField = 
DataType.getType(tupleInfo.getDataTypeName(numericTupleIdx));
+        final boolean isIntFamily = numericField.isIntegerFamily();
         return new IAdvMeasureFiller() {
             private TopNCounter<ByteArray> topNCounter;
             private Iterator<Counter<ByteArray>> topNCounterIterator;
@@ -295,7 +296,7 @@ public class TopNMeasureType extends 
MeasureType<TopNCounter<ByteArray>> {
                 int key = BytesUtil.readUnsigned(counter.getItem().array(), 
counter.getItem().offset(), counter.getItem().length());
                 String colValue = topNColDict.getValueFromId(key);
                 tuple.setDimensionValue(literalTupleIdx, colValue);
-                tuple.setMeasureValue(numericTupleIdx, counter.getCount());
+                tuple.setMeasureValue(numericTupleIdx, isIntFamily ? (long) 
counter.getCount() : counter.getCount());
             }
         };
     }

Reply via email to