drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Omernik (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-4572) Column Alias Not Available in Subquery
Date Sat, 02 Apr 2016 00:42:25 GMT
John Omernik created DRILL-4572:
-----------------------------------

             Summary: Column Alias Not Available in Subquery
                 Key: DRILL-4572
                 URL: https://issues.apache.org/jira/browse/DRILL-4572
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
    Affects Versions: 1.6.0, 1.5.0, 1.4.0
            Reporter: John Omernik


In the query and error below, I have a "inside" aggregate query where the groupped field is
the result of a function, but I use an alias (`cdate`) to reference it.  In the outer part
of the query, I try to reference that alias and the query fails with the error. The error
seems to imply it can't see the aliased field. 

Jinfeng Ni was also able to reproduce based on the mailing list. 

select date_part('year', s.cdate) as ydate from (
    select 
    to_date(createdon, 'yyyy-MM-dd HH:mm:ss') as `cdate`, count(*) as      num_creates 
    from 
    view_mytable
   where 
   createdon <> '0000-00-00 00:00:00' and createdon >= '2010-01-10' 
   group by 
    to_date(createdon, 'yyyy-MM-dd HH:mm:ss')
    order by cdate ASC
) s limit 100

SYSTEM ERROR: AssertionError: Internal error: Type 'RecordType(ANY $f0, BIGINT num_creates)'
has no field 'cdate'
[Error Id: 50caacaf-0b9b-4c1c-a3e1-53248bc385c0 on hadoopmapr6.brewingintel.com:31010]



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

Mime
View raw message