Return-Path: X-Original-To: apmail-drill-dev-archive@www.apache.org Delivered-To: apmail-drill-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 593BC10889 for ; Tue, 18 Aug 2015 17:20:54 +0000 (UTC) Received: (qmail 30986 invoked by uid 500); 18 Aug 2015 17:20:46 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 30935 invoked by uid 500); 18 Aug 2015 17:20:46 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 30887 invoked by uid 99); 18 Aug 2015 17:20:46 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Aug 2015 17:20:46 +0000 Date: Tue, 18 Aug 2015 17:20:46 +0000 (UTC) From: "Deneche A. Hakim (JIRA)" To: dev@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (DRILL-3648) NTILE function returns incorrect results MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DRILL-3648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Deneche A. Hakim resolved DRILL-3648. ------------------------------------- Resolution: Fixed Fixed in b55e2328d929df5d361c038f63fdeffadb0e544c > NTILE function returns incorrect results > ---------------------------------------- > > Key: DRILL-3648 > URL: https://issues.apache.org/jira/browse/DRILL-3648 > Project: Apache Drill > Issue Type: Bug > Components: Execution - Flow > Affects Versions: 1.2.0 > Environment: private-branch https://github.com/adeneche/incubator-drill/tree/new-window-funcs > Reporter: Khurram Faraaz > Assignee: Deneche A. Hakim > Priority: Critical > Labels: window_function > Fix For: 1.2.0 > > > NTILE function returns incorrect results for larger dataset. I am working on reproducing the problem with a smaller dataset. > The inner query that uses NTILE should have divided the rows into two sets (tiles) where each tile consists of (937088 + 1 ) rows , 937088 rows > {code} > 0: jdbc:drill:schema=dfs.tmp> select ntile_key2, count(ntile_key2) from (select ntile(2) over(partition by key2 order by key1) ntile_key2 from `twoKeyJsn.json` where key2 = 'm') group by ntile_key2; > +-------------+----------+ > | ntile_key2 | EXPR$1 | > +-------------+----------+ > | 1 | 1 | > | 2 | 1874176 | > +-------------+----------+ > 2 rows selected (49.406 seconds) > {code} > Explain plan for inner query that returns wrong results. > {code} > 0: jdbc:drill:schema=dfs.tmp> explain plan for select ntile(2) over(partition by key2 order by key1) from `twoKeyJsn.json` where key2 = 'm'; > +------+------+ > | text | json | > +------+------+ > | 00-00 Screen > 00-01 UnionExchange > 01-01 Project(EXPR$0=[$0]) > 01-02 Project($0=[$2]) > 01-03 Window(window#0=[window(partition {0} order by [1] range between UNBOUNDED PRECEDING and CURRENT ROW aggs [NTILE($2)])]) > 01-04 SelectionVectorRemover > 01-05 Sort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC]) > 01-06 Project(key2=[$0], key1=[$1]) > 01-07 HashToRandomExchange(dist0=[[$0]]) > 02-01 UnorderedMuxExchange > 03-01 Project(key2=[$0], key1=[$1], E_X_P_R_H_A_S_H_F_I_E_L_D=[castInt(hash64AsDouble($0))]) > 03-02 SelectionVectorRemover > 03-03 Filter(condition=[=($0, 'm')]) > 03-04 Scan(groupscan=[EasyGroupScan [selectionRoot=maprfs:/tmp/twoKeyJsn.json, numFiles=1, columns=[`key2`, `key1`], files=[maprfs:///tmp/twoKeyJsn.json]]]) > {code} > Total number of rows in partition that has key2 = 'm' > {code} > 0: jdbc:drill:schema=dfs.tmp> select count(key1) from `twoKeyJsn.json` where key2 = 'm'; > +----------+ > | EXPR$0 | > +----------+ > | 1874177 | > +----------+ > 1 row selected (37.581 seconds) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)