[ https://issues.apache.org/jira/browse/DRILL-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mehant Baid reassigned DRILL-1393: ---------------------------------- Assignee: Mehant Baid > Wrong result for query with Having filter, Order-by and Limit > ------------------------------------------------------------- > > Key: DRILL-1393 > URL: https://issues.apache.org/jira/browse/DRILL-1393 > Project: Apache Drill > Issue Type: Bug > Components: Execution - Operators > Affects Versions: 0.5.0 > Reporter: Aman Sinha > Assignee: Mehant Baid > > The following query without LIMIT gives correct results: > 0: jdbc:drill:zk=local> select o_custkey from orders group by o_custkey > having o_custkey < 10 order by o_custkey; > +------------+ > | o_custkey | > +------------+ > | 1 | > | 2 | > | 4 | > | 5 | > | 7 | > | 8 | > +------------+ > Adding a LIMIT gives 0 rows: > 0: jdbc:drill:zk=local> select o_custkey from orders group by o_custkey > having o_custkey < 10 order by o_custkey limit 10; > +------------+ > | o_custkey | > +------------+ > +------------+ > No rows selected > Here's the EXPLAIN plan: > 0: jdbc:drill:zk=local> explain plan for select o_custkey from orders group > by o_custkey having o_custkey < 10 order by o_custkey limit 10; > +------------+------------+ > | text | json | > +------------+------------+ > | 00-00 Screen > 00-01 SelectionVectorRemover > 00-02 Limit(fetch=[10]) > 00-03 SelectionVectorRemover > 00-04 TopN(limit=[10]) > 00-05 Filter(condition=[<($0, 10)]) > 00-06 HashAgg(group=[{0}]) > 00-07 HashAgg(group=[{0}]) > 00-08 Scan(groupscan=[ParquetGroupScan > [entries=[ReadEntryWithPath [path=file:/Users/asinha/data/tpch-sf1/orders]], > selectionRoot=/Users/asinha/data/tpch-sf1/orders, columns=[SchemaPath > [`o_custkey`]]]]) -- This message was sent by Atlassian JIRA (v6.3.4#6332)