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/03/04 05:33:05 UTC

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

Abhishek Girish created DRILL-2379:
--------------------------------------

             Summary: 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: Jinfeng Ni


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)