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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to