You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Abhishek Girish (JIRA)" <ji...@apache.org> on 2015/04/23 03:16:38 UTC

[jira] [Reopened] (DRILL-2378) UNION ALL on Aggregates with GROUP BY and ORDER BY fails when column aliases don't match

     [ https://issues.apache.org/jira/browse/DRILL-2378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Abhishek Girish reopened DRILL-2378:
------------------------------------
      Assignee: Sean Hsuan-Yi Chu  (was: Jinfeng Ni)

Checked on Git.Commit.ID a0a1930 (April 21 build)

Query fails with schema change error, even though there isn't any:

{code:sql}
select x
from
(SELECT Sum(ss_ext_sales_price) x
FROM  store_sales
UNION ALL
SELECT Sum(cs_ext_sales_price) y
FROM catalog_sales) tmp
GROUP BY x
ORDER BY x;
+------------+
|     x      |
+------------+
Query failed: SYSTEM ERROR: Hash aggregate does not support schema changes

Fragment 2:0

[3d4b5dec-81c0-4d0d-86e4-e1ad682be37f on abhi8.qa.lab:31010]
java.lang.RuntimeException: java.sql.SQLException: Failure while executing query.
	at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2514)
	at sqlline.SqlLine$TableOutputFormat.print(SqlLine.java:2148)
	at sqlline.SqlLine.print(SqlLine.java:1809)
	at sqlline.SqlLine$Commands.execute(SqlLine.java:3766)
	at sqlline.SqlLine$Commands.sql(SqlLine.java:3663)
	at sqlline.SqlLine.dispatch(SqlLine.java:889)
	at sqlline.SqlLine.begin(SqlLine.java:763)
	at sqlline.SqlLine.start(SqlLine.java:498)
	at sqlline.SqlLine.main(SqlLine.java:460)
{code}

Query with explicit cast on sum() works:
{code:sql}
SELECT x
FROM
(SELECT cast (Sum(s.ss_ext_sales_price) as double) x
FROM  store_sales s
UNION ALL
SELECT cast(Sum(c.cs_ext_sales_price) as double) y
FROM catalog_sales c) tmp
GROUP BY x
ORDER BY x;
+------------+
|     x      |
+------------+
| 3.658019159349976E9 |
| 5.26520707451017E9 |
+------------+
2 rows selected (0.403 seconds)
{code}

> UNION ALL on Aggregates with GROUP BY and ORDER BY fails when column aliases don't match
> ----------------------------------------------------------------------------------------
>
>                 Key: DRILL-2378
>                 URL: https://issues.apache.org/jira/browse/DRILL-2378
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 0.8.0
>            Reporter: Abhishek Girish
>            Assignee: Sean Hsuan-Yi Chu
>         Attachments: drillbit.log
>
>
> *The following query fails to execute:*
> {code:sql}
> select x
> from
> (SELECT Sum(ss_ext_sales_price) x
> FROM  store_sales
> UNION ALL
> SELECT Sum(cs_ext_sales_price) y
> FROM catalog_sales) tmp
> GROUP BY x
> ORDER BY x;
> Error from Drill:
> Query failed: RemoteRpcException: Failure while running fragment., Failure while reading vector.  Expected vector class of org.apache.drill.exec.vector.Decimal38SparseVector but was holding vector class org.apache.drill.exec.vector.NullableIntVector. [ 7cc962d6-569b-44f6-9118-d5cc5a9632d9 on abhi7.qa.lab:31010 ]
> [ 7cc962d6-569b-44f6-9118-d5cc5a9632d9 on abhi7.qa.lab:31010 ]
> java.lang.RuntimeException: java.sql.SQLException: Failure while executing query.
> 	at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2514)
>         ...
> {code}
> Log snippet attached.
>  
> *The following query executes fine (although returns incomplete results - see DRILL-2376:*
> {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
> ORDER BY x;
> {code}



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