[ 
https://issues.apache.org/jira/browse/HIVE-1180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13883553#comment-13883553
 ] 

Harish Butani commented on HIVE-1180:
-------------------------------------

As a first step have converted references to a CTE in the Query into a SubQuery 
invocation.
This doesn't address the issue of materializing a CTE, which can then be used 
in multiple parts of the Query.
But this issue exists for views today. For e.g. the following query:
{noformat}
create view v1 as
select key, min(value) as value 
from src
group by key
;
explain
select a.key, b.key
from v1 a join v1 b on a.key = b.key;
{noformat}
Does the Group by on src twice. 

Can we address the issue of materialization in a subsequent jira?

Have attached a preliminary patch. 

> Support Common Table Expressions (CTEs) in Hive
> -----------------------------------------------
>
>                 Key: HIVE-1180
>                 URL: https://issues.apache.org/jira/browse/HIVE-1180
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Processor
>            Reporter: Jeff Hammerbacher
>         Attachments: HIVE-1180.1.patch
>
>
> I've seen some presentations from the PostgreSQL recently expounding the 
> utility of CTEs (http://en.wikipedia.org/wiki/Common_table_expressions). 
> Should we try to support these in Hive? I've never used them in practice, so 
> curious to hear if the community would find them useful.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to