Return-Path: X-Original-To: apmail-drill-issues-archive@minotaur.apache.org Delivered-To: apmail-drill-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 17220187F0 for ; Tue, 11 Aug 2015 16:51:52 +0000 (UTC) Received: (qmail 57298 invoked by uid 500); 11 Aug 2015 16:51:45 -0000 Delivered-To: apmail-drill-issues-archive@drill.apache.org Received: (qmail 57268 invoked by uid 500); 11 Aug 2015 16:51:45 -0000 Mailing-List: contact issues-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 issues@drill.apache.org Received: (qmail 57258 invoked by uid 99); 11 Aug 2015 16:51:45 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2015 16:51:45 +0000 Date: Tue, 11 Aug 2015 16:51:45 +0000 (UTC) From: "Victoria Markman (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DRILL-3567) Wrong result in a query with multiple window functions and different over clauses MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DRILL-3567?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1468= 2068#comment-14682068 ]=20 Victoria Markman commented on DRILL-3567: ----------------------------------------- Verified fixed in: 1.2.0 #Fri Aug 07 22:24:50 UTC 2015 git.commit.id.abbrev=3D4d967ed Tests for this bug will be checked in under: Functional/Passing/window_func= tions/multiple_partitions > Wrong result in a query with multiple window functions and different over= clauses > -------------------------------------------------------------------------= -------- > > Key: DRILL-3567 > URL: https://issues.apache.org/jira/browse/DRILL-3567 > Project: Apache Drill > Issue Type: Bug > Components: Query Planning & Optimization > Affects Versions: 1.1.0 > Reporter: Victoria Markman > Assignee: Sean Hsuan-Yi Chu > Priority: Critical > Labels: window_function > Attachments: t1_parquet > > > {code} > 0: jdbc:drill:drillbit=3Dlocalhost> select * from t1; > +-------+--------+-------------+ > | a1 | b1 | c1 | > +-------+--------+-------------+ > | 1 | aaaaa | 2015-01-01 | > | 2 | bbbbb | 2015-01-02 | > | 3 | ccccc | 2015-01-03 | > | 4 | null | 2015-01-04 | > | 5 | eeeee | 2015-01-05 | > | 6 | fffff | 2015-01-06 | > | 7 | ggggg | 2015-01-07 | > | null | hhhhh | 2015-01-08 | > | 9 | iiiii | null | > | 10 | jjjjj | 2015-01-10 | > +-------+--------+-------------+ > 10 rows selected (0.078 seconds) > {code} > Wrong result, columns are projected in the wrong order: > {code} > 0: jdbc:drill:drillbit=3Dlocalhost> select > . . . . . . . . . . . . . . . . > count(*) over(partition by b1 o= rder by c1) as count1, > . . . . . . . . . . . . . . . . > count(*) over(partition by a1 o= rder by c1) as count2, > . . . . . . . . . . . . . . . . > sum(a1) over(partition by b1 o= rder by c1) as sum1 > . . . . . . . . . . . . . . . . > from=20 > . . . . . . . . . . . . . . . . > t1; > +---------+---------+-------+ > | count1 | count2 | sum1 | > +---------+---------+-------+ > | 1 | 1 | 1 | > | 1 | 2 | 1 | > | 1 | 3 | 1 | > | 1 | 4 | 1 | > | 1 | 5 | 1 | > | 1 | 6 | 1 | > | 1 | 7 | 1 | > | 1 | 9 | 1 | > | 1 | 10 | 1 | > | 1 | null | 1 | > +---------+---------+-------+ > 10 rows selected (0.113 seconds) > {code} > Explain plan: > {code} > 0: jdbc:drill:drillbit=3Dlocalhost> explain plan for select > . . . . . . . . . . . . . . . . > count(*) over(partition by b1 o= rder by c1) as count1, > . . . . . . . . . . . . . . . . > count(*) over(partition by a1 o= rder by c1) as count2, > . . . . . . . . . . . . . . . . > sum(a1) over(partition by b1 o= rder by c1) as sum1 > . . . . . . . . . . . . . . . . > from=20 > . . . . . . . . . . . . . . . . > t1; > +------+------+ > | text | json | > +------+------+ > | 00-00 Screen > 00-01 ProjectAllowDup(count1=3D[$0], count2=3D[$1], sum1=3D[$2]) > 00-02 Project(w0$o0=3D[$4], w0$o1=3D[$5], w1$o0=3D[$6]) > 00-03 Window(window#0=3D[window(partition {3} order by [2] range= between UNBOUNDED PRECEDING and CURRENT ROW aggs [COUNT()])]) > 00-04 SelectionVectorRemover > 00-05 Sort(sort0=3D[$3], sort1=3D[$2], dir0=3D[ASC], dir1=3D= [ASC]) > 00-06 Window(window#0=3D[window(partition {1} order by [2]= range between UNBOUNDED PRECEDING and CURRENT ROW aggs [COUNT(), SUM($3)])= ]) > 00-07 SelectionVectorRemover > 00-08 Sort(sort0=3D[$1], sort1=3D[$2], dir0=3D[ASC], d= ir1=3D[ASC]) > 00-09 Project(T61=C2=A6=C2=A6*=3D[$0], b1=3D[$1], c1= =3D[$2], a1=3D[$3]) > 00-10 Scan(groupscan=3D[ParquetGroupScan [entries= =3D[ReadEntryWithPath [path=3Dfile:/Users/vmarkman/drill/testdata/subquerie= s/t1]], selectionRoot=3Dfile:/Users/vmarkman/drill/testdata/subqueries/t1, = numFiles=3D1, columns=3D[`*`]]]) > {code} > If you remove frame that is not the same as other two, query works correc= tly: > {code} > 0: jdbc:drill:drillbit=3Dlocalhost> select > . . . . . . . . . . . . . . . . > count(*) over(partition by b1 o= rder by c1) as count1, > . . . . . . . . . . . . . . . . > sum(a1) over(partition by b1 o= rder by c1) as sum1 > . . . . . . . . . . . . . . . . > from > . . . . . . . . . . . . . . . . > t1; > +---------+-------+ > | count1 | sum1 | > +---------+-------+ > | 1 | 1 | > | 1 | 2 | > | 1 | 3 | > | 1 | 5 | > | 1 | 6 | > | 1 | 7 | > | 1 | null | > | 1 | 9 | > | 1 | 10 | > | 1 | 4 | > +---------+-------+ > 10 rows selected (0.099 seconds) > {code} > and in the different order (just for fun) : > {code} > 0: jdbc:drill:drillbit=3Dlocalhost> select > . . . . . . . . . . . . . . . . > sum(a1) over(partition by b1 o= rder by c1) as sum1, > . . . . . . . . . . . . . . . . > count(*) over(partition by b1 o= rder by c1) as count1 > . . . . . . . . . . . . . . . . > from=20 > . . . . . . . . . . . . . . . . > t1; > +-------+---------+ > | sum1 | count1 | > +-------+---------+ > | 1 | 1 | > | 2 | 1 | > | 3 | 1 | > | 5 | 1 | > | 6 | 1 | > | 7 | 1 | > | null | 1 | > | 9 | 1 | > | 10 | 1 | > | 4 | 1 | > +-------+---------+ > 10 rows selected (0.096 seconds) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)