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

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

                Author: ASF GitHub Bot
            Created on: 26/Jan/21 02:49
            Start Date: 26/Jan/21 02:49
    Worklog Time Spent: 10m 
      Work Description: jcamachor commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r564181657



##########
File path: parser/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
##########
@@ -151,11 +182,46 @@ expressionsNotInParenthesis[boolean isStruct, boolean 
forceStruct]
     -> {$more.tree}
     ;
 
-expressionPart[CommonTree t, boolean isStruct]
+expressionPart[CommonTree firstExprTree, boolean isStruct]
     :
     (COMMA expression)+
-    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$t} expression+)
-    -> {$t} expression+
+    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$firstExprTree} 
expression+)
+    -> {$firstExprTree} expression+
+    ;
+
+// Parses comma separated list of expressions with optionally specified 
aliases and store the aliases for further usage.
+// <expression> [<alias>] [, <expression> [<alias>]]
+firstExpressionsWithAlias
+@init { initAliases(); }
+    :
+    first=expression colAlias=identifier? (COMMA expressionWithAlias)*
+    -> {colAlias != null}? ^(TOK_FUNCTION Identifier["named_struct"] { 
adaptor.create(Identifier, addAlias($colAlias.tree.getText())) } {$first.tree} 
expressionWithAlias*)

Review comment:
       Could we maybe identify this construct with a specific token? Would that 
help to identify later in the plan generation this case?




----------------------------------------------------------------
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: 541461)
    Time Spent: 50m  (was: 40m)

> 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
>              Labels: pull-request-available
>          Time Spent: 50m
>  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