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 02:32:38 UTC

[jira] [Commented] (DRILL-2379) UNION ALL with ORDER BY fails when column aliases don't match

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

Abhishek Girish commented on DRILL-2379:
----------------------------------------

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

{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
ORDER BY x;

+------------+
|     x      |
+------------+
| 3.658019159349976E9 |
| 5.26520707451017E9 |
+------------+
{code}

The issue is now resolved.

> UNION ALL with ORDER BY fails when column aliases don't match
> -------------------------------------------------------------
>
>                 Key: DRILL-2379
>                 URL: https://issues.apache.org/jira/browse/DRILL-2379
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 0.8.0
>            Reporter: Abhishek Girish
>            Assignee: Sean Hsuan-Yi Chu
>             Fix For: 0.8.0
>
>         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
> ORDER BY x;
> SELECT x
> FROM
> (SELECT ss_ext_sales_price x
> FROM  store_sales
> UNION ALL
> SELECT cs_ext_sales_price y
> FROM catalog_sales) tmp
> ORDER BY x;
> SELECT x
> FROM
> (SELECT ss_ext_sales_price x
> FROM  store_sales
> UNION ALL
> SELECT ss_ext_sales_price y
> FROM store_sales) tmp
> ORDER BY x;
> Error from Drill:
> Query failed: RemoteRpcException: Failure while running fragment., Sort doesn't currently support sorts with changing schemas. 
> java.lang.RuntimeException: java.sql.SQLException: Failure while executing query.
> ...
> {code}
> Log snippet attached. 
> Changing the alias from 'y' to 'x' in the second sub-query will solve the issue. 



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