Return-Path: X-Original-To: apmail-drill-dev-archive@www.apache.org Delivered-To: apmail-drill-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 418E919165 for ; Sat, 2 Apr 2016 00:42:26 +0000 (UTC) Received: (qmail 67144 invoked by uid 500); 2 Apr 2016 00:42:26 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 67089 invoked by uid 500); 2 Apr 2016 00:42:26 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 67078 invoked by uid 99); 2 Apr 2016 00:42:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Apr 2016 00:42:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 857932C14FB for ; Sat, 2 Apr 2016 00:42:25 +0000 (UTC) Date: Sat, 2 Apr 2016 00:42:25 +0000 (UTC) From: "John Omernik (JIRA)" To: dev@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (DRILL-4572) Column Alias Not Available in Subquery MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 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)