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

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

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


   ### What changes were proposed in this pull request?
   1. Declare a list in `IdentifiersParser` for storing aliases specified after 
expressions in the values clause first row. If no alias is specified generate 
one implicitly.
   2. Add methods to manipulate and query the list.
   3. Create a new `firstValueRowConstructor` from parser rule 
`valueRowConstructor` to parse the first and rest of the rows in a different 
way. Inline the brackets to these new rules like in `expressionsInParenthesis`
   4. Create `firstExpressionsWithAlias` and `moreExpressionsWithAlias` rules 
and call them from `firstValueRowConstructor`/`valueRowConstructor` rules based 
on the merge of existing rules: `expressionsNotInParenthesis` and 
`expressionPart`: since `isStruct` and `forceStruct` is always true when 
calling from `valueRowConstructor` keep only the  branch which is used when 
these two parameters are true in the new rules.
   5. Create parser rule `expressionWithAlias`. This rule handles expressions 
with and without alias and it stores the parsed/generated alias in a list 
mentioned in 1.
   6. Create parser rule `expressionWithStoredAlias` to parse a single 
expression without an alias explicitly specified but assign one from the stored 
ones.
   7. Rename the first parameter of parser rule `expressionPart`.
   
   ### Why are the changes needed?
   Support column aliases in Values clause. See jira or `values_alias.q` for 
example.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, but existing queries are not affected. With this patch users can define 
column aliases in the first row of Values clause. This type of alias definition 
is not supported in `INSERT INTO <table>[<column alias list>] VALUES([actual 
values])` statements.
   
   ### How was this patch tested?
   ```
   mvn test -Dtest=TestValuesClause -pl parser
   mvn test -Dtest.output.overwrite -DskipSparkTests 
-Dtest=TestMiniLlapLocalCliDriver -Dqfile=values.q,values_alias.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:
[email protected]


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

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

> Support column aliases in Values clause
> ---------------------------------------
>
>                 Key: HIVE-24664
>                 URL: https://issues.apache.org/jira/browse/HIVE-24664
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Enable explicitly specify column aliases in the first row of Values clause. 
> If not all the columns has alias specified generate one.
> {code:java}
> values(1, 2 b, 3 c),(4, 5, 6);
> {code}
> {code:java}
> _col1   b   c
>   1     2   3
>   4     5   6
> {code}
>  This is not an standard SQL feature but some database engines like Impala 
> supports it.



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

Reply via email to