[ 
https://issues.apache.org/jira/browse/DRILL-2376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14509462#comment-14509462
 ] 

Victoria Markman commented on DRILL-2376:
-----------------------------------------

Another case, works if hash aggregation is disabled:

{code}
0: jdbc:drill:schema=dfs> select  t1.a1,
. . . . . . . . . . . . >         t1.b1,
. . . . . . . . . . . . >         count(distinct t1.c1) as distinct_c1,
. . . . . . . . . . . . >         count(distinct t2.c2) as distinct_c2,
. . . . . . . . . . . . >         sum(t1.a1) as sum_a1,
. . . . . . . . . . . . >         count(t1.c1) as count_a1,
. . . . . . . . . . . . >         count(*) as count_star
. . . . . . . . . . . . > from
. . . . . . . . . . . . >         t1,
. . . . . . . . . . . . >         t2
. . . . . . . . . . . . > where
. . . . . . . . . . . . >         t1.a1 = t2.a2 and t1.b1 = t2.b2
. . . . . . . . . . . . > group by
. . . . . . . . . . . . >         t1.a1,
. . . . . . . . . . . . >         t1.b1,
. . . . . . . . . . . . >         t2.a2,
. . . . . . . . . . . . >         t2.b2
. . . . . . . . . . . . > order by
. . . . . . . . . . . . >         t1.a1,
. . . . . . . . . . . . >         t1.b1,
. . . . . . . . . . . . >         t2.a2,
. . . . . . . . . . . . >         t2.b2
. . . . . . . . . . . . > ;
+------------+------------+-------------+-------------+------------+------------+------------+
|     a1     |     b1     | distinct_c1 | distinct_c2 |   sum_a1   |  count_a1  
| count_star |
+------------+------------+-------------+-------------+------------+------------+------------+
Query failed: SYSTEM ERROR: Hash aggregate does not support schema changes

Fragment 0:0

[10ee2422-d13c-4405-a4b6-a62358f72995 on atsqa4-134.qa.lab:31010]

  (org.apache.drill.exec.exception.SchemaChangeException) Hash aggregate does 
not support schema changes
{code}

copy/paste reproduction
{code}
select  t1.a1,
        t1.b1,
        count(distinct t1.c1) as distinct_c1,
        count(distinct t2.c2) as distinct_c2,
        sum(t1.a1) as sum_a1,
        count(t1.c1) as count_a1,
        count(*) as count_star
from
        t1,
        t2
where
        t1.a1 = t2.a2 and t1.b1 = t2.b2
group by
        t1.a1,
        t1.b1,
        t2.a2,
        t2.b2
order by
        t1.a1,
        t1.b1,
        t2.a2,
        t2.b2
;
{code}

> UNION ALL on Aggregates with GROUP BY returns incomplete results
> ----------------------------------------------------------------
>
>                 Key: DRILL-2376
>                 URL: https://issues.apache.org/jira/browse/DRILL-2376
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 0.9.0
>            Reporter: Abhishek Girish
>            Assignee: Sean Hsuan-Yi Chu
>             Fix For: 0.8.0
>
>
> The following query returns incomplete results:
> {code:sql}
> select x
> from
> (SELECT Sum(ss_ext_sales_price) x
> FROM  store_sales
> UNION ALL
> SELECT Sum(cs_ext_sales_price) x
> FROM catalog_sales) tmp
> GROUP BY x;
> Results from Drill:
> +------------+
> |     x      |
> +------------+
> | 3658019159.35 |
> +------------+
> 1 row selected (3.474 seconds)
> Results from Postgres:
>        x       
> ---------------
>  5265207074.51
>  3658019159.35
> (2 rows)
> {code}
> Removing GROUP BY returns the right results:
> {code:sql}
> select x
> from
> (SELECT Sum(ss_ext_sales_price) x
> FROM  store_sales
> UNION ALL
> SELECT Sum(cs_ext_sales_price) x
> FROM catalog_sales) tmp;
> Results from Drill:
> +------------+
> |     x      |
> +------------+
> | 5265207074.51 |
> | 3658019159.35 |
> +------------+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to