drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abhishek Girish (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-2301) Query fails when multiple table aliases are provided for CTEs
Date Wed, 25 Feb 2015 00:46:05 GMT
Abhishek Girish created DRILL-2301:
--------------------------------------

             Summary: Query fails when multiple table aliases are provided for CTEs
                 Key: DRILL-2301
                 URL: https://issues.apache.org/jira/browse/DRILL-2301
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
    Affects Versions: 0.8.0
            Reporter: Abhishek Girish
            Assignee: Jinfeng Ni


When a query contains a WITH clause which defines Common Table Expressions (CTEs), a second
alias for the same the temporary table cannot be provided. 

*The following query fails to validate:*
WITH C AS 
( 
         SELECT   c_customer_id          cid
         FROM     customer
         GROUP BY c_customer_id ) 
SELECT   c2.cid 
FROM     C c1, 
         C c2 
WHERE    c2.cid = c1.cid 
ORDER BY c2.cid limit 10;

Query failed: SqlValidatorException: Table 'c2' not found

The above query validates and executes successfully on Postgres. 

When the WITH clause is removed, the query succeeds.

*The following query executes fine:*
SELECT   c2.c_customer_id 
FROM     customer c1, 
         customer c2 
WHERE    c2.c_customer_id = c1.c_customer_id 
ORDER BY c2.c_customer_id limit 10;

Logs attached. 




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

Mime
View raw message