Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D4330200B9C for ; Mon, 10 Oct 2016 20:16:56 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D2E36160AE1; Mon, 10 Oct 2016 18:16:56 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1DDD4160AD1 for ; Mon, 10 Oct 2016 20:16:55 +0200 (CEST) Received: (qmail 82883 invoked by uid 500); 10 Oct 2016 18:16:55 -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 82866 invoked by uid 99); 10 Oct 2016 18:16:54 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Oct 2016 18:16:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 80D1CC0185 for ; Mon, 10 Oct 2016 18:16:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id eUsBUFh-gI3D for ; Mon, 10 Oct 2016 18:16:52 +0000 (UTC) Received: from mail-lf0-f44.google.com (mail-lf0-f44.google.com [209.85.215.44]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 253215F307 for ; Mon, 10 Oct 2016 18:16:52 +0000 (UTC) Received: by mail-lf0-f44.google.com with SMTP id b75so136782277lfg.3 for ; Mon, 10 Oct 2016 11:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=BeEJfpb/N2tP4glV7V2Tujz050GMZC09xbtmU8zmEKo=; b=vG4GauqmRwV836KTbgzXrXAO3VpcbIGPYNpKxCz6eVnR90FcfRF7bw5HbzA24o7qDw 8NJSdfY9iChWHsILusQsO4FL5puW2LMXn2RlKAopMBUsxKjwPu/kacx2c5GUB9s/mmRT U/W4a+uVgU8Dvsb+TEP4t/MagcKVG15FQo/uibXySFpm8jfYxd0jVdi/vFhkro8n4NQN 2RkUBLMvl3Gah2y/Eani50cm4p9wn2l273TFWVsHAmqobYpzzKgbT3ZkgfnZN8bKxe+D OXuQLb/Fpc1xnX4B98yPNtcAywROlCGivYcZA/4m9FNPP7xOpAs8YXcNeNrO5PNTCNnr HOTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=BeEJfpb/N2tP4glV7V2Tujz050GMZC09xbtmU8zmEKo=; b=OS+pNnktNdvrs8kT7EprMnAK1BCUhGgvr4woz1ZlA+jHk2EWkz9XAfyL7BN3vWXUoL gNtbDe0HN8SB2zSBxM+ww21Ee/wgrLwrysueHWwD1MNTy1uZnY3BJYTKe0JY0gBbl8mE ZuoardRHQEgNOOmMXelc4Muoby69rBh2lPjlj00Aqni2pXBET7Gdhx8R4W0CmTBRrqnf YeUTvfRR/8OyFFyGh0fncr5s+1eGUocHKpMEJDue61Oaik+TEGjs9eGM23ccuHjLuV2a 72xNRGkOydqpkDyPBbVwtLUNqWDLP/2T1lcfo6XLW+9V+7tOfHGdKHxT90rSZfKDFyF1 cpWQ== X-Gm-Message-State: AA6/9Rlh/DCE78QB2+Ah7EH4l2QvwZYvJR5txAfqQAA7VDUDDJuIyZPNypJhM4VY1oyUHtSvJqaGpsPWOqyorA== X-Received: by 10.194.170.163 with SMTP id an3mr32970168wjc.73.1476123394965; Mon, 10 Oct 2016 11:16:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.169.75 with HTTP; Mon, 10 Oct 2016 11:16:34 -0700 (PDT) In-Reply-To: References: From: =?UTF-8?Q?Alberto_Ram=C3=B3n?= Date: Mon, 10 Oct 2016 20:16:34 +0200 Message-ID: Subject: Re: Incorrect query result To: dev@kylin.apache.org Content-Type: multipart/alternative; boundary=089e0122f07c9a05cf053e86c269 archived-at: Mon, 10 Oct 2016 18:16:57 -0000 --089e0122f07c9a05cf053e86c269 Content-Type: text/plain; charset=UTF-8 can you try this BR, Alb 2016-10-10 16:30 GMT+02:00 Joel Victor : > There are two columns in the table which are event date and event hour. > I have attached the result and the plans for all three queries that I ran. > > The first query will *not* show the value for date 2016-09-28 and hour 0 > in the result > The second query will show the value for date 2016-09-28 and hour 0 in the > result > The third query will also show the value for date 2016-09-28 and hour 0 in > the result > According to me the first query should also show the value for date > 2016-09-28 and hour 0 in the result > > All the three queries look correct to me and their plans look correct as > well. > I would appreciate any help in debugging this. > > Following are the three queries: > > Query one: > SELECT > event_date, event_hour, SUM(cnt) > FROM analytics_issue_report > WHERE ((((event_date IN ('2016-09-28')) AND event_hour = 0) > OR ((event_date IN ('2016-09-28')) AND event_hour >= 1) > OR ((event_date IN ('2016-10-04')) AND event_hour = 23) > OR ((event_date IN ('2016-10-04')) AND event_hour < 23) > OR event_date BETWEEN '2016-09-29' AND '2016-10-03') > AND action_type=1) > GROUP BY event_date, event_hour ORDER BY event_date, event_hour; > > Query two: > SELECT > event_date, event_hour, SUM(cnt) > FROM analytics_issue_report > WHERE ((event_date BETWEEN '2016-09-28' AND '2016-10-04') > AND action_type=1) > GROUP BY event_date, event_hour ORDER BY event_date, event_hour; > > Query three: > SELECT > event_date, event_hour, SUM(cnt) > FROM analytics_issue_report > WHERE ((((event_date IN ('2016-09-28')) AND event_hour <= 23) > OR ((event_date IN ('2016-10-04')) AND event_hour = 23) > OR ((event_date IN ('2016-10-04')) AND event_hour < 23) > OR event_date BETWEEN '2016-09-29' AND '2016-10-03') > AND action_type=1) > GROUP BY event_date, event_hour ORDER BY event_date, event_hour; > > --089e0122f07c9a05cf053e86c269--