From dev-return-14771-archive-asf-public=cust-asf.ponee.io@kylin.apache.org Mon Nov 26 09:05:08 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 2B433180647 for ; Mon, 26 Nov 2018 09:05:08 +0100 (CET) Received: (qmail 75170 invoked by uid 500); 26 Nov 2018 08:05:06 -0000 Mailing-List: contact dev-help@kylin.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kylin.apache.org Delivered-To: mailing list dev@kylin.apache.org Received: (qmail 75159 invoked by uid 99); 26 Nov 2018 08:05:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Nov 2018 08:05:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 69E88180CB0 for ; Mon, 26 Nov 2018 08:05:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id z52Bp-DuEXF3 for ; Mon, 26 Nov 2018 08:05:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 5C4095FBB4 for ; Mon, 26 Nov 2018 08:05:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8636DE0C57 for ; Mon, 26 Nov 2018 08:05:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3E21C27766 for ; Mon, 26 Nov 2018 08:05:00 +0000 (UTC) Date: Mon, 26 Nov 2018 08:05:00 +0000 (UTC) From: "shengxiaopeng (JIRA)" To: dev@kylin.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (KYLIN-3703) get negative value when query kylin MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 shengxiaopeng created KYLIN-3703: ------------------------------------ Summary: get negative value when query kylin Key: KYLIN-3703 URL: https://issues.apache.org/jira/browse/KYLIN-3703 Project: Kylin Issue Type: Bug Reporter: shengxiaopeng Fix For: v2.5.1 version: Kylin 2.5.1=C2=A0 There is a cube built in real time, one metric is average time consuming, t= he source data does not have a negative value, but the negative value occur= s by hourly aggregation, and the aggregation is normal by minute =C2=A0 Metric definition |Name|Expression|Parameters|Return Type| |SUM_FS|SUM|Value:APM_FIRSTSCREEN_WEB.PRF_PL_FS, Type:column|bigint| #=20 ## Aggregate sql and results by hour ``` select=20 hour_start ,count(*)=C2=A0as amount ,sum(prf_pl_fs) as sum_pl_fs from DY_APM.APM_FIRSTSCREEN_WEB where 1=3D1 and minute_start >=3D '2018-11-23 20:00:00' and minute_start <= '2018-11-23 21:00:00'=20 group by hour_start=20 order by hour_start asc=20 limit 15000 ``` |hour_start|amount|sum_pl_fs| |2018-11-23 20:00:00|974466|-1317398890| #=20 ## Aggregate sql and results by minute ``` select=20 minute_start ,count(*)=C2=A0as amount ,sum(prf_pl_fs) as sum_pl_fs from DY_APM.APM_FIRSTSCREEN_WEB where 1=3D1 and minute_start >=3D '2018-11-23 20:00:00' and minute_start <= '2018-11-23 21:00:00'=20 group by minute_start=20 order by minute_start asc=20 limit 15000 ``` |hour_start|amount|sum_pl_fs| |2018-11-23 20:21:00|2629|8107124| |2018-11-23 20:22:00|12216|36558869| |2018-11-23 20:23:00|12800|38401450| |...|=E7=95=A5|...| I guess this should be caused by crossing the border. # I use the data of e= ach minute to get the hourly data, and the total time is 2977568406, which = is far from the scope of bigint. ``` select=20 sum(t.amount) amount ,sum(t.sum_pl_fs) sum_pl_fs ,sum(t.sum_pl_fs) / sum(t.amount) as avg_pl_fs from=20 ( select=20 minute_start ,count(*)=C2=A0as amount ,sum(prf_pl_fs) as sum_pl_fs from DY_APM.APM_FIRSTSCREEN_WEB where 1=3D1 and minute_start >=3D '2018-11-23 20:00:00' and minute_start <= '2018-11-23 21:00:00'=20 group by minute_start=20 order by minute_start asc=20 limit 15000 ) as t ``` |amount|sum_pl_fs|avg_pl_fs| |974466|2977568406|3055| =C2=A0 Excuse me, is this question a problem with my configuration or query? How s= hould it be solved? =C2=A0 =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)