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 8951017C96 for ; Fri, 3 Apr 2015 22:19:54 +0000 (UTC) Received: (qmail 33441 invoked by uid 500); 3 Apr 2015 22:19:54 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 33388 invoked by uid 500); 3 Apr 2015 22:19:54 -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 33285 invoked by uid 99); 3 Apr 2015 22:19:54 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Apr 2015 22:19:54 +0000 Date: Fri, 3 Apr 2015 22:19:54 +0000 (UTC) From: "Sean Hsuan-Yi Chu (JIRA)" To: dev@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (DRILL-2301) Query fails when multiple table aliases are provided for CTEs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DRILL-2301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Hsuan-Yi Chu resolved DRILL-2301. -------------------------------------- Resolution: Fixed > 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 > Fix For: 1.0.0 > > Attachments: drillbit.log > > > 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)