I change the measure column "V" data type from integer to double. resubmit the sqls. SQL: SELECT LV1,SUM(V) V FROM TEST GROUP BY LV1 Return: LV1 V 001 -0.994
whithe sum(v) value should be -1.0, but kylin return -0.994. dd SQL: SELECT LV1,SUM(V) V,COUNT(*) C FROM TEST GROUP BY LV1 Return: LV1 V C 001 -1.0 1 the sum(v) is right. ________________________________ 发件人: 苏 志锋 <roc...@live.com> 发送时间: 2017年5月15日 12:06:41 收件人: user@kylin.apache.org 主题: TOPN value, which sum measure column group by dimension, error. TOPN value, which sum measure column group by dimension, error. Environment Apache Kylin:1.6.0 STEPS 1. Kafka produce one message 2. kylin consume the message 3. kylin build cuboid 4. execute sql KafKa JSON data {“T”:”2017-05-15”,“LV1”:”001”,”V”:-1} MODEL 1、Dimensions : T, LV1 2、Measures : V CUBE 1. Dimensions : T, LV1 2. Measures: _COUNT_; SUM(V); TOPN SUM COLUMN V GROUP BY LV1; SQL and result 1、 SELECT LV1,SUM(V) V FROM TEST GROUP BY LV1 LV1 V 001 0 2、 SELECT LV1,SUM(V) V,COUNT(*) C FROM TEST GROUP BY LV1 LV1 V C 001 -1 1 Problem The sum(v) value is error in sql 1, and correct in sql 2. The probably reasons are: 1、org.apache.kylin.measure.topn. TopNCounterSerializer.deserialize function deserialize -1 to -0.99. 2、org.apache.kylin.metadata.tuple.setMeasureValue function convert double(-0.99) to long(0)