[ 
https://issues.apache.org/jira/browse/HIVE-24633?focusedWorklogId=535468&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-535468
 ]

ASF GitHub Bot logged work on HIVE-24633:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Jan/21 15:23
            Start Date: 13/Jan/21 15:23
    Worklog Time Spent: 10m 
      Work Description: kasakrisz opened a new pull request #1865:
URL: https://github.com/apache/hive/pull/1865


   ### What changes were proposed in this pull request?
   1. Improve the parser to accept CTE clause with `with column list` specified:
   ```
   WITH cte(a, b) AS ...
   ```
   2. When transforming subquery AST tree to Calcite RelNode tree a new 
RowResolver is created for the subquery's top node to point its alias. Extend 
this logic with assign the `with column list` elements to each entry if 
explicitly specified in the `WITH` clause.
   
   ### Why are the changes needed?
   SQL standard enables this feature.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. When users specify `with column list` the list elements must be used to 
reference expressions in the CTE' select clause from the main query.
   
   ### How was this patch tested?
   ```
   mvn test -DskipSparkTests -Dtest=TestMiniLlapLocalCliDriver -Dqfile=cte_8.q 
-pl itests/qtest -Pitests
   mvn test -DskipSparkTests -Dtest=TestMiniLlapLocalCliDriver 
-Dqfile=cte_mat_1.q -pl itests/qtest -Pitests
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 535468)
    Remaining Estimate: 0h
            Time Spent: 10m

> Support CTE with column labels
> ------------------------------
>
>                 Key: HIVE-24633
>                 URL: https://issues.apache.org/jira/browse/HIVE-24633
>             Project: Hive
>          Issue Type: Improvement
>          Components: Parser
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {code}
> with cte1(a, b) as (select int_col x, bigint_col y from t1)
> select a, b from cte1{code}
> {code}
> a     b
> 1     2
> 3     4
> {code}
> {code}
> <query expression> ::=
>   [ <with clause> ] <query expression body>
>   [ <order by clause> ] [ <result offset clause> ] [ <fetch first clause> ]
> <with clause> ::=
>   WITH [ RECURSIVE ] <with list>
> <with list> ::=
>   <with list element> [ { <comma> <with list element> }... ]
> <with list element> ::=
>   <query name> [ <left paren> <with column list> <right paren> ]
>   AS <table subquery> [ <search or cycle clause> ]
> <with column list> ::=
>   <column name list>
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to